skll icon indicating copy to clipboard operation
skll copied to clipboard

Add class method to learner object for retrieving feature names

Open remo-help opened this issue 3 years ago • 0 comments

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()

remo-help avatar Jun 28 '22 15:06 remo-help