Skip to content

How to see the selected features when ensemble size = 1? #1102

Open
@zgm0407

Description

@zgm0407

Hi,
I applied the codes in #719 and #524. It worked well when the ensemble size was 50. However, there was some thing wrong when the ensemble size was 1.

automl = autosklearn.classification.AutoSklearnClassifier(
    time_left_for_this_task=120,
    include_preprocessors=['select_percentile_classification'],
    include_estimators=['random forest],
    ensemble_size=1,
    resampling_strategy='cv',
    resampling_strategy_arguments={'folds':5},
)

automl.fit(X_train,y_train)

for weight, model in automl.get_models_with_weights():
    print(tuple(model.steps[-2]))
    print(tuple(model.steps[-2])[-1].choice.preprocessor.scores_)
    print(tuple(model.steps[-2])[-1].choice.preprocessor.percentile)


('feature_preprocessor', <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7ff0e3123630>)



AttributeError                            Traceback (most recent call last)
<ipython-input-154-6172a5b19273> in <module>
      5     print(tuple(model.steps[-2]))
      6     # Obtain the scores of the current feature selector
----> 7     print(tuple(model.steps[-2])[-1].choice.preprocessor.scores_)
      8     # Obtain the percentile configured by Auto-sklearn
      9     print(tuple(model.steps[-2])[-1].choice.preprocessor.percentile)

AttributeError: 'SelectPercentileClassification' object has no attribute 'preprocessor'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions