Skip to content

Commit 6e8a9db

Browse files
Neeratyoymfeurer
andauthored
Adding warnings to all examples switching to a test server (#1061)
* Adding warnings to all examples switching to a test server * Creating warnings in new text cells * Fixing a bug * Debugging doc build failures * Update openml/config.py Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de> * Fixing GUI commit bug * Using a common warning message for docs * Renaming warning message file * Editing the non-edited file Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
1 parent 62014cd commit 6e8a9db

13 files changed

+63
-54
lines changed

doc/test_server_usage_warning.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This example uploads data. For that reason, this example connects to the test server at test.openml.org.
2+
This prevents the main server from crowding with example datasets, tasks, runs, and so on.
3+
The use of this test server can affect behaviour and performance of the OpenML-Python API.

examples/20_basic/introduction_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@
5353
#
5454
# Alternatively, by running the code below and replacing 'YOURKEY' with your API key,
5555
# you authenticate for the duration of the python process.
56-
#
57-
# .. warning:: This example uploads data. For that reason, this example
58-
# connects to the test server instead. This prevents the live server from
59-
# crowding with example datasets, tasks, studies, and so on.
56+
6057

6158
############################################################################
6259

@@ -65,6 +62,9 @@
6562
import openml
6663
from sklearn import neighbors
6764

65+
############################################################################
66+
# .. warning::
67+
# .. include:: ../../test_server_usage_warning.txt
6868
openml.config.start_using_configuration_for_example()
6969

7070
############################################################################

examples/20_basic/simple_flows_and_runs_tutorial.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
import openml
1111
from sklearn import ensemble, neighbors
1212

13+
14+
############################################################################
15+
# .. warning::
16+
# .. include:: ../../test_server_usage_warning.txt
17+
openml.config.start_using_configuration_for_example()
18+
1319
############################################################################
1420
# Train a machine learning model
1521
# ==============================
16-
#
17-
# .. warning:: This example uploads data. For that reason, this example
18-
# connects to the test server at test.openml.org. This prevents the main
19-
# server from crowding with example datasets, tasks, runs, and so on.
20-
21-
openml.config.start_using_configuration_for_example()
2222

2323
# NOTE: We are using dataset 20 from the test server: https://test.openml.org/d/20
2424
dataset = openml.datasets.get_dataset(20)

examples/30_extended/create_upload_tutorial.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
from openml.datasets.functions import create_dataset
1717

1818
############################################################################
19-
# .. warning:: This example uploads data. For that reason, this example
20-
# connects to the test server at test.openml.org. This prevents the main
21-
# server from crowding with example datasets, tasks, runs, and so on.
19+
# .. warning::
20+
# .. include:: ../../test_server_usage_warning.txt
2221

2322
openml.config.start_using_configuration_for_example()
2423
############################################################################

examples/30_extended/custom_flow_.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@
1313
and also show how to link runs to the custom flow.
1414
"""
1515

16-
####################################################################################################
17-
1816
# License: BSD 3-Clause
19-
# .. warning:: This example uploads data. For that reason, this example
20-
# connects to the test server at test.openml.org. This prevents the main
21-
# server from crowding with example datasets, tasks, runs, and so on.
17+
2218
from collections import OrderedDict
2319
import numpy as np
2420

2521
import openml
2622
from openml import OpenMLClassificationTask
2723
from openml.runs.functions import format_prediction
2824

25+
####################################################################################################
26+
# .. warning::
27+
# .. include:: ../../test_server_usage_warning.txt
2928
openml.config.start_using_configuration_for_example()
3029

3130
####################################################################################################

examples/30_extended/datasets_tutorial.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@
114114
# Edit a created dataset
115115
# ======================
116116
# This example uses the test server, to avoid editing a dataset on the main server.
117+
#
118+
# .. warning::
119+
# .. include:: ../../test_server_usage_warning.txt
117120
openml.config.start_using_configuration_for_example()
118121
############################################################################
119122
# Edit non-critical fields, allowed for all authorized users:

examples/30_extended/flow_id_tutorial.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
import openml
1717

1818

19-
# Activating test server
19+
############################################################################
20+
# .. warning::
21+
# .. include:: ../../test_server_usage_warning.txt
2022
openml.config.start_using_configuration_for_example()
2123

2224

25+
############################################################################
26+
# Defining a classifier
2327
clf = sklearn.tree.DecisionTreeClassifier()
2428

2529
####################################################################################################

examples/30_extended/flows_and_runs_tutorial.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
import openml
1111
from sklearn import compose, ensemble, impute, neighbors, preprocessing, pipeline, tree
1212

13+
14+
############################################################################
15+
# We'll use the test server for the rest of this tutorial.
16+
#
17+
# .. warning::
18+
# .. include:: ../../test_server_usage_warning.txt
19+
openml.config.start_using_configuration_for_example()
20+
1321
############################################################################
1422
# Train machine learning models
1523
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1624
#
1725
# Train a scikit-learn model on the data manually.
18-
#
19-
# .. warning:: This example uploads data. For that reason, this example
20-
# connects to the test server at test.openml.org. This prevents the main
21-
# server from crowding with example datasets, tasks, runs, and so on.
2226

23-
openml.config.start_using_configuration_for_example()
2427
# NOTE: We are using dataset 68 from the test server: https://test.openml.org/d/68
2528
dataset = openml.datasets.get_dataset(68)
2629
X, y, categorical_indicator, attribute_names = dataset.get_data(

examples/30_extended/run_setup_tutorial.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
2) Download the flow, reinstantiate the model with same hyperparameters,
2525
and solve the same task again;
2626
3) We will verify that the obtained results are exactly the same.
27-
28-
.. warning:: This example uploads data. For that reason, this example
29-
connects to the test server at test.openml.org. This prevents the main
30-
server from crowding with example datasets, tasks, runs, and so on.
3127
"""
3228

3329
# License: BSD 3-Clause
@@ -43,7 +39,9 @@
4339
from sklearn.ensemble import RandomForestClassifier
4440
from sklearn.decomposition import TruncatedSVD
4541

46-
42+
############################################################################
43+
# .. warning::
44+
# .. include:: ../../test_server_usage_warning.txt
4745
openml.config.start_using_configuration_for_example()
4846

4947
###############################################################################

examples/30_extended/study_tutorial.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
=================
33
Benchmark studies
44
=================
5-
65
How to list, download and upload benchmark studies.
7-
86
In contrast to `benchmark suites <https://docs.openml.org/benchmark/#benchmarking-suites>`_ which
97
hold a list of tasks, studies hold a list of runs. As runs contain all information on flows and
108
tasks, all required information about a study can be retrieved.
@@ -20,15 +18,6 @@
2018
import openml
2119

2220

23-
############################################################################
24-
# .. warning:: This example uploads data. For that reason, this example
25-
# connects to the test server at test.openml.org before doing so.
26-
# This prevents the crowding of the main server with example datasets,
27-
# tasks, runs, and so on.
28-
#
29-
############################################################################
30-
31-
3221
############################################################################
3322
# Listing studies
3423
# ***************
@@ -66,14 +55,20 @@
6655
)
6756
print(evaluations.head())
6857

58+
############################################################################
59+
# We'll use the test server for the rest of this tutorial.
60+
#
61+
# .. warning::
62+
# .. include:: ../../test_server_usage_warning.txt
63+
openml.config.start_using_configuration_for_example()
64+
6965
############################################################################
7066
# Uploading studies
7167
# =================
7268
#
7369
# Creating a study is as simple as creating any kind of other OpenML entity.
7470
# In this examples we'll create a few runs for the OpenML-100 benchmark
7571
# suite which is available on the OpenML test server.
76-
openml.config.start_using_configuration_for_example()
7772

7873
# Model to be used
7974
clf = RandomForestClassifier()

0 commit comments

Comments
 (0)