Skip to content

Commit 27e358c

Browse files
authored
YAML Inputs for Anomaly Detection (#530)
2 parents b90b2ee + 294ae01 commit 27e358c

File tree

2 files changed

+9
-30
lines changed

2 files changed

+9
-30
lines changed

ads/opctl/operator/lowcode/anomaly/schema.yaml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ spec:
282282
meta:
283283
description: "The model to be used for anomaly detection"
284284

285+
contamination:
286+
required: false
287+
default: 0.1
288+
type: float
289+
meta:
290+
description: "Fraction of training dataset corresponding to anomalies (between 0.0 and 0.5)"
291+
285292
model_kwargs:
286293
type: dict
287294
required: false
@@ -293,33 +300,4 @@ spec:
293300
meta:
294301
description: "preprocessing and feature engineering can be disabled using this flag, Defaults to true"
295302

296-
time_budget:
297-
type: float
298-
required: false
299-
default: 0
300-
meta:
301-
description: "Time budget for optimization in seconds, defaults to 0 which means no limit & optimization continues till convergence."
302-
303-
training_ratio:
304-
type: float
305-
required: false
306-
default: 0.7
307-
meta:
308-
description: "Ratio of data to be used for training, rest of the data is used for validation. defaults to 0.7"
309-
310-
false_alarm_ratio:
311-
type: float
312-
required: false
313-
default: 0.01
314-
meta:
315-
description: "False alarm ratio is the ratio of the expected anomaly in the train dataset, defaults to 0.01"
316-
317-
metric:
318-
type: string
319-
required: false
320-
default: F1_MACRO
321-
allowed:
322-
- F1_MACRO
323-
- unsupervised_unify95
324-
- unsupervised_unify95_log_loss
325303
type: dict

tests/operators/anomaly/test_anomaly_simple.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
MODELS = ["automlx", "autots"] # , "auto", "tods",
1818

19-
19+
# Mandatory YAML parameters
2020
TEMPLATE_YAML = {
2121
"kind": "operator",
2222
"type": "anomaly",
@@ -126,6 +126,7 @@ def test_artificial_small(model):
126126
yaml_i["spec"]["model"] = model
127127
yaml_i["spec"]["input_data"]["url"] = input_data
128128
yaml_i["spec"]["output_directory"]["url"] = output_dirname
129+
yaml_i["spec"]["contamination"] = 0.3
129130

130131
with open(anomaly_yaml_filename, "w") as f:
131132
f.write(yaml.dump(yaml_i))

0 commit comments

Comments
 (0)