-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
Copy pathAnomalyDetector.json
504 lines (504 loc) · 19.1 KB
/
AnomalyDetector.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "Anomaly Detector Client",
"description": "The Anomaly Detector API detects anomalies automatically in time series data. It supports two kinds of mode, one is for stateless using, another is for stateful using. In stateless mode, there are three functionalities. Entire Detect is for detecting the whole series with model trained by the time series, Last Detect is detecting last point with model trained by points before. ChangePoint Detect is for detecting trend changes in time series. In stateful mode, user can store time series, the stored time series will be used for detection anomalies. Under this mode, user can still use the above three functionalities by only giving a time range without preparing time series in client side. Besides the above three functionalities, stateful model also provide group based detection and labeling service. By leveraging labeling service user can provide labels for each detection result, these labels will be used for retuning or regenerating detection models. Inconsistency detection is a kind of group based detection, this detection will find inconsistency ones in a set of time series. By using anomaly detector service, business customers can discover incidents and establish a logic flow for root cause analysis."
},
"securityDefinitions": {
"apiKeyHeader": {
"type": "apiKey",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
}
},
"security": [
{
"apiKeyHeader": []
}
],
"x-ms-parameterized-host": {
"hostTemplate": "{Endpoint}/anomalydetector/v1.0",
"useSchemePrefix": false,
"parameters": [
{
"$ref": "#/parameters/Endpoint"
}
]
},
"paths": {
"/timeseries/entire/detect": {
"post": {
"summary": "Detect anomalies for the entire series in batch.",
"description": "This operation generates a model with an entire series, each point is detected with the same model. With this method, points before and after a certain point are used to determine whether it is an anomaly. The entire detection can give user an overall status of the time series.",
"operationId": "DetectEntireSeries",
"parameters": [
{
"name": "body",
"in": "body",
"description": "Time series points and period if needed. Advanced model parameters can also be set in the request.",
"required": true,
"schema": {
"$ref": "#/definitions/DetectRequest"
}
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Successful operation.",
"schema": {
"$ref": "#/definitions/EntireDetectResponse"
}
},
"default": {
"description": "Error response.",
"schema": {
"$ref": "#/definitions/AnomalyDetectorError"
}
}
},
"x-ms-examples": {
"Find anomalies for the entire series in batch example": {
"$ref": "./examples/EntireDetect.json"
}
}
}
},
"/timeseries/last/detect": {
"post": {
"summary": "Detect anomaly status of the latest point in time series.",
"description": "This operation generates a model using points before the latest one. With this method, only historical points are used to determine whether the target point is an anomaly. The latest point detecting operation matches the scenario of real-time monitoring of business metrics.",
"operationId": "DetectLastPoint",
"parameters": [
{
"name": "body",
"in": "body",
"description": "Time series points and period if needed. Advanced model parameters can also be set in the request.",
"required": true,
"schema": {
"$ref": "#/definitions/DetectRequest"
}
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Successful operation.",
"schema": {
"$ref": "#/definitions/LastDetectResponse"
}
},
"default": {
"description": "Error response.",
"schema": {
"$ref": "#/definitions/AnomalyDetectorError"
}
}
},
"x-ms-examples": {
"Detect anomaly status of the latest point in time series example": {
"$ref": "./examples/LastDetect.json"
}
}
}
},
"/timeseries/changepoint/detect": {
"post": {
"summary": "Detect change point for the entire series",
"description": "Evaluate change point score of every series point",
"operationId": "DetectChangePoint",
"parameters": [
{
"name": "body",
"in": "body",
"description": "Time series points and granularity is needed. Advanced model parameters can also be set in the request if needed.",
"required": true,
"schema": {
"$ref": "#/definitions/ChangePointDetectRequest"
}
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Successful operation.",
"schema": {
"$ref": "#/definitions/ChangePointDetectResponse"
}
},
"default": {
"description": "Error response.",
"schema": {
"$ref": "#/definitions/AnomalyDetectorError"
}
}
},
"x-ms-examples": {
"Detect change point example": {
"$ref": "./examples/ChangePointDetect.json"
}
}
}
}
},
"definitions": {
"AnomalyDetectorError": {
"type": "object",
"description": "Error information returned by the API.",
"properties": {
"code": {
"description": "The error code.",
"enum": [
"InvalidCustomInterval",
"BadArgument",
"InvalidGranularity",
"InvalidPeriod",
"InvalidModelArgument",
"InvalidSeries",
"InvalidJsonFormat",
"RequiredGranularity",
"RequiredSeries"
],
"x-ms-enum": {
"name": "AnomalyDetectorErrorCodes",
"modelAsString": true
}
},
"message": {
"description": "A message explaining the error reported by the service.",
"type": "string"
}
}
},
"TimeGranularity": {
"type": "string",
"description": "Optional argument, can be one of yearly, monthly, weekly, daily, hourly, minutely, secondly, microsecond or none. If granularity is not present, it will be none by default. If granularity is none, the timestamp property in time series point can be absent.",
"x-nullable": false,
"x-ms-enum": {
"name": "TimeGranularity",
"modelAsString": false,
"values": [
{
"value": "yearly"
},
{
"value": "monthly"
},
{
"value": "weekly"
},
{
"value": "daily"
},
{
"value": "hourly"
},
{
"name": "perMinute",
"value": "minutely"
},
{
"name": "perSecond",
"value": "secondly"
},
{
"value": "microsecond"
},
{
"value": "none"
}
]
},
"enum": [
"yearly",
"monthly",
"weekly",
"daily",
"hourly",
"minutely",
"secondly",
"microsecond",
"none"
]
},
"CustomInterval": {
"type": "integer",
"format": "int32",
"x-nullable": false,
"description": "Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {\"granularity\":\"minutely\", \"customInterval\":5}."
},
"DetectRequest": {
"type": "object",
"required": [
"series"
],
"properties": {
"series": {
"type": "array",
"description": "Time series data points. Points should be sorted by timestamp in ascending order to match the anomaly detection result. If the data is not sorted correctly or there is duplicated timestamp, the API will not work. In such case, an error message will be returned.",
"items": {
"$ref": "#/definitions/TimeSeriesPoint"
}
},
"granularity": {
"$ref": "#/definitions/TimeGranularity"
},
"customInterval": {
"description": "Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {\"granularity\":\"minutely\", \"customInterval\":5}.",
"$ref": "#/definitions/CustomInterval"
},
"period": {
"type": "integer",
"format": "int32",
"description": "Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically."
},
"maxAnomalyRatio": {
"type": "number",
"format": "float",
"description": "Optional argument, advanced model parameter, max anomaly ratio in a time series."
},
"sensitivity": {
"type": "integer",
"format": "int32",
"description": "Optional argument, advanced model parameter, between 0-99, the lower the value is, the larger the margin value will be which means less anomalies will be accepted."
}
}
},
"TimeSeriesPoint": {
"type": "object",
"required": [
"value"
],
"properties": {
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Optional argument, timestamp of a data point (ISO8601 format)."
},
"value": {
"type": "number",
"format": "float",
"description": "The measurement of that point, should be float."
}
}
},
"EntireDetectResponse": {
"type": "object",
"required": [
"expectedValues",
"isAnomaly",
"isNegativeAnomaly",
"isPositiveAnomaly",
"lowerMargins",
"period",
"upperMargins"
],
"properties": {
"period": {
"type": "integer",
"format": "int32",
"description": "Frequency extracted from the series, zero means no recurrent pattern has been found."
},
"expectedValues": {
"type": "array",
"description": "ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series.",
"items": {
"type": "number",
"format": "float",
"x-nullable": false
}
},
"upperMargins": {
"type": "array",
"description": "UpperMargins contain upper margin of each input point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting marginScale value, less significant anomalies can be filtered in client side. The index of the array is consistent with the input series.",
"items": {
"type": "number",
"format": "float",
"x-nullable": false
}
},
"lowerMargins": {
"type": "array",
"description": "LowerMargins contain lower margin of each input point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. Points between the boundary can be marked as normal ones in client side. The index of the array is consistent with the input series.",
"items": {
"type": "number",
"format": "float",
"x-nullable": false
}
},
"isAnomaly": {
"type": "array",
"description": "IsAnomaly contains anomaly properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"x-nullable": false
}
},
"isNegativeAnomaly": {
"type": "array",
"description": "IsNegativeAnomaly contains anomaly status in negative direction for each input point. True means a negative anomaly has been detected. A negative anomaly means the point is detected as an anomaly and its real value is smaller than the expected one. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"x-nullable": false
}
},
"isPositiveAnomaly": {
"type": "array",
"description": "IsPositiveAnomaly contain anomaly status in positive direction for each input point. True means a positive anomaly has been detected. A positive anomaly means the point is detected as an anomaly and its real value is larger than the expected one. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"x-nullable": false
}
}
}
},
"LastDetectResponse": {
"type": "object",
"required": [
"expectedValue",
"isAnomaly",
"isNegativeAnomaly",
"isPositiveAnomaly",
"lowerMargin",
"period",
"upperMargin",
"suggestedWindow"
],
"properties": {
"period": {
"type": "integer",
"format": "int32",
"description": "Frequency extracted from the series, zero means no recurrent pattern has been found."
},
"suggestedWindow": {
"type": "integer",
"format": "int32",
"description": "Suggested input series points needed for detecting the latest point."
},
"expectedValue": {
"type": "number",
"format": "float",
"description": "Expected value of the latest point."
},
"upperMargin": {
"type": "number",
"format": "float",
"description": "Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting marginScale value, anomaly status of latest point can be changed."
},
"lowerMargin": {
"type": "number",
"format": "float",
"description": "Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. "
},
"isAnomaly": {
"type": "boolean",
"description": "Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction."
},
"isNegativeAnomaly": {
"type": "boolean",
"description": "Anomaly status in negative direction of the latest point. True means the latest point is an anomaly and its real value is smaller than the expected one."
},
"isPositiveAnomaly": {
"type": "boolean",
"description": "Anomaly status in positive direction of the latest point. True means the latest point is an anomaly and its real value is larger than the expected one."
}
}
},
"ChangePointDetectRequest": {
"type": "object",
"required": [
"granularity",
"series"
],
"properties": {
"series": {
"type": "array",
"description": "Time series data points. Points should be sorted by timestamp in ascending order to match the change point detection result.",
"items": {
"$ref": "#/definitions/TimeSeriesPoint"
}
},
"granularity": {
"$ref": "#/definitions/TimeGranularity",
"description": "Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid."
},
"customInterval": {
"description": "Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {\"granularity\":\"minutely\", \"customInterval\":5}.",
"$ref": "#/definitions/CustomInterval"
},
"period": {
"type": "integer",
"format": "int32",
"description": "Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically."
},
"stableTrendWindow": {
"type": "integer",
"format": "int32",
"description": "Optional argument, advanced model parameter, a default stableTrendWindow will be used in detection."
},
"threshold": {
"type": "number",
"format": "float",
"description": "Optional argument, advanced model parameter, between 0.0-1.0, the lower the value is, the larger the trend error will be which means less change point will be accepted."
}
}
},
"ChangePointDetectResponse": {
"type": "object",
"properties": {
"period": {
"type": "integer",
"format": "int32",
"readOnly": true,
"description": "Frequency extracted from the series, zero means no recurrent pattern has been found."
},
"isChangePoint": {
"type": "array",
"description": "isChangePoint contains change point properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"readOnly": true,
"x-nullable": false
}
},
"confidenceScores": {
"type": "array",
"description": "the change point confidence of each point",
"items": {
"type": "number",
"format": "float",
"readOnly": true,
"x-nullable": false
}
}
}
}
},
"parameters": {
"Endpoint": {
"name": "Endpoint",
"description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).",
"x-ms-parameter-location": "client",
"required": true,
"type": "string",
"in": "path",
"x-ms-skip-url-encoding": true
}
}
}