Tasks
A brief example on how to use tasks from OpenML.
In [ ]:
Copied!
import openml
import openml
Get a task for supervised classification on credit-g:
In [ ]:
Copied!
task = openml.tasks.get_task(31)
task = openml.tasks.get_task(31)
Get the dataset and its data from the task.
In [ ]:
Copied!
dataset = task.get_dataset()
X, y, categorical_indicator, attribute_names = dataset.get_data(target=task.target_name)
dataset = task.get_dataset()
X, y, categorical_indicator, attribute_names = dataset.get_data(target=task.target_name)
Get the first out of the 10 cross-validation splits from the task.
In [ ]:
Copied!
train_indices, test_indices = task.get_train_test_split_indices(fold=0)
print(train_indices[:10]) # print the first 10 indices of the training set
train_indices, test_indices = task.get_train_test_split_indices(fold=0)
print(train_indices[:10]) # print the first 10 indices of the training set