Retrieving Coefficients From Sklearn Stackingclassifier
When attempting to retrieve coefficients from a trained StackingClassifier using SKlearn it says that coefs_ does not exist. This means that it thinks it has not been trained yet.
Solution 1:
After reading further through the source code I found that using clf.estimators
for some reason is wrong and clf.estimators_
has the actual trained estimators... I could still use a reason for this but to extract the coefficients you can use:
pipeline = joblib.load('yourmodel.model')
#Coefs for the first model, iterate over estimators_ for the rest
pipeline['stackingclassifier'].estimators_[0].coef_
Post a Comment for "Retrieving Coefficients From Sklearn Stackingclassifier"