Categories

Versions

Deploy your model

By deploying your model, you make it available to other people and other software. The idea is that you (or somebody!) will write a program that uses your model to make predictions. If that program has a user interface that is accessible to other people, then other people will also have access to the results.

What kind of program? Once you have deployed the model, any software application that is capable of posting data over HTTP (that's a long list!) can submit data to the model and generate a prediction. See theexamples below. The alternative, simpler approach -- no programming required! -- is toapply your modelto new data from within RapidMiner Go.

You can deploy the model either:

  1. immediately after you're finished building it, from withinInspect results, or

  2. later, by clicking on a recent analysis, viaHome>Manage recent analyses

To do so, choose a model, click onApply Model, and selectDeploy Modelfrom the drop-down menu. When theManage Deploymentdialog appears, clickDeploy Model.

For each model you deploy, RapidMiner Go provides you with adeployment URL, and you can submit your data to that URL, as described in more detail in the steps below.

  1. Format the input data as JSON

  2. POST the data to the deployment URL given by RapidMiner Go

The deployed model can be found underHome>Manage deployed models. To undeploy the model, follow exactly the same procedure as for deploying the model, but now clickUndeploy Model.

Format the input data as JSON

If you want to make a prediction based on some input data, RapidMiner Go requires you to submit the data in JSON format. Even if you're not familiar with JSON format, there are plenty of online tools that can help you to properly format your data. If your starting point is CSV format, the following tools may be helpful:

Using the first tool, we can convert the three proposals for the advertising budget discussed inApply your modelfrom CSV format:

TV,radio,newspaper 200,0,100 250,50,0 300,0,0

to JSON format, as shown below.

[ { "TV": 200, "radio": 0, "newspaper": 100 }, { "TV": 250, "radio": 50, "newspaper": 0 }, { "TV": 300, "radio": 0, "newspaper": 0 } ]

The output in this example contains three JSONobjects(in curly brackets), corresponding to the three rows of data in the CSV file, inside a JSONarray(square brackets). The final step in preparing the input data for RapidMiner Go is to embed this JSON array into another JSON object, with the "data" keyword:

{ "data": [insert JSON array here] }

In a so-calledminifiedformat, the JSON input to RapidMiner Go looks like this:

{"data":[{"TV":200,"radio":0,"newspaper":100},{"TV":250,"radio":50,"newspaper":0},{"TV":300,"radio":0,"newspaper":0}]}

RapidMiner Go returns the output as JSON

After the data isposted, RapidMiner Go returns an output, also in JSON format. Every JSON object posted to the deployment URL is returned together with a prediction. In what follows, we will consider a variety of methods for posting data, but no matter what method you choose, the results will include "prediction(sales)".

{ "data":[ { "newspaper":100.0, "TV":200.0, "prediction(sales)":10.9, "radio":0.0 }, { "newspaper":0.0, "TV":250.0, "prediction(sales)":25.4, "radio":50.0 }, { "newspaper":0.0, "TV":300.0, "prediction(sales)":10.9, "radio":0.0 } ] }

You can take this output and convert itfrom JSON back to CSV.

POST data to the deployment URL

There are many ways of posting data to a URL to generate a prediction. Try the following examples, after substituting your own data and your own deployment URL.

Post数据你sing python

Use therequestslibrary.

import requests deployment_url = 'https://go.www.turtlecreekpls.com/am/api/deployments/12d6513f-8a7b-44c3-b562-8867f59de95f' my_input_data = {"data":[{"TV":200,"radio":0,"newspaper":100},{"TV":250,"radio":50,"newspaper":0},{"TV":300,"radio":0,"newspaper":0}]} r = requests.post(deployment_url, json=my_input_data) json_output = r.json() print(json_output)

Post数据你sing curl

Put your input data into a file (e.g,my_input_data.json), and you can post it from the command line:

curl --request POST \ --header "Content-Type: application/json" \ --data @my_input_data.json \ https://go.www.turtlecreekpls.com/am/api/deployments/12d6513f-8a7b-44c3-b562-8867f59de95f

Post数据你sing a browser extension

Even if your only software tool is the browser, you can still post your data to RapidMiner Go, using one of the many REST client browser extensions. As an example, we demonstrate the use of theAdvanced REST client extension for Google Chrome.

  1. Click onAdd to Chrome, and open the app.

  2. For the requestMethod, choose "POST", and insert the deployment URL from RapidMiner Go as theRequest URL.

  3. Under,选择“内容类型”Header nameand "application/json" for theHeader value.

  4. UnderBody插入,输入数据JSON format.

  5. ClickSend. If the POST succeeded, the status code "200 OK" is returned, together with the output from RapidMiner Go.