@@ -123,8 +123,10 @@ def list_to_tuple(data):
123
123
def percent_to_float (data ):
124
124
if isinstance (data , str ) and re .match (r'-?\d+(\.\d+)?%' , data ):
125
125
data = float (data .strip ('%' )) / 100
126
+ if isinstance (data , int ):
127
+ data = float (data )
126
128
else :
127
- assert isinstance (data , float ), 'This field should be float or percent string'
129
+ assert isinstance (data , float ), 'This field should be float, int or percent string'
128
130
return data
129
131
130
132
policy_schema = Schema ({
@@ -459,7 +461,7 @@ def percent_to_float(data):
459
461
Hook ('accuracy_criterion' , handler = _valid_accuracy_field ): object ,
460
462
Optional ('accuracy_criterion' , default = {'relative' : 0.01 }): {
461
463
Optional ('relative' ): And (Or (str , float ), Use (percent_to_float )),
462
- Optional ('absolute' ): And (Or (str , float ), Use (percent_to_float )),
464
+ Optional ('absolute' ): And (Or (str , int , float ), Use (percent_to_float )),
463
465
Optional ('higher_is_better' , default = True ): bool ,
464
466
},
465
467
Optional ('objective' , default = 'performance' ): And (str , lambda s : s in OBJECTIVES ),
0 commit comments