Last active
April 26, 2020 13:30
-
-
Save ra312/0a2fcf674662f44502592de938b57cbe to your computer and use it in GitHub Desktop.
hyperopt:generate mixed samples
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 | |
from hyperopt.pyll.stochastic import sample | |
space = hp.choice('label', [ | |
hp.uniform('sub_label_1', 0.3, 0.8), | |
hp.normal('sub_label_2', 0.5, 1.0), None, 0, 1, "anything" | |
]) | |
space = { | |
# None by default | |
'max_depth': hp.choice('max_depth', [None, np.arange(1, 300, 1,dtype=int)]), | |
# 2 by default | |
'min_samples_split' : hp.choice('min_samples_split', np.arange(2, 40,1, dtype=int)), | |
# 1 by default | |
'min_samples_leaf' : hp.choice('min_samples_leaf', np.arange(1, 40,1, dtype=int)), | |
# auto by default | |
'max_features' : hp.choice('max_features', ['auto',np.arange(1, 7, dtype=int)]), | |
# None by deault | |
'max_samples': hp.choice('max_samples', [None, hp.uniform('max_samples', 0.006, 0.74)]) | |
} | |
for _ in range(50): | |
print(sample(space)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment