Tutorial: Use the ThingPredictor Agent for Predictive Scoring
ThingPredictor software media is no longer available for download as of 8.3.
Any new model that you publish from Analytics Builder is uploaded to the Analytics Server instead of ThingPredictor.
During the course of this tutorial, you will learn how to create an analysis provider and an analysis model. You need to install and deploy the ThingPredictor agent. Once you enable the analysis model, you can create an event. Then, you can trigger this event to generate analysis jobs and view the predictive scores.
Follow the steps in this section to learn how to use ThingPredictor:
1. Create the analysis provider.
Note the following points:
• In the Provider Name (Required) enter, enter the name of the provider as PredictorProvider.
• In the Connector (Required) list, click the icon to search for and select the TW.AnalysisServices.ThingPredictorConnector connector.
2. Start the ThingPredictor agent that is packaged with the Analytics Extension. If the agent is not already installed, install and configure the agent so that it connects to your ThingWorx server. For more information, refer to Configure the ThingPredictor Agent.
The following video demonstrates the process of creating an analysis provider for ThingPredictor, and starting up the ThingPredictor agent:
3. Create an analysis model. If your model file is not valid, model deployment times out.
For the demo, create the JetEnginePredictiveModel model. Use one of the following options to create an analysis model:
◦ Use Analytics Manager to create an analysis model.
You can use the sample predictive model provided in the Reference Documents section of the PTC eSupport Portal: JetEnginePredictiveModel.zip.
In the Create Analysis Model window, select the Upload Model? check box, and browse to the location where you saved the predictive model file that you downloaded. For more information about creating an analysis model, refer to Create an Analysis Model.
◦ Use Analytics Builder to create an analysis model in Analytics Manager. On the Models list page in Analytics Builder, select a model that is in the “completed” state, and click Publish. This publishes the model to Analytics Manager and opens it as an analysis model.
Ensure that you enable the analysis model that you have created.
4. Test the analysis model by performing the following steps:
a. From the Analysis Models page, select the JetEnginePredictiveModel model that you created in the previous step, and click View.
b. From the left navigation pane, click Test.
c. Enter the input values in the Inputs for the Analysis Job section. To do this, complete the following steps:
a. Under the Input Data Shape section, select the PredictorProvider.JetEnginePredictiveModel.InputParamsDataShape input data shape.
b. Under the Input Data Row Values section, enter the inputs in the following fields:
▪ causalTechnique — FULL_RANGE
You can set the value of causalTechnique to DISTANCE_FROM_MIN or DISTANCE_FROM_MAX.
▪ goalName — TTF
For this demo file, the MiningSchema tag lists all the fields in the model. The TTF field is specified with usageType="predicted", and so it is the goal name that is used while requesting a prediction.
▪ importantFieldCount — 2
c. Click Add Row.
d. Select the row that you have added, and click Set Parent Row.
e. Under the Input Data Shape section, select the data infotable nested within the input data shape.
f. Under the Input Data Row Values section, enter the input values in the fields under the Input Data Row Fields section, and click Add Row.
g. Click Submit Job to initiate the analysis job.
h. Under the Results from the Analysis Job section, view the results that are saved to the PredictorProvider.JetEnginePredictiveModel.ResultDataShape data shape.
The predictiveScore infotable contains the predicted scoring values in different formats. The different types of results depend on your predictive model.
The importantFields infotable provides which of the fields have the most influence on the predicted scoring values. In this scenario, since the value of the importantFieldCount is set to 2, ThingPredictor returns the 2 input fields that have the most influence on the goal.
The following video demonstrates the process of publishing the predictive model from Analytics Builder and testing the model in Analytics Manager:
5. Create a thing template by using the model that you created. To do this, complete the following steps:
a. Use the CreateOrUpdateThingTemplateAndThingForModel service in the TW.AnalysisServices.ModelManagementServicesAPI resource to create a thing template that inherits the input and result data shape properties of the specified model, and a thing that inherits this thing template. For information about creating this thing template and thing, see the input and result parameters at Services for Managing Models.
Once you execute the CreateOrUpdateThingTemplateAndThingForModel service, the PredictorProvider-JetEnginePredictiveModel-AnalysisThing thing is created that inherits the PredictorProvider-JetEnginePredictiveModel-AnalysisThingTemplate thing template.
b. View the PredictorProvider-JetEnginePredictiveModel-AnalysisThingTemplate thing template, and set the value of Data Change Type of the data property to Always.
c. Set values of the following properties on the PredictorProvider-JetEnginePredictiveModel-AnalysisThing thing.
▪ causalTechnique — FULL_RANGE
▪ goalName — TTF
▪ importantFieldCount — 2
The following video demonstrates the process of creating a thing template and thing for predictive scoring:
6. Create an analysis event by entering the following information in all the fields correctly:
a. In the Source Type (Required) list, select one of the options in the list. For this demo, select Thing Template.
b. In the Source (Required) list, click the icon to search for the thing template that you created. For the demo, search for the PredictorProvider-JetEnginePredictiveModel-AnalysisThingTemplate thing template.
c. In the Event (Required) list, select DataChange.
d. In the Property (Required) list, select data.
e. In the Provider Name (Required) list, select the provider. For the demo, select PredictorProvider.
f. In the Model Name (Required) list, select the model. For the demo, select JetEnginePredictiveModel.
g. Click Save to save the analysis event.
7. Select the analysis event that you created, and click Map Data. In the Map Analysis Input and Results to Properties window, map the following inputs and result:
Mapping Type
Source Type
Properties to be Mapped
Inputs
Thing Shape or Template
Map the following properties to the corresponding input data shapes:
• causalTechnique
• goalName
• importantFieldCount
• data
Results
Event Source
Map the dataCollection property to the corresponding result data shape.
For more information about inputs mapping, see Map Input Data. For information about results mapping, see Map Result Data.
8. On the Analysis Events page, select the event and click Enable to enable the analysis event.
9. In ThingWorx Composer, modify the value of the data property of the PredictorProvider-JetEnginePredictiveModel-AnalysisThing thing.