-
-
Save WanyingF/c473023cc56e9797ee6542bde9780bcf to your computer and use it in GitHub Desktop.
Example of defining search space of hyperparameters of classification models by using HyperOpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hyperopt import hp | |
space = hp.choice('classifier_type', [ | |
{ | |
'type': 'naive_bayes', | |
}, | |
{ | |
'type': 'svm', | |
'C': hp.lognormal('svm_C', 0, 1), | |
'kernel': hp.choice('svm_kernel', [ | |
{'ktype': 'linear'}, | |
{'ktype': 'RBF', 'width': hp.lognormal('svm_rbf_width', 0, 1)}, | |
]), | |
}, | |
{ | |
'type': 'dtree', | |
'criterion': hp.choice('dtree_criterion', ['gini', 'entropy']), | |
'max_depth': hp.choice('dtree_max_depth', | |
[None, hp.qlognormal('dtree_max_depth_int', 3, 1, 1)]), | |
'min_samples_split': hp.qlognormal('dtree_min_samples_split', 2, 1, 1), | |
}, | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment