auto-sklearn: AttributeError: 'AutoMLClassifier' object has no attribute '_automl' when calling predict_proba on a fit classifier


pipe = autosklearn.classification.AutoSklearnClassifier()
    
pipe.fit(clf_x, labels)
    
probs = pipe.predict_proba(clf_x) # Error happens here
roc_auc = metrics.roc_auc_score(labels, probs[:, 1])
print(roc_auc)
AttributeError                            Traceback (most recent call last)
<ipython-input-257-a782d97ebce8> in <module>()
----> 1 pipe.predict_proba(clf_x[te_idx])

~/repos/vcf/research/env/lib/python3.5/site-packages/autosklearn/estimators.py in predict_proba(self, X, batch_size, n_jobs)
    430         """
    431         return self._automl.predict_proba(
--> 432             X, batch_size=batch_size, n_jobs=n_jobs)
    433 
    434 

~/repos/vcf/research/env/lib/python3.5/site-packages/autosklearn/automl.py in predict_proba(self, X, batch_size, n_jobs)
    944 
    945     def predict_proba(self, X, batch_size=None, n_jobs=1):
--> 946         return self._automl.predict(X, batch_size=batch_size, n_jobs=n_jobs)
    947 
    948 

AttributeError: 'AutoMLClassifier' object has no attribute '_automl'

Hello. Thanks for the great library. I am getting an AttributeError when trying to call predict_proba on a fit classifier. Have you seen this error before?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I’ve changed a string in automl.py and got expected probabilities

    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)