Getting feature names from within a FeatureUnion + Pipeline

前端 未结 2 878
抹茶落季
抹茶落季 2020-12-30 02:02

I am using a FeatureUnion to join features found from the title and description of events:

union = FeatureUnion(
    transformer_list=[
    # Pipeline for pu         


        
2条回答
  •  粉色の甜心
    2020-12-30 02:37

    You can call your different Vectorizers as a nested feature by this (thanks edesz):

    pipevect= dict(pipeline.named_steps['union'].transformer_list).get('title').named_steps['count']
    

    And then you got the TfidfVectorizer() instance to pass in another function:

    Show_most_informative_features(pipevect,
           pipeline.named_steps['classifier'], n=MostIF)
    # or direct   
    print(pipevect.get_feature_names())
    

提交回复
热议问题