Skip to content

Commit 07f669e

Browse files
author
Github Actions
committed
Eddie Bergman: Update example to use predefined_split properly (#1340)
1 parent 1551e15 commit 07f669e

File tree

71 files changed

+1237
-845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1237
-845
lines changed

development/_downloads/bb7d59d9ddc2ff29f0d6eb99747a3347/example_resampling.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
},
142142
"outputs": [],
143143
"source": [
144-
"resampling_strategy = sklearn.model_selection.PredefinedSplit(\n test_fold=np.where(X_train[:, 0] < np.mean(X_train[:, 0]))[0]\n)\n\nautoml = autosklearn.classification.AutoSklearnClassifier(\n time_left_for_this_task=120,\n per_run_time_limit=30,\n tmp_folder='/tmp/autosklearn_resampling_example_tmp',\n disable_evaluator_output=False,\n resampling_strategy=resampling_strategy,\n)\nautoml.fit(X_train, y_train, dataset_name='breast_cancer')"
144+
"selected_indices = (X_train[:, 0] < np.mean(X_train[:, 0])).astype(int)\nresampling_strategy = sklearn.model_selection.PredefinedSplit(\n test_fold=selected_indices\n)\n\nautoml = autosklearn.classification.AutoSklearnClassifier(\n time_left_for_this_task=120,\n per_run_time_limit=30,\n tmp_folder='/tmp/autosklearn_resampling_example_tmp',\n disable_evaluator_output=False,\n resampling_strategy=resampling_strategy,\n)\nautoml.fit(X_train, y_train, dataset_name='breast_cancer')\n\nprint(automl.sprint_statistics())"
145145
]
146146
},
147147
{
Binary file not shown.

development/_downloads/c6beb850ad22be83885d2737cca63b33/example_resampling.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@
9898
# data by the first feature. In practice, one would use a splitting according
9999
# to the use case at hand.
100100

101+
selected_indices = (X_train[:, 0] < np.mean(X_train[:, 0])).astype(int)
101102
resampling_strategy = sklearn.model_selection.PredefinedSplit(
102-
test_fold=np.where(X_train[:, 0] < np.mean(X_train[:, 0]))[0]
103+
test_fold=selected_indices
103104
)
104105

105106
automl = autosklearn.classification.AutoSklearnClassifier(
@@ -111,6 +112,8 @@
111112
)
112113
automl.fit(X_train, y_train, dataset_name='breast_cancer')
113114

115+
print(automl.sprint_statistics())
116+
114117
############################################################################
115118
# For custom resampling strategies (i.e. resampling strategies that are not
116119
# defined as strings by Auto-sklearn) it is necessary to perform a refit:
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Loading

development/_sources/examples/20_basic/example_classification.rst.txt

Lines changed: 111 additions & 39 deletions
Large diffs are not rendered by default.

development/_sources/examples/20_basic/example_multilabel_classification.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ View the models found by auto-sklearn
154154
155155
rank ensemble_weight type cost duration
156156
model_id
157-
2 1 1.0 random_forest 0.447294 4.619741
157+
2 1 1.0 random_forest 0.447294 3.722532
158158
159159
160160
@@ -262,7 +262,7 @@ Get the Score of the final ensemble
262262
263263
.. rst-class:: sphx-glr-timing
264264

265-
**Total running time of the script:** ( 0 minutes 16.665 seconds)
265+
**Total running time of the script:** ( 0 minutes 17.564 seconds)
266266

267267

268268
.. _sphx_glr_download_examples_20_basic_example_multilabel_classification.py:

development/_sources/examples/20_basic/example_multioutput_regression.rst.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ View the models found by auto-sklearn
124124
125125
rank ensemble_weight type cost duration
126126
model_id
127-
11 1 1.0 gaussian_process 1.845174e-09 6.166486
127+
20 1 1.0 gaussian_process 2.198749e-08 4.786565
128128
129129
130130
@@ -151,7 +151,7 @@ Print the final ensemble constructed by auto-sklearn
151151

152152
.. code-block:: none
153153
154-
[(1.000000, SimpleRegressionPipeline({'data_preprocessor:__choice__': 'feature_type', 'feature_preprocessor:__choice__': 'no_preprocessing', 'regressor:__choice__': 'gaussian_process', 'data_preprocessor:feature_type:categorical_transformer:categorical_encoding:__choice__': 'one_hot_encoding', 'data_preprocessor:feature_type:categorical_transformer:category_coalescence:__choice__': 'minority_coalescer', 'data_preprocessor:feature_type:numerical_transformer:imputation:strategy': 'most_frequent', 'data_preprocessor:feature_type:numerical_transformer:rescaling:__choice__': 'robust_scaler', 'regressor:gaussian_process:alpha': 1.6650724498551164e-11, 'regressor:gaussian_process:thetaL': 5.222627524598125e-10, 'regressor:gaussian_process:thetaU': 5801.524168449955, 'data_preprocessor:feature_type:categorical_transformer:category_coalescence:minority_coalescer:minimum_fraction': 0.0809214996879808, 'data_preprocessor:feature_type:numerical_transformer:rescaling:robust_scaler:q_max': 0.9020530113478731, 'data_preprocessor:feature_type:numerical_transformer:rescaling:robust_scaler:q_min': 0.10288728233229412},
154+
[(1.000000, SimpleRegressionPipeline({'data_preprocessor:__choice__': 'feature_type', 'feature_preprocessor:__choice__': 'extra_trees_preproc_for_regression', 'regressor:__choice__': 'gaussian_process', 'data_preprocessor:feature_type:categorical_transformer:categorical_encoding:__choice__': 'encoding', 'data_preprocessor:feature_type:categorical_transformer:category_coalescence:__choice__': 'minority_coalescer', 'data_preprocessor:feature_type:numerical_transformer:imputation:strategy': 'mean', 'data_preprocessor:feature_type:numerical_transformer:rescaling:__choice__': 'standardize', 'feature_preprocessor:extra_trees_preproc_for_regression:bootstrap': 'True', 'feature_preprocessor:extra_trees_preproc_for_regression:criterion': 'mae', 'feature_preprocessor:extra_trees_preproc_for_regression:max_depth': 'None', 'feature_preprocessor:extra_trees_preproc_for_regression:max_features': 0.5166678376035129, 'feature_preprocessor:extra_trees_preproc_for_regression:max_leaf_nodes': 'None', 'feature_preprocessor:extra_trees_preproc_for_regression:min_samples_leaf': 1, 'feature_preprocessor:extra_trees_preproc_for_regression:min_samples_split': 9, 'feature_preprocessor:extra_trees_preproc_for_regression:min_weight_fraction_leaf': 0.0, 'feature_preprocessor:extra_trees_preproc_for_regression:n_estimators': 100, 'regressor:gaussian_process:alpha': 4.2478708206859043e-10, 'regressor:gaussian_process:thetaL': 1.158691069519535e-05, 'regressor:gaussian_process:thetaU': 1167.1248238015862, 'data_preprocessor:feature_type:categorical_transformer:category_coalescence:minority_coalescer:minimum_fraction': 0.01017601832778754},
155155
dataset_properties={
156156
'task': 5,
157157
'sparse': False,
@@ -186,7 +186,7 @@ Get the Score of the final ensemble
186186

187187
.. code-block:: none
188188
189-
R2 score: 0.9999999995848977
189+
R2 score: 0.9999999937620259
190190
191191
192192
@@ -409,7 +409,7 @@ Get the configuration space
409409
410410
.. rst-class:: sphx-glr-timing
411411

412-
**Total running time of the script:** ( 1 minutes 55.688 seconds)
412+
**Total running time of the script:** ( 2 minutes 1.233 seconds)
413413

414414

415415
.. _sphx_glr_download_examples_20_basic_example_multioutput_regression.py:

development/_sources/examples/20_basic/example_regression.rst.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ View the models found by auto-sklearn
121121
122122
rank ensemble_weight type cost duration
123123
model_id
124-
25 1 0.46 sgd 0.436679 0.830493
125-
6 2 0.32 ard_regression 0.455042 0.827029
126-
27 3 0.14 ard_regression 0.462249 0.856700
127-
11 4 0.02 random_forest 0.507400 12.339479
128-
7 5 0.06 gradient_boosting 0.518673 1.640017
124+
25 1 0.46 sgd 0.436679 0.732215
125+
6 2 0.32 ard_regression 0.455042 0.723179
126+
27 3 0.14 ard_regression 0.462249 0.728957
127+
11 4 0.02 random_forest 0.507400 10.798643
128+
7 5 0.06 gradient_boosting 0.518673 1.353502
129129
130130
131131
@@ -267,7 +267,7 @@ the true value).
267267

268268
.. rst-class:: sphx-glr-timing
269269

270-
**Total running time of the script:** ( 1 minutes 56.297 seconds)
270+
**Total running time of the script:** ( 2 minutes 0.468 seconds)
271271

272272

273273
.. _sphx_glr_download_examples_20_basic_example_regression.py:

development/_sources/examples/20_basic/sg_execution_times.rst.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
Computation times
77
=================
8-
**06:11.822** total execution time for **examples_20_basic** files:
8+
**06:21.704** total execution time for **examples_20_basic** files:
99

1010
+-------------------------------------------------------------------------------------------------------------------+-----------+--------+
11-
| :ref:`sphx_glr_examples_20_basic_example_classification.py` (``example_classification.py``) | 02:03.173 | 0.0 MB |
11+
| :ref:`sphx_glr_examples_20_basic_example_classification.py` (``example_classification.py``) | 02:02.438 | 0.0 MB |
1212
+-------------------------------------------------------------------------------------------------------------------+-----------+--------+
13-
| :ref:`sphx_glr_examples_20_basic_example_regression.py` (``example_regression.py``) | 01:56.297 | 0.0 MB |
13+
| :ref:`sphx_glr_examples_20_basic_example_multioutput_regression.py` (``example_multioutput_regression.py``) | 02:01.233 | 0.0 MB |
1414
+-------------------------------------------------------------------------------------------------------------------+-----------+--------+
15-
| :ref:`sphx_glr_examples_20_basic_example_multioutput_regression.py` (``example_multioutput_regression.py``) | 01:55.688 | 0.0 MB |
15+
| :ref:`sphx_glr_examples_20_basic_example_regression.py` (``example_regression.py``) | 02:00.468 | 0.0 MB |
1616
+-------------------------------------------------------------------------------------------------------------------+-----------+--------+
17-
| :ref:`sphx_glr_examples_20_basic_example_multilabel_classification.py` (``example_multilabel_classification.py``) | 00:16.665 | 0.0 MB |
17+
| :ref:`sphx_glr_examples_20_basic_example_multilabel_classification.py` (``example_multilabel_classification.py``) | 00:17.564 | 0.0 MB |
1818
+-------------------------------------------------------------------------------------------------------------------+-----------+--------+

development/_sources/examples/40_advanced/example_calc_multiple_metrics.rst.txt

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -154,46 +154,49 @@ Get the Score of the final ensemble
154154
################################################################################
155155
Metric results
156156
rank_test_scores param_classifier:__choice__ mean_test_score metric_balanced_accuracy metric_precision metric_recall metric_f1 metric_custom_error
157-
5 random_forest 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
158-
5 mlp 0.971631 0.961538 0.956989 1.000000 0.978022 0.028369
159-
27 mlp 0.943262 0.935069 0.945055 0.966292 0.955556 0.056738
160-
15 random_forest 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
161-
5 mlp 0.971631 0.961538 0.956989 1.000000 0.978022 0.028369
157+
4 random_forest 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
158+
4 mlp 0.971631 0.961538 0.956989 1.000000 0.978022 0.028369
159+
29 mlp 0.943262 0.935069 0.945055 0.966292 0.955556 0.056738
160+
18 random_forest 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
161+
4 mlp 0.971631 0.961538 0.956989 1.000000 0.978022 0.028369
162162
1 extra_trees 0.985816 0.984767 0.988764 0.988764 0.988764 0.014184
163-
15 random_forest 0.964539 0.963915 0.977273 0.966292 0.971751 0.035461
164-
20 extra_trees 0.957447 0.954300 0.966292 0.966292 0.966292 0.042553
165-
5 random_forest 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
166-
5 random_forest 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
167-
15 gradient_boosting 0.964539 0.963915 0.977273 0.966292 0.971751 0.035461
168-
5 gradient_boosting 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
169-
5 mlp 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
170-
24 mlp 0.950355 0.948682 0.965909 0.955056 0.960452 0.049645
163+
18 random_forest 0.964539 0.963915 0.977273 0.966292 0.971751 0.035461
164+
24 extra_trees 0.957447 0.954300 0.966292 0.966292 0.966292 0.042553
165+
4 random_forest 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
166+
4 random_forest 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
167+
18 gradient_boosting 0.964539 0.963915 0.977273 0.966292 0.971751 0.035461
168+
4 gradient_boosting 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
169+
4 mlp 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
170+
26 mlp 0.950355 0.948682 0.965909 0.955056 0.960452 0.049645
171171
2 gradient_boosting 0.978723 0.975151 0.977778 0.988764 0.983240 0.021277
172-
15 gradient_boosting 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
173-
15 random_forest 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
174-
5 extra_trees 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
175-
32 passive_aggressive 0.921986 0.894231 0.890000 1.000000 0.941799 0.078014
172+
18 gradient_boosting 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
173+
18 random_forest 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
174+
4 extra_trees 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
175+
34 passive_aggressive 0.921986 0.894231 0.890000 1.000000 0.941799 0.078014
176176
2 extra_trees 0.978723 0.975151 0.977778 0.988764 0.983240 0.021277
177-
5 gradient_boosting 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
178-
24 mlp 0.950355 0.940687 0.945652 0.977528 0.961326 0.049645
179-
30 random_forest 0.929078 0.923833 0.943820 0.943820 0.943820 0.070922
180-
20 adaboost 0.957447 0.950303 0.956044 0.977528 0.966667 0.042553
181-
5 extra_trees 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
182-
20 extra_trees 0.957447 0.954300 0.966292 0.966292 0.966292 0.042553
183-
30 bernoulli_nb 0.929078 0.923833 0.943820 0.943820 0.943820 0.070922
184-
2 extra_trees 0.978723 0.979149 0.988636 0.977528 0.983051 0.021277
185-
20 liblinear_svc 0.957447 0.954300 0.966292 0.966292 0.966292 0.042553
186-
27 gaussian_nb 0.943262 0.935069 0.945055 0.966292 0.955556 0.056738
187-
24 extra_trees 0.950355 0.936690 0.936170 0.988764 0.961749 0.049645
188-
27 random_forest 0.943262 0.943064 0.965517 0.943820 0.954545 0.056738
177+
4 gradient_boosting 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
178+
26 mlp 0.950355 0.940687 0.945652 0.977528 0.961326 0.049645
179+
33 random_forest 0.929078 0.923833 0.943820 0.943820 0.943820 0.070922
180+
24 adaboost 0.957447 0.950303 0.956044 0.977528 0.966667 0.042553
181+
4 extra_trees 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
182+
4 extra_trees 0.971631 0.969533 0.977528 0.977528 0.977528 0.028369
183+
31 lda 0.936170 0.925454 0.934783 0.966292 0.950276 0.063830
184+
4 extra_trees 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
185+
4 lda 0.971631 0.961538 0.956989 1.000000 0.978022 0.028369
186+
18 liblinear_svc 0.964539 0.959918 0.966667 0.977528 0.972067 0.035461
187+
4 liblinear_svc 0.971631 0.965536 0.967033 0.988764 0.977778 0.028369
188+
29 adaboost 0.943262 0.943064 0.965517 0.943820 0.954545 0.056738
189+
31 random_forest 0.936170 0.937446 0.965116 0.932584 0.948571 0.063830
190+
26 adaboost 0.950355 0.952679 0.976744 0.943820 0.960000 0.049645
191+
35 extra_trees 0.631206 0.500000 0.631206 1.000000 0.773913 0.368794
189192
190193
191194
192195
193196
194197
.. rst-class:: sphx-glr-timing
195198

196-
**Total running time of the script:** ( 2 minutes 1.880 seconds)
199+
**Total running time of the script:** ( 2 minutes 3.281 seconds)
197200

198201

199202
.. _sphx_glr_download_examples_40_advanced_example_calc_multiple_metrics.py:

0 commit comments

Comments
 (0)