Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zgm0407 opened this issue Mar 20, 2021 · 4 comments
Open

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

zgm0407 opened this issue Mar 20, 2021 · 4 comments
Labels
documentation Something to be documented question

Comments

@zgm0407
Copy link

zgm0407 commented Mar 20, 2021

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'
@mfeurer
Copy link
Contributor

mfeurer commented Mar 24, 2021

From a brief check the issue is rather the examples don't work with cross-validation. Could you kindly check if the error goes away if you disable cross-validation?

@zgm0407
Copy link
Author

zgm0407 commented Mar 25, 2021

Yeah that can fix the problem. It works out if I choose hold-out strategy.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs for the next 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 15, 2021
@mfeurer mfeurer added documentation Something to be documented and removed Feedback-Required labels May 15, 2021
@eddiebergman
Copy link
Contributor

Update:

We should document that when using CV, the models returned are actually VotingClassifier/Regressor which means that issue #719 #524 don't work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Something to be documented question
Projects
None yet
Development

No branches or pull requests

3 participants