Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autosklearn/automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ def predict(self, X, batch_size=None, n_jobs=1):
return predicted_classes

def predict_proba(self, X, batch_size=None, n_jobs=1):
return self._automl.predict(X, batch_size=batch_size, n_jobs=n_jobs)
return super().predict(X, batch_size=batch_size, n_jobs=n_jobs)


class AutoMLRegressor(BaseAutoML):
Expand Down
6 changes: 5 additions & 1 deletion autosklearn/estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ def refit(self, X, y):
def predict(self, X, batch_size=None, n_jobs=1):
return self._automl.predict(X, batch_size=batch_size, n_jobs=n_jobs)

def predict_proba(self, X, batch_size=None, n_jobs=1):
return self._automl.predict_proba(
X, batch_size=batch_size, n_jobs=n_jobs)

def score(self, X, y):
return self._automl.score(X, y)

Expand Down Expand Up @@ -428,7 +432,7 @@ def predict_proba(self, X, batch_size=None, n_jobs=1):
The predicted class probabilities.

"""
return self._automl.predict_proba(
return super().predict_proba(
X, batch_size=batch_size, n_jobs=n_jobs)


Expand Down
5 changes: 3 additions & 2 deletions test/test_automl/test_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def test_fit_pSMAC(self):
initial_configurations_via_metalearning=0,
ensemble_size=0)
automl.fit(X_train, Y_train)

# Create a 'dummy model' for the first run, which has an accuracy of
# more than 99%; it should be in the final ensemble if the ensemble
# building of the second AutoSklearn classifier works correct
Expand Down Expand Up @@ -303,6 +302,8 @@ def test_multilabel(self):
self.assertEqual(predictions.shape, (50, 3))
score = f1_macro(Y_test, predictions)
self.assertGreaterEqual(score, 0.9)
probs = automl.predict_proba(X_train)
self.assertAlmostEqual(np.mean(probs), 0.33333333333333331)

def test_binary(self):
output = os.path.join(self.test_dir, '..', '.tmp_binary_fit')
Expand Down Expand Up @@ -376,4 +377,4 @@ def test_conversion_of_list_to_np(self, fit_ensemble, refit, fit):
self.assertIsInstance(refit.call_args[0][1], np.ndarray)
automl.fit_ensemble(y)
self.assertEqual(fit_ensemble.call_count, 1)
self.assertIsInstance(fit_ensemble.call_args[0][0], np.ndarray)
self.assertIsInstance(fit_ensemble.call_args[0][0], np.ndarray)