Skip to content

Commit 8ccefc1

Browse files
committed
Update example to use predefined_split properly (#1340)
1 parent e478777 commit 8ccefc1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/40_advanced/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:

0 commit comments

Comments
 (0)