automl / auto-sklearn

Automated Machine Learning with scikit-learn
https://automl.github.io/auto-sklearn
BSD 3-Clause "New" or "Revised" License
7.64k stars 1.28k forks source link

Is there any way to tune hyperparameters that are 2D arrays #1678

Open belzheng opened 1 year ago

belzheng commented 1 year ago

Short Question Description

I want to adjust the knots position of Bspline, but it is a two-dimensional array, I don't know how to use auto-sklearn to adjust it, I will be grateful if you can give a solution.

eddiebergman commented 1 year ago

Hi,

You'll have to create your own custom Estimator and in the space, specify a hyperparameter for each entry of the array.

Take a look at MLP::get_hyperparameter_search_space() where we define two hyperprameters which get joined together as a single hyperparameter in the estimator

eddiebergman commented 1 year ago

Hi @belzheng, your __init__ doesn't take in the parameters that you mention, you'll have to accept them in the __init__. Since it's a variable amount, you might want to use kwargs in your init, i.e. __init__(self, <other named params>, **kwargs) and process them in the body using kwargs["knot_0_0"].