From a4834ecb05125c2d58040a600b70822a92f33ffe Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 1 Nov 2022 13:34:50 -0700 Subject: [PATCH 1/5] Add anomaly_score_explanation --- specification/ml/_types/Anomaly.ts | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/specification/ml/_types/Anomaly.ts b/specification/ml/_types/Anomaly.ts index 621231ecd4..3cee72613d 100644 --- a/specification/ml/_types/Anomaly.ts +++ b/specification/ml/_types/Anomaly.ts @@ -23,6 +23,10 @@ import { DurationValue, EpochTime, UnitMillis, UnitSeconds } from '@_types/Time' export class Anomaly { actual?: double[] + /** + * Information about the factors impacting the initial anomaly score. + */ + anomaly_score_explanation?: AnomalyExplanation bucket_span: DurationValue by_field_name?: string by_field_value?: string @@ -67,3 +71,46 @@ export class Influence { influencer_field_name: string influencer_field_values: string[] } + +export class AnomalyExplanation { + /** + * Impact from the duration and magnitude of the detected anomaly relative to the historical average. + */ + anomaly_characteristics_impact?: integer + /** + * Length of the detected anomaly in the number of buckets. + */ + anomaly_length?: integer + /** + * Type of the detected anomaly: `spike` or `dip`. + */ + anomaly_type?: string + /** + * Indicates reduction of anomaly score for the bucket with large confidence intervals. If a bucket has large confidence intervals, the score is reduced. + */ + high_variance_penalty?: boolean + /** + * If the bucket contains fewer samples than expected, the score is reduced. If the bucket contains fewer samples than expected, the score is reduced. + */ + incomplete_bucket_penalty?: boolean + /** + * Lower bound of the 95% confidence interval. + */ + lower_confidence_bound?: double + /** + * Impact of the deviation between actual and typical values in the past 12 buckets. + */ + multi_bucket_impact?: integer + /** + * Impact of the deviation between actual and typical values in the current bucket. + */ + single_bucket_impact?: integer + /** + * Typical (expected) value for this bucket. + */ + typical_value?: double + /** + * Upper bound of the 95% confidence interval. + */ + upper_confidence_bound?: double +} \ No newline at end of file From 9087e7b7c75e18186541948f083cac6554cabb43 Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 1 Nov 2022 13:35:17 -0700 Subject: [PATCH 2/5] Make generate --- output/schema/schema.json | 148 ++++++++++++++++++++++++++++++++++++- output/typescript/types.ts | 14 ++++ 2 files changed, 159 insertions(+), 3 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 415120ede7..10c140cb0b 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -120956,6 +120956,18 @@ } } }, + { + "description": "Information about the factors impacting the initial anomaly score.", + "name": "anomaly_score_explanation", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "AnomalyExplanation", + "namespace": "ml._types" + } + } + }, { "name": "bucket_span", "required": true, @@ -121215,7 +121227,7 @@ } } ], - "specLocation": "ml/_types/Anomaly.ts#L24-L47" + "specLocation": "ml/_types/Anomaly.ts#L24-L51" }, { "kind": "interface", @@ -121388,7 +121400,137 @@ } } ], - "specLocation": "ml/_types/Anomaly.ts#L49-L64" + "specLocation": "ml/_types/Anomaly.ts#L53-L68" + }, + { + "kind": "interface", + "name": { + "name": "AnomalyExplanation", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Impact from the duration and magnitude of the detected anomaly relative to the historical average.", + "name": "anomaly_characteristics_impact", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Length of the detected anomaly in the number of buckets.", + "name": "anomaly_length", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Type of the detected anomaly: `spike` or `dip`.", + "name": "anomaly_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Indicates reduction of anomaly score for the bucket with large confidence intervals. If a bucket has large confidence intervals, the score is reduced.", + "name": "high_variance_penalty", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "If the bucket contains fewer samples than expected, the score is reduced. If the bucket contains fewer samples than expected, the score is reduced.", + "name": "incomplete_bucket_penalty", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Lower bound of the 95% confidence interval.", + "name": "lower_confidence_bound", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, + { + "description": "Impact of the deviation between actual and typical values in the past 12 buckets.", + "name": "multi_bucket_impact", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Impact of the deviation between actual and typical values in the current bucket.", + "name": "single_bucket_impact", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Typical (expected) value for this bucket.", + "name": "typical_value", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, + { + "description": "Upper bound of the 95% confidence interval.", + "name": "upper_confidence_bound", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + } + ], + "specLocation": "ml/_types/Anomaly.ts#L75-L116" }, { "kind": "interface", @@ -126923,7 +127065,7 @@ } } ], - "specLocation": "ml/_types/Anomaly.ts#L66-L69" + "specLocation": "ml/_types/Anomaly.ts#L70-L73" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 742f02807d..d58adf8382 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11631,6 +11631,7 @@ export interface MlAnalysisMemoryLimit { export interface MlAnomaly { actual?: double[] + anomaly_score_explanation?: MlAnomalyExplanation bucket_span: DurationValue by_field_name?: string by_field_value?: string @@ -11671,6 +11672,19 @@ export interface MlAnomalyCause { typical: double[] } +export interface MlAnomalyExplanation { + anomaly_characteristics_impact?: integer + anomaly_length?: integer + anomaly_type?: string + high_variance_penalty?: boolean + incomplete_bucket_penalty?: boolean + lower_confidence_bound?: double + multi_bucket_impact?: integer + single_bucket_impact?: integer + typical_value?: double + upper_confidence_bound?: double +} + export interface MlApiKeyAuthorization { id: string name: string From b370e82d351d343193c565e6bcd88b7450f8f416 Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 1 Nov 2022 14:29:02 -0700 Subject: [PATCH 3/5] Fix formatting --- specification/ml/_types/Anomaly.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/ml/_types/Anomaly.ts b/specification/ml/_types/Anomaly.ts index 3cee72613d..f9c2c2ddce 100644 --- a/specification/ml/_types/Anomaly.ts +++ b/specification/ml/_types/Anomaly.ts @@ -113,4 +113,4 @@ export class AnomalyExplanation { * Upper bound of the 95% confidence interval. */ upper_confidence_bound?: double -} \ No newline at end of file +} From c160143b1e5456dc4e0b9675e922ae7121177a35 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Fri, 4 Nov 2022 13:23:42 -0700 Subject: [PATCH 4/5] Update specification/ml/_types/Anomaly.ts --- specification/ml/_types/Anomaly.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/ml/_types/Anomaly.ts b/specification/ml/_types/Anomaly.ts index f9c2c2ddce..514a3c4659 100644 --- a/specification/ml/_types/Anomaly.ts +++ b/specification/ml/_types/Anomaly.ts @@ -90,7 +90,7 @@ export class AnomalyExplanation { */ high_variance_penalty?: boolean /** - * If the bucket contains fewer samples than expected, the score is reduced. If the bucket contains fewer samples than expected, the score is reduced. + * If the bucket contains fewer samples than expected, the score is reduced. */ incomplete_bucket_penalty?: boolean /** From bd67241c547a5c85409770ba5cc0baa5c6bd064f Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 8 Nov 2022 09:33:32 -0800 Subject: [PATCH 5/5] Re-make generate --- output/schema/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index dc7e32cdaf..667bfce409 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -121484,7 +121484,7 @@ } }, { - "description": "If the bucket contains fewer samples than expected, the score is reduced. If the bucket contains fewer samples than expected, the score is reduced.", + "description": "If the bucket contains fewer samples than expected, the score is reduced.", "name": "incomplete_bucket_penalty", "required": false, "type": {