scope.int not consistently returning int value
Author: Mathu-lmnCreated Dec 9, 2024Updated Jul 24, 2026
Hi, I'm facing an issue with hyperopt where the scope.int function does not returns an int but a float instead :
sklearn.utils._param_validation.InvalidParameterError: The 'min_samples_leaf' parameter of RandomForestClassifier must be an int in the range [1, inf) or a float in the range (0.0, 1.0). Got 2.0 instead.Here is the python code that is using hyperopt and not working for me :
'min_samples_leaf': scope.int(hp.quniform('min_samples_leaf', 1, 20, 1))Perhaps I'm being mislead by the name "scope.int" but I think it should not return 2.0 but 2 instead ?
Source: hyperopt/hyperopt