CutePoison
CutePoison

Reputation: 5385

Specify fixed parameters and parameters to be search in optuna (lightgbm)

I just found Optuna and it seems they are integrated with lightGBM, but I struggle to see where I can fix parameters, e.g scoring="auc" and where I can define a gridspace to search, e.g num_leaves=[1,2,5,10].

Using https://github.com/optuna/optuna/blob/master/examples/lightgbm_tuner_simple.py as example, they just define a params dict with some fixed parameters (are all parameters not specified in that dict tuned?), and the documentation states that

It tunes important hyperparameters (e.g., min_child_samples and feature_fraction) in a stepwise manner

How can I controll which parameters are tuned and in what space, and how can I fix some parameters?

Upvotes: 1

Views: 1005

Answers (1)

Edwin van der Helm
Edwin van der Helm

Reputation: 243

I have no knowledge of LightGBM, but since this is the first result for fixing parameters in optuna, I'll answer that part of the question:

In optuna, the search space is defined within the code of the objective function. This function should take a 'trials' object as an input, and you can create parameters by calling the suggest_float(), suggest_int() etc. functions on that trials object. For more information, see the documentation at 10_key_features/002_configurations.html

Generally, fixing a parameter is done by hardcoding it instead of calling a suggest function, but it is possible to fix specific parameters externally using the PartialFixedSampler

Upvotes: 3

Related Questions