Deploy and Configure a PredictionModel Custom Function in Monitor
Note
Skip steps 1, 2, 3, 4 and 5 if you are in the Think2021 Hands on Lab session. These steps have already been done for you.
In this exercise you deploy a Monitor Custom Function to call the Prediction Model to make prediction. Custom Functions are stored in Github Repositories. Functions must be added to an Asset Type and scheduled in a pipeline to run.
Here is the Architecture flow for this tutorial.
-
In order for Maximo Monitor pipeline to access private Github repositories you must create a token. Login to Github.
-
Create a personal access token for your custom function repository using these instructions
-
Append the token to the URL in
function.py
See the already updated URL for the custom function to call thePredictionModel
in theai_prediction/functions.py
PACKAGE_URL = 'git+https://yourtoken@github.com/yourgithub/maximo_autoai.git'
-
Save and commit the changes to the github repo.
git add ./custom/functions.py git commit -m "my function changes" git push origin master
-
Custom Functions are stored in Github Repositories. They are added to a Monitor catalog by registering them. Register the function using this script.
python3 ./scripts/register_RredictionModel_function.py
-
After registering the function in Monitor, you can add the
PredictionModel
custom function from the catalog topump_co
Asset Type. This will enable the function to run every 5 minutes and make a prediction using latest meter readings. Navigate to theSetup
menu. Search for and pick thepump_co
asset type and click on theSetup Asset Type
Link -
Click the
+
icon to add a data item function as a calculated metric to your Asset Type. -
Search for the
PredictionModel
function. -
Set the value for the
Model Name
to the one you used in the earlier exercise Deploy and Configure a Prediction Model Custom Function in Monitor that includes your initials.modelname = power_random_forest_yourinitials.mod
Each Asset can have multiple associatedmetrics
which track sensor readings over time. Since the model you created requiresspeed
,flow
,voltage
,CURRENT
to predictPOWER
Select the those as input metrics to the function. Click theNext
button. -
Set the name of the
Output metric
name topower_prediction
This will have the predicted power value returned from your Model invoked by your PredictionModel custom function. -
The pipeline is scheduled to run ever 5 mins by default. You must wait five minute for the pipeline to execute and calculate your