Skip to content

Commit

Permalink
[ML] fix initial score
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Jun 8, 2021
1 parent 615deb2 commit 0b491e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions x-pack/plugins/ml/server/lib/alerts/alerting_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export function alertingServiceProvider(mlClient: MlClient, datafeedsService: Da
'influencer_field_name',
'influencer_field_value',
'influencer_score',
'initial_influencer_score',
'is_interim',
'job_id',
'bucket_span',
Expand Down Expand Up @@ -138,6 +139,7 @@ export function alertingServiceProvider(mlClient: MlClient, datafeedsService: Da
'result_type',
'timestamp',
'record_score',
'initial_record_score',
'is_interim',
'function',
'field_name',
Expand Down Expand Up @@ -183,6 +185,7 @@ export function alertingServiceProvider(mlClient: MlClient, datafeedsService: Da
'result_type',
'timestamp',
'anomaly_score',
'initial_anomaly_score',
'is_interim',
'bucket_span',
],
Expand Down Expand Up @@ -260,7 +263,7 @@ export function alertingServiceProvider(mlClient: MlClient, datafeedsService: Da
return {
...h._source,
score: Math.floor(
topAnomaly._source[getScoreFields(ANOMALY_RESULT_TYPE.RECORD, useInitialScore)]
h._source[getScoreFields(ANOMALY_RESULT_TYPE.RECORD, useInitialScore)]
),
unique_key: getRecordKey(h._source),
};
Expand All @@ -269,7 +272,7 @@ export function alertingServiceProvider(mlClient: MlClient, datafeedsService: Da
return {
...h._source,
score: Math.floor(
topAnomaly._source[getScoreFields(ANOMALY_RESULT_TYPE.INFLUENCER, useInitialScore)]
h._source[getScoreFields(ANOMALY_RESULT_TYPE.INFLUENCER, useInitialScore)]
),
unique_key: `${h._source.timestamp}_${h._source.influencer_field_name}_${h._source.influencer_field_value}`,
};
Expand Down

0 comments on commit 0b491e9

Please sign in to comment.