We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca8ce5b commit 06a2dbaCopy full SHA for 06a2dba
openlayer/schemas.py
@@ -139,6 +139,23 @@ class ModelSchema(ma.Schema):
139
),
140
required=True,
141
)
142
+ predictionThreshold = ma.fields.Float(
143
+ allow_none=True,
144
+ validate=ma.validate.Range(
145
+ min=0.0,
146
+ max=1.0,
147
+ ),
148
+ load_default=None,
149
+ )
150
+
151
+ @ma.validates_schema
152
+ def validates_prediction_threshold_and_class_names(self, data, **kwargs):
153
+ """Validates whether a prediction threshold was specified for a
154
+ binary classification model."""
155
+ if data["predictionThreshold"] and len(data["classNames"]) != 2:
156
+ raise ma.ValidationError(
157
+ "`predictionThreshold` can only be specified for binary classification models."
158
159
160
161
class ProjectSchema(ma.Schema):
0 commit comments