Classification and Regression with the BigML Dashboard

1.8 Consuming Models

In the previous sections, we have described how you can create BigML models, configure them, use them to make predictions, and more. This section will introduce a number of BigML features that enable interesting ways of taking advantages of BigML models: exporting them locally, and using them programmatically via the BigML REST API and Bindings.

1.8.1 Exporting and Downloading Models

You can export your model in a variety of programming languages, in PMML or in Excel format. Just click on the download icon in the top menu and select your preferred option.

The main goal of downloading your model in a programming language is to make Local predictionss faster and at no cost. (See Using Model Predictions via the BigML Bindings .)

\includegraphics[]{images/models/download-model}
Figure 1.95 Download your model

If you are interested in exporting only the rules of a particular branch, you click on the branch leaf and press Shift from your keyboard. An icon to export the branch rules will appear below the prediction path. (See Figure 1.96 .) Release the frozen view by pressing Escape.

\includegraphics[]{images/models/download-branch}
Figure 1.96 Download branch rules

1.8.2 Using Models via the BigML API

Models have full citizenship in the BigML API. This means you can programmatically create, update, list, delete, and use them for predictions. For example, this is how you can create a model from the command line with custom values for a few available arguments. This will require you have properly set the BIGML_AUTH environment variable to contain your authentication credentials:

curl "https://bigml.io/model?$BIGML_AUTH" \
     -X POST \
     -H 'content-type: application/json' \
     -d '{"dataset": "dataset/4f66a80803ce8940c5000006",
          "name": "my model",
          "range": [25, 125]}'

For more information on using models through the BigML API, please refer to model REST API documentation.

1.8.3 Using Models via the BigML Bindings

BigML bindings provide a convenient way to access BigML REST API from your language of choice. They offer a higher-level view of BigML Machine Learning resources and algorithms in a number of languages, including Python, Node.js, Java, Swift, and Objective-C. For example, this is how you can create a model in Python using BigML bindings:

from bigml.api import BigML
api = BigML()
prediction = api.create_model("dataset/573d997058a27e0f620038df",
                              "range": [1, 10],
                              {"name": "my Model"})

For more information on using models through the BigML API, please refer to BigML bindings documentation.