Skip to content

OpenML#

The Python API for a World of Data and More

Welcome to the documentation of the OpenML Python API, a connector to the collaborative machine learning platform OpenML.org. OpenML-Python can download or upload data from OpenML, such as datasets and machine learning experiment results.

If you are new to OpenML, we recommend checking out the OpenML documentation to get familiar with the concepts and features of OpenML. In particular, we recommend reading more about the OpenML concepts.

🕹 Minimal Examples#

Use the following code to get the credit-g dataset:

import openml

dataset = openml.datasets.get_dataset("credit-g") # or by ID get_dataset(31)
X, y, categorical_indicator, attribute_names = dataset.get_data(target="class")

Get a task for supervised classification on credit-g:

import openml

task = openml.tasks.get_task(31)
dataset = task.get_dataset()
X, y, categorical_indicator, attribute_names = dataset.get_data(target=task.target_name)
# get splits for the first fold of 10-fold cross-validation
train_indices, test_indices = task.get_train_test_split_indices(fold=0)

Use an OpenML benchmarking suite to get a curated list of machine-learning tasks:

import openml

suite = openml.study.get_suite("amlb-classification-all")  # Get a curated list of tasks for classification
for task_id in suite.tasks:
    task = openml.tasks.get_task(task_id)
Find more examples in the navbar at the top.

🪄 Installation#

OpenML-Python is available on Linux, MacOS, and Windows.

You can install OpenML-Python with:

pip install openml

For more advanced installation information, please see the "Introduction" example.

Further information#

Contributing#

Contributing to the OpenML package is highly appreciated. Please see the "Contributing" page for more information.

Citing OpenML-Python#

If you use OpenML-Python in a scientific publication, we would appreciate a reference to our JMLR-MLOSS paper "OpenML-Python: an extensible Python API for OpenML":

@article{JMLR:v22:19-920,
    author  = {Matthias Feurer and Jan N. van Rijn and Arlind Kadra and Pieter Gijsbers and Neeratyoy Mallik and Sahithya Ravi and Andreas Müller and Joaquin Vanschoren and Frank Hutter},
    title   = {OpenML-Python: an extensible Python API for OpenML},
    journal = {Journal of Machine Learning Research},
    year    = {2021},
    volume  = {22},
    number  = {100},
    pages   = {1--5},
    url     = {http://jmlr.org/papers/v22/19-920.html}
}

Feurer, Matthias, et al. "OpenML-Python: an extensible Python API for OpenML." Journal of Machine Learning Research 22.100 (2021):1−5.