@@ -757,16 +757,16 @@ def fit_class_random_forest(args: dict, env: EvalEnv) -> DriverMlModel:
757
757
parameter = "target" , process = "fit_class_random_forest" ,
758
758
reason = 'only GeoJSON FeatureCollection is currently supported.' ,
759
759
)
760
- labels = []
761
- for feature in target [ "features" ]:
762
- target_label = deep_get (feature , "properties" , "target" , default = None )
763
- if not isinstance ( target_label , int ):
764
- # TODO: allow string based target labels too?
765
- raise ProcessParameterInvalidException (
766
- parameter = "target" , process = "fit_class_random_forest " ,
767
- reason = "Each feature should have an integer 'target' property."
768
- )
769
- labels . append ( target_label )
760
+ if any (
761
+ # TODO: allow string based target labels too?
762
+ not isinstance ( deep_get (f , "properties" , "target" , default = None ), int )
763
+ for f in target . get ( "features" , [])
764
+ ):
765
+ raise ProcessParameterInvalidException (
766
+ parameter = "target" ,
767
+ process = "fit_class_random_forest" ,
768
+ reason = "Each feature (from target feature collection) should have an integer 'target' property." ,
769
+ )
770
770
771
771
# TODO: get defaults from process spec?
772
772
# TODO: do parameter checks automatically based on process spec?
0 commit comments