Closed whitewizard333 closed 6 years ago
I think you could change the line clf_sigmoid = CalibratedClassifierCV(tpot, cv=2, method='sigmoid')
to clf_sigmoid = CalibratedClassifierCV(tpot.fitted_pipeline_, cv=2, method='sigmoid')
. The attribute fitted_pipeline_
is scikit-learn Pipeline object which has this classes_
atrribute.
Yes, it's working with tpot.fittedpipeline Thank you 👍
Hi, what about the classes_ attribute for the tpot object? Is there a reason why it is missing? I am likely overlooking something but it would be helpful to have such an attribute. I am working with 13 classes and in the near future they will probably become many more: it would be good to know which element of the prediction array is what class. Is there a trick to otherwise know this?
Thanks in advance
The classes_
attribute is only for TPOTClassifier
class, but both TPOTRegessor
and TPOTClassifier
simply inherit from class TPOTbase
. So we didn't add this attribute to TPOT object but expose fitted_pipeline_
attribute which is a scikit-learn Pipeline and should has the classes_
object for TPOTClassifier
but not for TPOTRegressor
.
AttributeError: 'TPOTClassifier' object has no attribute '_optimized_pipeline'
I am trying to convert TPOT binary classifier result into probability score using CalibratedClassifierCV.
Code is as below
**from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split
from sklearn.calibration import CalibratedClassifierCV
tpot = TPOTClassifier(max_time_mins=6, verbosity=2) tpot.fit(titanic_x, titanic['Survived'])
clf_sigmoid = CalibratedClassifierCV(tpot, cv=2, method='sigmoid') clf_sigmoid.fit(titanic_x, titanic['Survived']) prob_pos_sigmoid = clf_sigmoid.predict_proba(titanic_test_x)[:,1]**
it throws the following error.
AttributeError Traceback (most recent call last)