Skip to content

Commit 96e3fce

Browse files
modified some examples to make them work
1 parent a0703cc commit 96e3fce

5 files changed

Lines changed: 9 additions & 5 deletions

File tree

examples/20_basic/simple_flows_and_runs_tutorial.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
# %%
3535
dataset = openml.datasets.get_dataset(20)
3636
X, y, categorical_indicator, attribute_names = dataset.get_data(
37-
target=dataset.default_target_attribute
37+
dataset_format="dataframe", target=dataset.default_target_attribute
3838
)
39+
if y is None:
40+
y = X["class"]
41+
X = X.drop(columns=["class"], axis=1)
3942
clf = neighbors.KNeighborsClassifier(n_neighbors=3)
4043
clf.fit(X, y)
4144

@@ -44,6 +47,7 @@
4447

4548
# %%
4649
task = openml.tasks.get_task(119)
50+
4751
clf = ensemble.RandomForestClassifier()
4852
run = openml.runs.run_model_on_task(clf, task)
4953
print(run)

examples/30_extended/benchmark_with_optunahub.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
# go to your profile and select the API-KEY.
3535
# Or log in, and navigate to https://www.openml.org/auth/api-key
3636
openml.config.apikey = ""
37-
3837
############################################################################
3938
# Prepare for preprocessors and an OpenML task
4039
# ============================================

examples/30_extended/datasets_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
# * List datasets
1414

1515
# %%
16-
datalist = openml.datasets.list_datasets()
16+
datalist = openml.datasets.list_datasets(output_format="dataframe")
1717
datalist = datalist[["did", "name", "NumberOfInstances", "NumberOfFeatures", "NumberOfClasses"]]
1818

1919
print(f"First 10 of {len(datalist)} datasets...")
2020
datalist.head(n=10)
2121

2222
# The same can be done with lesser lines of code
23-
openml_df = openml.datasets.list_datasets()
23+
openml_df = openml.datasets.list_datasets(output_format="dataframe")
2424
openml_df.head(n=10)
2525

2626
# %% [markdown]

examples/30_extended/fetch_evaluations_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Using other evaluation metrics, 'precision' in this case
3535
evals = openml.evaluations.list_evaluations(
36-
function="precision", size=10
36+
function="precision", size=10, output_format="dataframe"
3737
)
3838

3939
# Querying the returned results for precision above 0.98

examples/30_extended/flow_id_tutorial.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# %%
1818
openml.config.start_using_configuration_for_example()
19+
openml.config.server = "https://api.openml.org/api/v1/xml"
1920

2021
# %%
2122
# Defining a classifier

0 commit comments

Comments
 (0)