Skip to content

Commit 2a74c9a

Browse files
finalize basic examples
1 parent 5197ddc commit 2a74c9a

7 files changed

Lines changed: 24 additions & 31 deletions

examples/Basics/introduction_tutorial.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# %% [markdown]
2-
# # Introduction Tutorial & Setup
32
# An example how to set up OpenML-Python followed up by a simple example.
43

54
# %% [markdown]
6-
# # Installation
5+
# ## Installation
76
# Installation is done via ``pip``:
87
#
98
# ```bash
109
# pip install openml
1110
# ```
1211

1312
# %% [markdown]
14-
# # Authentication
13+
# ## Authentication
1514
#
1615
# For certain functionality, such as uploading tasks or datasets, users have to
1716
# sing up. Only accessing the data on OpenML does not require an account!
@@ -42,7 +41,7 @@
4241
openml.config.apikey = "YOURKEY"
4342

4443
# %% [markdown]
45-
# # Caching
44+
# ## Caching
4645
# When downloading datasets, tasks, runs and flows, they will be cached to
4746
# retrieve them without calling the server later. As with the API key,
4847
# the cache directory can be either specified through the config file or

examples/Basics/simple_datasets_tutorial.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# %% [markdown]
2-
# # Datasets
32
# A basic tutorial on how to list, load and visualize datasets.
43
#
54
# In general, we recommend working with tasks, so that the results can
@@ -34,14 +33,11 @@
3433

3534
# %% [markdown]
3635
# ## Load a dataset
37-
# X - A dataframe where each row represents one example with
38-
# the corresponding feature values.
39-
#
40-
# y - the classes for each example
41-
#
42-
# categorical_indicator - a list that indicates which feature is categorical
43-
#
44-
# attribute_names - the names of the features for the examples (X) and
36+
# * `X` - A dataframe where each row represents one example with
37+
# the corresponding feature values.
38+
# * `y` - the classes for each example
39+
# * `categorical_indicator` - a list that indicates which feature is categorical
40+
# * `attribute_names` - the names of the features for the examples (X) and
4541
# target feature (y)
4642

4743
# %%

examples/Basics/simple_flows_and_runs_tutorial.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# %% [markdown]
2-
# # Flows and Runs
32
# A simple tutorial on how to upload results from a machine learning experiment to OpenML.
43

54
# %%
@@ -79,7 +78,7 @@
7978
print(f"knn_flow was published with the ID {knn_flow.flow_id}")
8079

8180
# %% [markdown]
82-
# Second, we create a run to store the results of associated with the flow.
81+
# Second, we create a run to store the results associated with the flow.
8382

8483
# %%
8584

examples/Basics/simple_suites_tutorial.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# %% [markdown]
2-
# # Benchmark suites
32
# This is a brief showcase of OpenML benchmark suites, which were introduced by
43
# [Bischl et al. (2019)](https://arxiv.org/abs/1708.03731v2). Benchmark suites standardize the
54
# datasets and splits to be used in an experiment or paper. They are fully integrated into OpenML
@@ -9,8 +8,7 @@
98
import openml
109

1110
# %% [markdown]
12-
# OpenML-CC18
13-
# ===========
11+
# ## OpenML-CC18
1412
#
1513
# As an example we have a look at the OpenML-CC18, which is a suite of 72 classification datasets
1614
# from OpenML which were carefully selected to be usable by many algorithms. These are all datasets
@@ -30,8 +28,7 @@
3028
# In this example, we'll focus on how to use benchmark suites in practice.
3129

3230
# %% [markdown]
33-
# Downloading benchmark suites
34-
# ============================
31+
# ## Downloading benchmark suites
3532

3633
# %%
3734
suite = openml.study.get_suite(99)
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
# %% [markdown]
2-
# # Tasks
2+
# A brief example on how to use tasks from OpenML.
33

44
# %%
55

66
import openml
77

88
# %% [markdown]
9-
# # Get a [task](https://docs.openml.org/concepts/tasks/) for
9+
# Get a [task](https://docs.openml.org/concepts/tasks/) for
1010
# [supervised classification on credit-g](https://www.openml.org/search?type=task&id=31&source_data.data_id=31):
1111

12+
# %%
1213
task = openml.tasks.get_task(31)
1314

1415
# %% [markdown]
1516
# Get the dataset and its data from the task.
17+
18+
# %%
1619
dataset = task.get_dataset()
1720
X, y, categorical_indicator, attribute_names = dataset.get_data(target=task.target_name)
1821

1922
# %% [markdown]
2023
# Get the first out of the 10 cross-validation splits from the task.
24+
25+
# %%
2126
train_indices, test_indices = task.get_train_test_split_indices(fold=0)
2227
print(train_indices[:10]) # print the first 10 indices of the training set

examples/introduction.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# %% [markdown]
22
#
3-
# # OpenML-Python Examples
4-
#
53
# We provide a set of examples here to get started with OpenML-Python. These examples cover various aspects of using the
64
# OpenML API, including downloading datasets, uploading results, and working with tasks.
75
#
86
# ## Basics
97
#
10-
# 1. [Installing and setting up OpenML-Python](../Basics/introduction_tutorial.py)
11-
# 2. [Downloading datasets](../Basics/simple_dataset_tutorial.py)
12-
# 3. [Using tasks](../Basics/simple_tasks_tutorial.py)
13-
# 3. [Uploading experiment results](./.Basics/simple_flows_and_runs_tutorial.py)
14-
# 4. [Working with collections of tasks](../Basics/simple_suites_tutorial.py)
8+
# 1. [Installing and setting up OpenML-Python](../Basics/introduction_tutorial/)
9+
# 2. [Downloading datasets](../Basics/simple_datasets_tutorial/)
10+
# 3. [Using tasks](../Basics/simple_tasks_tutorial/)
11+
# 3. [Uploading experiment results](../Basics/simple_flows_and_runs_tutorial/)
12+
# 4. [Working with collections of tasks](../Basics/simple_suites_tutorial/)
1513
#
1614
# ## Advanced
1715
# 1 .

mkdocs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ nav:
5050
- Tasks: examples/Basics/simple_tasks_tutorial.py
5151
- Flows and Runs: examples/Basics/simple_flows_and_runs_tutorial.py
5252
- Suites: examples/Basics/simple_suites_tutorial.py
53-
- Extended: examples/30_extended/
54-
- Paper: examples/40_paper/
53+
- Advanced: examples/Advanced/
5554
- Extensions: extensions.md
5655
- Details: details.md
5756
- API: reference/

0 commit comments

Comments
 (0)