Skip to content

X features in ".predict" #349

Answered by jmoralez
Ehsan86 asked this question in Q&A
Jun 7, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You can add a simple estimator that just prints, e.g.

from sklearn.base import BaseEstimator, TransformerMixin

class PrintEstimator(BaseEstimator, TransformerMixin):
    def fit(self, X, y):
        return self

    def transform(self, X, y=None):
        print('Features going into the model: ', X)
        return X

pipeline = make_pipeline(
    preprocessor,
    PrintEstimator(),
    RandomForestRegressor(n_estimators=100, min_samples_split=10, min_samples_leaf=4)
)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Ehsan86
Comment options

@jmoralez
Comment options

Answer selected by Ehsan86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants