Skip to content
Advertisement

How to specify Search Space in Auto-Sklearn

I know how to specify Feature Selection methods and the list of the Algorithms used in Auto-Sklearn 2.0

mdl = autosklearn.classification.AutoSklearnClassifier(
    include = {
         'classifier': ["random_forest", "gaussian_nb", "libsvm_svc", "adaboost"],
         'feature_preprocessor': ["no_preprocessing"]
    },
    exclude=None)

I know that Auto-Sklearn use Bayesian Optimisation SMAC

but I would like to specify the HyperParameters in AutoSklearn

For example, I want to specify random_forest with Estimator = 1000 only or MLP with HiddenLayerSize = 100 only.

How to do that?

Advertisement

Answer

You need to edit the config as specified in the docs.

In your case it would be something like:

cs = mdl.get_configuration_space(X, y)
config = cs.sample_configuration()
config._values['classifier:random_forest:n_estimators'] = 1000
pipeline, run_info, run_value = mdl.fit_pipeline(X=X_train, y=y_train,
                                                 config=config,
                                                 X_test=X_test, y_test=y_test)
Advertisement