-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle configspace as dictionary in mlp example #1057
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,18 +84,18 @@ def train(self, config: Configuration, seed: int = 0, budget: int = 25) -> float | |
# For deactivated parameters (by virtue of the conditions), | ||
# the configuration stores None-values. | ||
# This is not accepted by the MLP, so we replace them with placeholder values. | ||
lr = config["learning_rate"] if config["learning_rate"] else "constant" | ||
lr_init = config["learning_rate_init"] if config["learning_rate_init"] else 0.001 | ||
batch_size = config["batch_size"] if config["batch_size"] else 200 | ||
lr = config.get("learning_rate") if config.get("learning_rate") else "constant" | ||
lr_init = config.get("learning_rate_init") if config.get("learning_rate_init") else 0.001 | ||
batch_size = config.get("batch_size") if config.get("batch_size") else 200 | ||
|
||
with warnings.catch_warnings(): | ||
warnings.filterwarnings("ignore") | ||
|
||
classifier = MLPClassifier( | ||
hidden_layer_sizes=[config["n_neurons"]] * config["n_layer"], | ||
solver=config["solver"], | ||
hidden_layer_sizes=[config.get("n_neurons")] * config.get("n_layer"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If You use |
||
solver=config.get("solver"), | ||
batch_size=batch_size, | ||
activation=config["activation"], | ||
activation=config.get("activation"), | ||
learning_rate=lr, | ||
learning_rate_init=lr_init, | ||
max_iter=int(np.ceil(budget)), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an FYI, you can do