Skip to content
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

Extend with MLPClassifer #525

Closed
Wilsonlou opened this issue Aug 10, 2018 · 6 comments
Closed

Extend with MLPClassifer #525

Wilsonlou opened this issue Aug 10, 2018 · 6 comments

Comments

@Wilsonlou
Copy link

Dear experts,

I tried to extend MLP from sklearn as a candidate model. However, it seems very hard to set search space for hidden_layer_sizes as a categorical hyper, for example:
hidden_layer_sizes = CategoricalHyperparameter(
"hidden_layer_sizes", [(20,10),(10,10)]
)

I tried OrdinalHyperparameter, but seems auto-sklearn still not supports it.

Appreciate if you can provide any help on it.

Thx

Wilson

@mfeurer
Copy link
Contributor

mfeurer commented Aug 10, 2018

@ahn1340 were you able to progress on the extending Auto-sklearn example?

@Wilsonlou
Copy link
Author

Thx guys, actually the issue here is the hyperparam is a list of tuples, for other params, it's ok to work with.

@Wilsonlou
Copy link
Author

Btw, I tried params like: Shuffle, early_stopping, nesterovs_momentum, these params are true or false. Once I tried to set like:
nesterovs_momentum = CategoricalHyperparameter(
'nesterovs_momentum', [0, 1], default_value=1
)
early_stopping = CategoricalHyperparameter(
'early_stopping', [0,1], default_value=0
)

It will show value error due to value type check in sklearn MLP code:
def _validate_hyperparameters(self):
if not isinstance(self.shuffle, bool):
raise ValueError("shuffle must be either True or False, got %s." %
self.shuffle)
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/neural_network/multilayer_perceptron.py

@mfeurer
Copy link
Contributor

mfeurer commented Aug 13, 2018

these params are true or false

Check the random forest hyperparameter definition and casting to learn how to use boolean hyperparameters: https://github.com/automl/auto-sklearn/blob/master/autosklearn/pipeline/components/classification/random_forest.py

actually the issue here is the hyperparam is a list of tuples

I would suggest you use integers here. One integer for the depth of the network, and one integer for the number of neurons per layer which is only active if the network is deep enough. Please check XGBoost to learn how to use so-called conditional hyperparameters: https://github.com/automl/auto-sklearn/blob/master/autosklearn/pipeline/components/classification/xgradient_boosting.py There's also a greater than condition which you can use for the neural network.

@Wilsonlou
Copy link
Author

Wilsonlou commented Aug 14, 2018

For hyperparam of tuples, have tried your suggestion, it works, thx:)

@mfeurer
Copy link
Contributor

mfeurer commented Nov 12, 2018

@mfeurer mfeurer closed this as completed Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants