Use the Regression Model Template to Predict Data Records
- How to predict data records using your machine learning model
- How to
undeployand delete your model - How to delete datasets and dataset schemas
- Step 1
In the service key you created for Data Attribute Recommendation in the previous tutorial: Use Free Tier to Set Up Account for Data Attribute Recommendation and Get Service Key or Use Trial to Set Up Account for Data Attribute Recommendation and Get Service Key, you find a section called
swagger(as highlighted in the image below) with three entries, calleddm(data manager),mm(model manager) andinference.
For the following step, copy the URL of the Swagger UI for
inferenceand open it in a browser tab. The Swagger UI for inference allows you to predict data records using your machine learning model that you have created in the previous tutorial: Use the Regression Model Template to Train a Machine Learning Model.-
To be able to use the Swagger UI endpoints, you need to authorize yourself. In the top right corner, click Authorize.

-
Get the
access_tokenvalue created in the previous tutorial: Get OAuth Access Token for Data Attribute Recommendation Using Any Web Browser, then add Bearer (with capitalized “B”) in front of it, and enter in the Value field.Bearer <access_token> -
Click Authorize and then click Close.

-
- Step 2
To predict data records, proceed as follows:
-
Expand the endpoint
POST /models/{modelName}/versions/1by clicking on it. Then click Try it out.
-
In the parameter
modelName, enter your model name,regression_tutorial_model, for example. -
In the parameter
body, you have to provide the data you want to predict. According to the dataset schema that you have created in Use the Regression Model Template to Upload Data to Data Attribute Recommendation with Swagger UI, the machine learning model takes the manufacturer and description of the product as input and predicts the price of the product. Replace the text in the parameterbodywith the following:JSONCopy{ "topN":1, "objects":[ { "objectId":"optional-identifier-1", "features":[ {"name":"manufacturer", "value":"Energizer"}, {"name":"description", "value":"Alkaline batteries; 1.5V"} ] }, { "objectId":"optional-identifier-2", "features":[ {"name":"manufacturer","value":"Eidos"}, { "name":"description", "value":"Unravel a grim conspiracy at the brink of Revolution" } ] } ] } -
Click Execute to send the above input for prediction to the service.

In the response of the service, you find the values that the model predicted.

The regression model template produces a different output when compared with the other Data Attribute Recommendation model templates and business blueprints. Instead of providing a pair
value/probabilityresult, it returns a pairvalue/std.The regression model template is not deterministic. The
valueis the average of several hundred predictions made by the model for the same input andstdis the standard deviation of these predictions. Thestdshould give a feeling of how certain the model is about the predictedvalue. The smaller thestd, the more confident the model prediction.For example, in the first result below (“value”: “233.9787445068”), the model has predicted the average price of 234 dollars. Most of the model predictions lie in the area between 201 (234-33) and 267 (234+33) dollars. Therefore the model is quite confident and even more accurate in the second result (“value”: “137.1488037109”) that has a standard deviation of only 19.
JSONCopy{ "id": "9f989bcf-2275-4682-654a-d5ea1acba0a9", "predictions": [ { "labels": [ { "name": "price", "results": [ { "std": 33.0863685608, "value": "233.9787445068" } ] } ], "objectId": "optional-identifier-1" }, { "labels": [ { "name": "price", "results": [ { "std": 18.7408504486, "value": "137.1488037109" } ] } ], "objectId": "optional-identifier-2" } ], "processedTime": "2022-05-10T13:00:23.024141", "status": "DONE" }You have successfully predicted the price of product data records. Feel free to adapt the examples above and retry the prediction.
The regression model template ONLY supports:
-
- Step 3
Now that you have learned the whole process about how to use the Regression Model Template from the Data Attribute Recommendation service, it’s time to clean up. This way, the technical limits won’t get in your way when trying out other Data Attribute Recommendation tutorials. See Technical Constraints and Free Tier Option Technical Constraints.
First,
undeployyour model. For that, go back to the Swagger UI formmand:-
Expand the endpoint
DELETE /deployments/{deploymentId}by clicking on it. Then click Try it out.
-
Fill the parameter
deploymentIdwith the ID of your deployment. Use theGET /deploymentsendpoint in case you no longer have the deploymentidin hand.
If the response code is
204, the model has been successfullyundeployed.
You have successfully
undeployedyour model, but the model is not yet deleted. Instead it isn’t in production which means that you cannot make inference requests. You can deploy it again at any time using thePOST /deploymentsendpoint. -
- Step 4
Once
undeployed, you can delete your model.-
Expand the endpoint
DELETE /models/{modelName}by clicking on it. Then click Try it out.
-
Fill the parameter
modelNamewith the name of your machine learning model (regression_tutorial_model). Use theGET /modelsendpoint in case you no longer have the modelnamein hand.
If the response code is
204, the model has been successfully deleted.
-
- Step 5
Now that the model is deleted, you can delete the training job that created the model.
-
Expand the endpoint
DELETE /jobs/{jobId}by clicking on it. Then click Try it out.
-
Fill the parameter
jobIdwith the ID of your training job. Use theGET /jobsendpoint in case you no longer have the jobidin hand.
If the response code is
204, the training job has been successfully deleted.
-
- Step 6
To clear the uploaded data, you can now delete the dataset as the associated training job is already deleted. For that, go back to the Swagger UI for
dmand:-
Expand the endpoint
DELETE /datasets/{id}by clicking on it. Then click Try it out.
-
Fill the parameter
idwith the ID of your dataset. Use theGET /datasetsendpoint in case you no longer have the datasetidin hand.
If the response code is
204, the dataset has been successfully deleted.
-
- Step 7
If you do not need your dataset schema anymore, you can delete it as well.
-
Expand the endpoint
DELETE /datasetSchemas/{id}by clicking on it. Then click Try it out.
-
Fill the parameter
idwith the ID of your dataset schema. Use theGET /datasetSchemasendpoint in case you no longer have the dataset schemaidin hand.
If the response code is
204, the dataset schema has been successfully deleted.
Congratulations, you have completed this tutorial.
-