I am using AutoSklearn library
Here is my code
automl = autosklearn.classification.AutoSklearnClassifier(
include={'feature_preprocessor': ["no_preprocessing"],
},
exclude={ 'classifier': ['random_forest']},
time_left_for_this_task=60*3,
per_run_time_limit=60*1,
#memory_limit = 1024 * 10,
n_jobs=-1,
#metric=autosklearn.metrics.f1_macro,
)
automl.fit(X_train, y_train)
automl.show_models()
This function automl.show_models() shows these values
{6: {'model_id': 6, 'rank': 1, 'cost': 0.16666666666666663, 'ensemble_weight': 0.24, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1a5610550>, 'balancing': Balancing(random_state=1), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd100267cd0>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd1002678e0>, 'sklearn_classifier': ExtraTreesClassifier(criterion='entropy', max_features=231, min_samples_split=3, n_estimators=512, n_jobs=1, random_state=1, warm_start=True)},
14: {'model_id': 14, 'rank': 2, 'cost': 0.17803030303030298, 'ensemble_weight': 0.3, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1036b7b20>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0f9c51250>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9c510a0>, 'sklearn_classifier': HistGradientBoostingClassifier(early_stopping=True,
l2_regularization=5.027708640006448e-08,
learning_rate=0.09750328007832798, max_iter=16,
max_leaf_nodes=1234, min_samples_leaf=25,
n_iter_no_change=1, random_state=1,
validation_fraction=0.08300813783286698,
warm_start=True)},
28: {'model_id': 28, 'rank': 3, 'cost': 0.2007575757575758, 'ensemble_weight': 0.02, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd15aaf3220>, 'balancing': Balancing(random_state=1), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0ffc75970>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0ffcafd00>, 'sklearn_classifier': DecisionTreeClassifier(max_depth=7231, min_samples_leaf=19,
min_samples_split=12, random_state=1)},
8: {'model_id': 8, 'rank': 4, 'cost': 0.23484848484848486, 'ensemble_weight': 0.16, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd10032a910>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd161407160>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd161407b80>, 'sklearn_classifier': DecisionTreeClassifier(class_weight='balanced', max_depth=7231,
min_samples_leaf=4, min_samples_split=20,
random_state=1)},
16: {'model_id': 16, 'rank': 5, 'cost': 0.26515151515151514, 'ensemble_weight': 0.06, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1620c8370>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd161f8a6a0>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9b16250>, 'sklearn_classifier': MLPClassifier(alpha=1.1952772240345466e-06, beta_1=0.999, beta_2=0.9,
early_stopping=True, hidden_layer_sizes=(103,),
learning_rate_init=0.04431671753867657, max_iter=32,
n_iter_no_change=32, random_state=1, verbose=0, warm_start=True)},
3: {'model_id': 3, 'rank': 6, 'cost': 0.2765151515151515, 'ensemble_weight': 0.08, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd0f9c51a30>, 'balancing': Balancing(random_state=1), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0f9d146d0>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9d141c0>, 'sklearn_classifier': ExtraTreesClassifier(bootstrap=True, max_features=28, min_samples_leaf=2,
min_samples_split=3, n_estimators=512, n_jobs=1,
random_state=1, warm_start=True)},
17: {'model_id': 17, 'rank': 7, 'cost': 0.2803030303030303, 'ensemble_weight': 0.14, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1001fa5e0>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0f9bf1a00>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9bf12e0>, 'sklearn_classifier': SVC(C=21.59109048521139, cache_size=1805.4296875, class_weight='balanced',
gamma=5.060493057005212, max_iter=-1.0, random_state=1, shrinking=False,
tol=0.00012027336497045934)}}
I found that automl.show_models() is not a dataframe and not sure what structure it is.
I want the values of sklearn_classifier in the rank 1 record which are in this case
ExtraTreesClassifier(criterion='entropy', max_features=231, min_samples_split=3, n_estimators=512, n_jobs=1, random_state=1, warm_start=True)
I can treat these output of automl.show_models() as string and find ExtraTreesClassifier in that string but I don't think this is the best way to do so.
is anyone know a better way to get these values?
Thanks
I found the answer by using values() in dictionary Thanks @Fabio
here is the code that worked for me
list(list(automl.show_models().values())[0].values())[8]