keras-team / keras-tuner

A Hyperparameter Tuning Library for Keras

Home Page:https://keras.io/keras_tuner/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contrary to documentation, floating point hyperparameter does not include max_value

sfo opened this issue · comments

I realized that for this snippet:

import keras_tuner

keras_tuner.__version__

hp = keras_tuner.HyperParameters()
min = .2
max = .6
step = 0.2
hp.Float("dropout_rate", min, max, step)
print("This should print 3 values:", list(hp.space[0].values))

I get

'1.4.7'
This should print 3 values: [0.2, 0.4]

The root cause seems to be the division at:

return int((self.max_value - self.min_value) // self.step + 1)

I'd suggest to replace the integer division by a floating point division and would be willing to contribute a PR.