Collaborative Machine Learning in Python

Welcome to the documentation of the OpenML Python API, a connector to the collaborative machine learning platform The OpenML Python package allows to use datasets and tasks from OpenML together with scikit-learn and share the results online.


import openml
from sklearn import preprocessing, tree, pipeline

# Set the OpenML API Key which is required to upload your runs.
# You can get your own API by signing up to
openml.config.apikey = 'ABC'

# Define a scikit-learn classifier or pipeline
clf = pipeline.Pipeline(
        ('imputer', preprocessing.Imputer()),
        ('estimator', tree.DecisionTreeClassifier())
# Download the OpenML task for the german credit card dataset with 10-fold
# cross-validation.
task = openml.tasks.get_task(31)
# Run the scikit-learn model on the task.
run = openml.runs.run_model_on_task(clf, task)
# Publish the experiment on OpenML (optional, requires an API key).
print('View the run online: %s/run/%d' % (openml.config.server, run.run_id))

How to get OpenML for python

You can install the OpenML package via pip:

pip install openml

For more advanced installation information, please see the Installation section.


Contribution to the OpenML package is highly appreciated. The OpenML package currently has a 1/4 position for the development and all help possible is needed to extend and maintain the package, create new examples and improve the usability. Please see the Contributing page for more information.