Skip to content

Contrary to documentation, floating point hyperparameter does not include max_value #1001

Open
@sfo

Description

@sfo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions