Skip to content

Commit c3dda92

Browse files
committed
minor fit_class_random_forest cleanup
`labels` was unused
1 parent 704cb40 commit c3dda92

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

openeo_driver/ProcessGraphDeserializer.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -757,16 +757,16 @@ def fit_class_random_forest(args: dict, env: EvalEnv) -> DriverMlModel:
757757
parameter="target", process="fit_class_random_forest",
758758
reason='only GeoJSON FeatureCollection is currently supported.',
759759
)
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+
)
770770

771771
# TODO: get defaults from process spec?
772772
# TODO: do parameter checks automatically based on process spec?

0 commit comments

Comments
 (0)