Basic tutorial
from IPython.display import display, HTML, Markdown
import os
import yaml
with open("../../../mkdocs.yml", "r") as f:
load_config = yaml.safe_load(f)
repo_url = load_config["repo_url"].replace("https://github.com/", "")
binder_url = load_config["binder_url"]
relative_file_path = "integrations/Scikit-learn/basic_tutorial.ipynb"
display(HTML(f"""<a href="https://colab.research.google.com/github/{repo_url}/{relative_file_path}" target="_blank">
<img alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"/>
</a>"""))
display(Markdown("[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/SubhadityaMukherjee/openml_docs/HEAD?labpath=Scikit-learn%2Fdatasets_tutorial)"))
!pip install openml
import openml
from sklearn import impute, tree, pipeline
openml.config.start_using_configuration_for_example()
# Define a scikit-learn classifier or pipeline
clf = pipeline.Pipeline(
steps=[
('imputer', impute.SimpleImputer()),
('estimator', tree.DecisionTreeClassifier())
]
)
# Download the OpenML task for the pendigits dataset with 10-fold
# cross-validation.
task = openml.tasks.get_task(32)
task
# 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.
# You can get your own API key by signing up to OpenML.org)
run.publish()
print(f'View the run online: {run.openml_url}')