Home > OS >  AutoSKLearn predict_proba equivalent?
AutoSKLearn predict_proba equivalent?

Time:01-07

Is there an equivalent to SKLearn's predict_proba in AutoSKLearn? I can't seem to find a way to determine the confidence of AutoSKLearns predictions.

CodePudding user response:

A predict_proba method should be implemented for AutoSklearnClassifier

From auto-sklearn documentation:

predict_proba(X, batch_size=None, n_jobs=1)

Predict probabilities of classes for all samples X.

Parameters:

  • Xarray-like or sparse matrix of shape = [n_samples, n_features]
  • ...

Returns:

  • yarray of shape = [n_samples, n_classes] or [n_samples, n_labels]

Which in context looks something like this:

from autosklearn.classification import AutoSklearnClassifier
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split

X, y = make_classification(n_samples=1000)
X_train, X_test, y_train, y_test = train_test_split(X, y)

clf = AutoSklearnClassifier(time_left_for_this_task=30)
clf.fit(X_train, y_train)

predictions = clf.predict_proba(X_test)
print(predictions)
  • Related