John Stud
John Stud

Reputation: 1779

hyperopt - is it possible to get the current value of its search space?

I am wondering if there is a way to access the current value chosen by hyperopt for parameters? I would like to use its selected value in a learning rate callback function for xgboost.

from hyperopt import hp
param = {'eta' : hp.uniform('eta', 0.01, 0.1)} # learning rate
param['eta'] # returns <hyperopt.pyll.base.Apply at 0x23fd5699dd8>      

Upvotes: 1

Views: 1228

Answers (1)

Antonyus Pyetro
Antonyus Pyetro

Reputation: 46

You'll get the value for 'eta' for each iteration of your objective function when using fmin.

E.g.

 _ = fmin(fn=objective,
           space=param,
           max_evals=num_trials)

And objective is defined as:

def objective(params: Dict):
    # So you can access  params['eta'] in this context

Upvotes: 2

Related Questions