You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use a FunctionTransformer in my ColumnTransformer and try to use the columntransformer.get_feature_names_out() function I get an error. Fitting/Predicting works fine as long as I dont touch this function.
Error message:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [7], in <cell line: 3>()
1 xt = preprocessor.transform(X_test)
2#mapie.single_estimator_[1].estimator
----> 3 preprocessor.get_feature_names_out()
File ~\miniconda3\envs\Master_ML\lib\site-packages\sklearn\compose\_column_transformer.py:481, in ColumnTransformer.get_feature_names_out(self, input_features)
479 transformer_with_feature_names_out = []
480for name, trans, column, _ inself._iter(fitted=True):
--> 481 feature_names_out = self._get_feature_name_out_for_transformer(
482 name, trans, column, input_features
483 )
484if feature_names_out isNone:
485continue
File ~\miniconda3\envs\Master_ML\lib\site-packages\sklearn\compose\_column_transformer.py:446, in ColumnTransformer._get_feature_name_out_for_transformer(self, name, trans, column, feature_names_in)
444# An actual transformer445ifnothasattr(trans, "get_feature_names_out"):
--> 446 raise AttributeError(
447f"Transformer {name} (type {type(trans).__name__}) does "448"not provide get_feature_names_out."449 )
450ifisinstance(column, Iterable) andnotall(
451isinstance(col, str) for col in column
452 ):
453 column = _safe_indexing(feature_names_in, column)
AttributeError: Transformer log (type FunctionTransformer) does not provide get_feature_names_out.
Thanks for the advice, I was a bit unsure, but there already seemed to be some get_feature_names_out functions in the transformers I used, so I thought this was implemented when the merge in november happened (referring to #21308 )
Describe the bug
When I use a FunctionTransformer in my ColumnTransformer and try to use the columntransformer.get_feature_names_out() function I get an error. Fitting/Predicting works fine as long as I dont touch this function.
Error message:
Steps/Code to Reproduce
Fit on some estimator. Then print function:
Gets the error as described above
Expected Results
Expected results are column names of cause.
Actual Results
Versions
The text was updated successfully, but these errors were encountered: