Great - thanks! Yes, it would be very nice to have feature names automatically propagate throughout sklearn.

Andrew

<~~~~~~~~~~~~~~~~~~~~~~~~~~~>
J. Andrew Howe, PhD
Github Profile
I live to learn, so I can learn to live. - me
<~~~~~~~~~~~~~~~~~~~~~~~~~~~>


On Tue, May 5, 2020 at 1:42 PM Guillaume Lemaître <g.lemaitre58@gmail.com> wrote:
Your analysis is correct: https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/ensemble/_stacking.py#L59

It will be the prediction of each learner in the order in the list given and finally the features which are pass-through.

It would nice when we will be able to propagate feature names :)

On Tue, 5 May 2020 at 14:31, Andrew Howe <ahowe42@gmail.com> wrote:
Hi All - gentle nudge in case anybody has an idea about this.

Andrew

<~~~~~~~~~~~~~~~~~~~~~~~~~~~>
J. Andrew Howe, PhD
Github Profile
I live to learn, so I can learn to live. - me
<~~~~~~~~~~~~~~~~~~~~~~~~~~~>


---------- Forwarded message ---------
From: Andrew Howe <ahowe42@gmail.com>
Date: Thu, Apr 30, 2020 at 6:05 PM
Subject: StackingClassifier
To: Scikit-learn user and developer mailing list <scikit-learn@python.org>


Hi All

Quick question about the stacking classifier. How do I know the order of the features that the final estimator uses? I've got an example which I've created like this (the LGRG and KSVM objects were previously defined, but as they seem they would be):

passThrough = True
finalEstim = DecisionTreeClassifier(random_state=42)
stkClas = StackingClassifier(estimators=[('Logistic Regression', LGRG), ('Kernel SVM', KSVM)],
                             cv=crossValInput, passthrough=passThrough, final_estimator=finalEstim,
                             n_jobs=-1)

Given this setup, I think the features input to the final estimator are
  • Logistic regression prediction probabilities for all classes
  • Kernel SVM prediction probabilities for all classes
  • original features of data passed into the stacking classifier
I can find no documentation on this, though, and don't know of any relevant attribute on the final estimator. I need this to help interpret the final estimator tree - and specifically to provide feature labels for plot_tree.

Thanks!
Andrew

<~~~~~~~~~~~~~~~~~~~~~~~~~~~>
J. Andrew Howe, PhD
Github Profile
I live to learn, so I can learn to live. - me
<~~~~~~~~~~~~~~~~~~~~~~~~~~~>
_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


--
Guillaume Lemaitre
Scikit-learn @ Inria Foundation
https://glemaitre.github.io/
_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn