Skip to main content

An open source binding to, the public BigML API

Project description

BigML Python Bindings

`BigML <>`_ makes machine learning easy by taking care
of the details required to add data-driven decisions and predictive
power to your company. Unlike other machine learning services, BigML
`beautiful predictive models <>`_ that
can be easily understood and interacted with.

These BigML Python bindings allow you to interact with, the API
for BigML. You can use it to easily create, retrieve, list, update, and
delete BigML resources (i.e., sources, datasets, models and,

This module is licensed under the `Apache License, Version
2.0 <>`_.


Please report problems and bugs to our ` issue
tracker <>`_.

Discussions about the different bindings take place in the general
`BigML mailing list <>`_. Or join us
in our `Campfire chatroom <>`_.


Python 2.6 and Python 2.7 are currently supported by these bindings.

The only mandatory third-party dependencies are the
`requests <>`_,
`poster <>`_ and
`unidecode <>`_ libraries. These
libraries are automatically installed during the setup.

The bindings will also use ``simplejson`` if you happen to have it
installed, but that is optional: we fall back to Python's built-in JSON
libraries is ``simplejson`` is not found.


To install the latest stable release with
`pip <>`_::

$ pip install bigml

You can also install the development version of the bindings directly
from the Git repository::

$ pip install -e git://

Importing the module

To import the module::

import bigml.api

Alternatively you can just import the BigML class::

from bigml.api import BigML


All the requests to must be authenticated using your username
and `API key <>`_ and are always
transmitted over HTTPS.

This module will look for your username and API key in the environment
variables ``BIGML_USERNAME`` and ``BIGML_API_KEY`` respectively. You can
add the following lines to your ``.bashrc`` or ``.bash_profile`` to set
those variables automatically when you log in::

export BIGML_USERNAME=myusername
export BIGML_API_KEY=ae579e7e53fb9abd646a6ff8aa99d4afe83ac291

With that environment set up, connecting to BigML is a breeze::

from bigml.api import BigML
api = BigML()

Otherwise, you can initialize directly when instantiating the BigML
class as follows::

api = BigML('myusername', 'ae579e7e53fb9abd646a6ff8aa99d4afe83ac291')

Also, you can initialize the library to work in the Sandbox environment by
passing the parameter ``dev_mode``::

api = BigML(dev_mode=True)

Quick Start

Imagine that you want to use `this csv
file <>`_ containing the `Iris
flower dataset <>`_ to
predict the species of a flower whose ``sepal length`` is ``5`` and
whose ``sepal width`` is ``2.5``. A preview of the dataset is shown
below. It has 4 numeric fields: ``sepal length``, ``sepal width``,
``petal length``, ``petal width`` and a categorical field: ``species``.
By default, BigML considers the last field in the dataset as the
objective field (i.e., the field that you want to generate predictions


sepal length,sepal width,petal length,petal width,species

You can easily generate a prediction following these steps::

from bigml.api import BigML

api = BigML()

source = api.create_source('./data/iris.csv')
dataset = api.create_dataset(source)
model = api.create_model(dataset)
prediction = api.create_prediction(model, {'sepal length': 5, 'sepal width': 2.5})

You can then print the prediction using the ``pprint`` method::

>>> api.pprint(prediction)
species for {"sepal width": 2.5, "sepal length": 5} is Iris-virginica

Additional Information

We've just barely scratched the surface. For additional information, see
the `full documentation for the Python
bindings on Read the Docs <>`_.
Alternatively, the same documentation can be built from a local checkout
of the source by installing `Sphinx <>`_
(``$ pip install sphinx``) and then running::

$ cd docs
$ make html

Then launch ``docs/_build/html/index.html`` in your browser.

How to Contribute

Please follow the next steps:

1. Fork the project on
2. Create a new branch.
3. Commit changes to the new branch.
4. Send a `pull request <>`_.

For details on the underlying API, see the
`BigML API documentation <>`_.

.. :changelog:


0.4.0 (2012Y-08-20)

- Development Mode
- Remote Sources
- Bigger files streamed with Poster
- Asynchronous Uploading
- Local Models
- Local Predictions
- Rule Generation
- Python Generation
- Overall clean up

0.3.1 (2012-07-05)

- Initial release for the "andromeda" version of

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bigml-0.4.0.tar.gz (29.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page