Analytics Manager > Using the Tutorials > Tutorial: Use the Analytics Server Connector for Predictive Scoring on Non-time Series Models
Tutorial: Use the Analytics Server Connector for Predictive Scoring on Non-time Series Models
With this tutorial, learn how to use the TW.AnalysisServices.AnalyticsServer.AnalyticsServerConnector connector in Analytics Manager and the prediction service in Analytics Server to perform predictive scoring on non-time series models. The following list is a high-level overview of tasks that you need to complete:
* 
This tutorial does not include each step of creating different entities in Analytics Manager and ThingWorx Composer. It is assumed that you have basic knowledge about these applications. However, appropriate links have been provided, wherever required.
Step A: Test and Enable an Analysis Model in Analytics Manager
1. Use the TW.AnalysisServices.AnalyticsServer.AnalyticsServerConnector connector to create the analysis provider. For this demo, create the ServerProvider analysis provider.
For more information about creating an analysis provider, refer to Create an Analysis Provider.
2. Create an analysis model in Analytics Manager. This model is uploaded to the configured Analytics Server. To create the NonTimeSeriesJetEngineModel model, complete the following steps:
a. Download the sample predictive model provided in the Reference Documents section of the PTC eSupport Portal: NonTimeSeriesJetEngine.zip.
b. In the Create Analysis Model window, select the Upload Model? check box, and browse to the location where you saved the predictive model file.
For more information about creating an analysis model, refer to Create an Analysis Model.
Alternatively, if you have a model that is in the “completed” state in Analytics Builder, select the model, and click Publish. This model from Analytics Builder opens as an analysis model in Analytics Manager.
3. Test the analysis model by performing the following steps:
a. From the Analysis Models page, select the NonTimeSeriesJetEngineModel model that you created in the previous step, and click View.
b. From the left navigation pane, click Test.
c. Under the Inputs for the Analysis Job section, enter the following input values in the fields of the Input Data Row Values sub-section:
causalTechniqueFULL_RANGE
You can also set the value of causalTechnique to DISTANCE_FROM_MIN or DISTANCE_FROM_MAX.
goalFieldTTF
* 
The MiningSchema tag lists all the fields in the model. For this model, the TTF field is specified with usageType="predicted", and so it is the goal name that is used while requesting a predictive score.
importantFieldCount2
d. Click Add Row.
e. Click Submit Job to initiate the analysis job.
f. Under the Results from the Analysis Job section, view the results that are saved to the ServerProvider.NonTimeSeriesJetEngineModel.ResultDataShape infotable. This infotable has the following fields:
errorMessage
importantFields
TTF
TTF_mo
* 
The results that are returned depend on the output fields that are defined in the PMML model. Different models may have different result fields.
4. Enable the analysis model that you created.
Step B: Create a Thing in ThingWorx Composer
1. 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 ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThing thing is created that inherits the ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThingTemplate thing template.
2. Set values of the following properties on the ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThing thing:
causalTechniqueFULL_RANGE
goalNameTTF
importantFieldCount2
Step C: Create and Enable an Analysis Event in Analytics Manager
1. When you create an analysis event, select the following options in the Create New Event window:
a. In the Source Type (Required) list, select Thing.
b. In the Source (Required) list, click the icon to search for the ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThing thing.
c. In the Event (Required) list, select AnyDataChange.
d. In the Provider Name (Required) list, select the ServerProvider provider.
e. In the Model Name (Required) list, select the NonTimeSeriesJetEngineModel model.
f. In the Retain Job History field, select All.
For information about creating an analysis event, see Create an Analysis Event.
2. 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
Thing
Steps
Inputs
Thing
Source — ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThing
a. Click Map All to map all the properties.
b. Under the Input Data Shape section, select the key property, and click Remove to remove the mapping.
Results
Event Source
Target — ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThing
a. Click Map All to map all the properties.
b. Under the Result Data Shape section, select the key property, and click Remove to remove the mapping.
For more information about inputs mapping, see Map Input Data. For information about results mapping, see Map Result Data.
3. Select the event, and click Enable to enable the analysis event.
Step D: Configure the Connector Thing for Asynchronous Jobs in ThingWorx Composer (optional)
By default, the AnalyticsServerConnector handles analysis jobs synchronously. If you prefer to handle the jobs asynchronously, follow the steps below to enable the runJobAsAsync property.
1. In ThingWorx Composer, open the list of Things.
2. Navigate to the TW.AnalysisServices.AnalyticsServer.AnalyticsServerConnector Thing and open it.
3. Open the Properties and Alerts tab.
4. On the runJobAsAsync property, click the Edit icon () in the Value column. A panel opens on the right.
5. Set the property value to True and click the Save icon (). The check box in the Value column will appear checked.
Step E: Trigger the Analysis Event from ThingWorx Composer
1. Since the event is set to be triggered on data change of any property, change the value of any of the input properties of the ServerProvider-NonTimeSeriesJetEngineModel-AnalysisThing thing.
As soon as you set the value of the property, an analysis event is triggered in Analytics Manager, and an analysis job is created.
Step F: View the results in Analytics Manager
View the results on the Analysis Jobs page in Analytics Manager. For more information, see Working with Analysis Jobs.
The results are saved to the ServerProvider.NonTimeSeriesJetEngineModel.ResultDataShape infotable.
Step G: View the results in ThingWorx Composer
Since we have mapped results back to the properties of the ServerProvider.NonTimeSeriesJetEngineModel.ResultDataShape thing, the result values are also available in the result properties of the thing.
Was this helpful?