Skip to content

Instantly share code, notes, and snippets.

@micahmelling
Created January 4, 2021 03:35
import ConfigSpace as cs
import ConfigSpace.hyperparameters as csh
from copy import deepcopy
BASE_PARAM_GRID = cs.ConfigurationSpace(seed=42)
BASE_PARAM_GRID.add_hyperparameter(csh.CategoricalHyperparameter(
'preprocessor__numeric_transformer__log_creator__take_log', ['yes', 'no']))
BASE_PARAM_GRID.add_hyperparameter(csh.CategoricalHyperparameter(
'preprocessor__categorical_transformer__category_combiner__combine_categories', ['yes', 'no']))
BASE_PARAM_GRID.add_hyperparameter(csh.UniformIntegerHyperparameter(
'feature_selector__percentile', 1, 100))
FOREST_PARAM_GRID = deepcopy(BASE_PARAM_GRID)
FOREST_PARAM_GRID.add_hyperparameter(csh.UniformIntegerHyperparameter('model__base_estimator__max_depth', 3, 30))
FOREST_PARAM_GRID.add_hyperparameter(csh.UniformFloatHyperparameter('model__base_estimator__min_samples_leaf',
0.0001, 0.01))
FOREST_PARAM_GRID.add_hyperparameter(csh.CategoricalHyperparameter('model__base_estimator__max_features',
['log2', 'sqrt']))
MODEL_TRAINING_DICT = {
'random_forest': [RandomForestClassifier(n_estimators=500), FOREST_PARAM_GRID, 10]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment