Classification and Regression with the BigML Dashboard

3.7 Consuming Linear Regressions

Similarly to other models in BigML, linear regressions are white-boxed models, so you can download them and used them locally to make predictions. You can also create and consume your linear regressions programmatically via the BigML API and bindings. The following subsections explain those three options.

3.7.1 Downloading Linear Regressions

You can download your linear regression in several programming languages including JSON PML, Python or Node.js. By downloading your linear regression you will be able to compute predictions locally, free of latency and at no cost. Click on the download icon in the top menu (see Figure 3.100 ), and select your preferred option (see Figure 3.101 )

\includegraphics[]{images/linearregression/lnr-download0}
Figure 3.100 Click download icon
\includegraphics[]{images/linearregression/lnr-download}
Figure 3.101 Select language to download linear regression

3.7.2 Using Linear Regressions via the BigML API

linear regression have full citizenship in the BigML API which allows you to programmatically create, configure, retrieve, list, update, delete, and use them for predictions.

In the below example, see how to create a linear regression using an existing dataset once you have properly set the BIGML_AUTH environment variable to contain your authentication credentials:

curl "https://bigml.io/linearregression?\$BIGML_AUTH" \
    -X POST \
    -H 'content-type: application/json' \
    -d '{"dataset": "dataset/5c7057a9983efc4cc2000005"}'

For more information on using linear regressions through the BigML API, please refer to the documentation.

3.7.3 Using Linear Regressions via the BigML Bindings

You can also create and use linear regressions via BigML bindings which are libraries aimed to make it easier to use the BigML API from your language of choice. BigML offers bindings in multiple languages including Python, Node.js, Java, Swift and Objective-C. See below an example to create a linear regression with the Python bindings.

from bigml.api import BigML
api = BigML()
linearrregression = api.create_linear_regression(
    'dataset/5c87d50d983efc4a02000085', {"objective_field":"plasma glucose"})

For more information on BigML bindings, please refer to the bindings page.