You are viewing the RapidMiner Go documentation for version 9.6 - Check here for latest version
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 the examples below. The alternative, simpler approach -- no programming required! -- is to apply your model to new data from within RapidMiner Go.
You can deploy the model either:
immediately after you're finished building it, from within Inspect results, or
later, by clicking on a recent analysis, via Home > Manage recent analyses
To do so, choose a model, click on Apply Model, and select Deploy Model from the drop-down menu. When the Manage Deployment dialog appears, click Deploy Model.
For each model you deploy, RapidMiner Go provides you with a deployment URL, and you can submit your data to that URL, as described in more detail in the steps below.
The deployed model can be found under Home > Manage deployed models. To undeploy the model, follow exactly the same procedure as for deploying the model, but now click Undeploy 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 in Apply your model from 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 JSON objects (in curly brackets), corresponding to the three rows of data in the CSV file, inside a JSON array (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-called minified format, 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 is posted, 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 it from 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 data using python
Use the requests library.
import requests deployment_url = 'https://go.rapidminer.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 data using 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.rapidminer.com/am/api/deployments/12d6513f-8a7b-44c3-b562-8867f59de95f
Post data using 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 the Advanced REST client extension for Google Chrome.
Click on Add to Chrome, and open the app.
For the request Method, choose "POST", and insert the deployment URL from RapidMiner Go as the Request URL.
Under Headers, choose "Content-Type" for the Header name and "application/json" for the Header value.
Under Body, insert the input data in JSON format.
Click Send. If the POST succeeded, the status code "200 OK" is returned, together with the output from RapidMiner Go.