Learners with a selector potentially have a smaller feature name size than is stored in the feature_vectorizer. A simple method accessing the actual used feature names for a learner with or without a selector would be useful
def get_feature_names(self):
if self.feat_selector:
return self.feat_vectorizer.get_feature_names_out()[self.feat_selector.get_support()]
else:
return self.feat_vectorizer.get_feature_names_out()
Learners with a selector potentially have a smaller feature name size than is stored in the feature_vectorizer. A simple method accessing the actual used feature names for a learner with or without a selector would be useful