Skip to content

TypeError: Expected float, got numpy.float64  #362

@wadieskaf

Description

@wadieskaf

There is an issue with this file:

ConfigSpace/hyperparameters/uniform_float.pyx:124: TypeError: Expected float, got numpy.float64

It occurs when attempting to create a UniformFloatHyperparameter with or without passing a default value.

I think the issue is casting to float before rounding instead of doing the opposite.

Original code: default_value = np.round(float(default_value), 10)

Suggested fix: default_value = float(np.round(default_value, 10))

Python version: 3.11.9
configspace: 0.7.2

Note: the error does not exist when using Python v3.9.19 with configspace v0.6.1

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