10
10
import msrest .serialization
11
11
12
12
13
- class APIError (msrest .serialization .Model ):
13
+ class AnomalyDetectorError (msrest .serialization .Model ):
14
14
"""Error information returned by the API.
15
15
16
16
:param code: The error code. Possible values include: "InvalidCustomInterval", "BadArgument",
@@ -30,7 +30,7 @@ def __init__(
30
30
self ,
31
31
** kwargs
32
32
):
33
- super (APIError , self ).__init__ (** kwargs )
33
+ super (AnomalyDetectorError , self ).__init__ (** kwargs )
34
34
self .code = kwargs .get ('code' , None )
35
35
self .message = kwargs .get ('message' , None )
36
36
@@ -42,11 +42,11 @@ class ChangePointDetectRequest(msrest.serialization.Model):
42
42
43
43
:param series: Required. Time series data points. Points should be sorted by timestamp in
44
44
ascending order to match the change point detection result.
45
- :type series: list[~azure.ai.anomalydetector.models.Point ]
45
+ :type series: list[~azure.ai.anomalydetector.models.TimeSeriesPoint ]
46
46
:param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly,
47
47
minutely or secondly. Granularity is used for verify whether input series is valid. Possible
48
48
values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly".
49
- :type granularity: str or ~azure.ai.anomalydetector.models.Granularity
49
+ :type granularity: str or ~azure.ai.anomalydetector.models.TimeGranularity
50
50
:param custom_interval: Custom Interval is used to set non-standard time interval, for example,
51
51
if the series is 5 minutes, request can be set as {"granularity":"minutely",
52
52
"customInterval":5}.
@@ -68,7 +68,7 @@ class ChangePointDetectRequest(msrest.serialization.Model):
68
68
}
69
69
70
70
_attribute_map = {
71
- 'series' : {'key' : 'series' , 'type' : '[Point ]' },
71
+ 'series' : {'key' : 'series' , 'type' : '[TimeSeriesPoint ]' },
72
72
'granularity' : {'key' : 'granularity' , 'type' : 'str' },
73
73
'custom_interval' : {'key' : 'customInterval' , 'type' : 'int' },
74
74
'period' : {'key' : 'period' , 'type' : 'int' },
@@ -127,6 +127,62 @@ def __init__(
127
127
self .confidence_scores = kwargs ['confidence_scores' ]
128
128
129
129
130
+ class DetectRequest (msrest .serialization .Model ):
131
+ """DetectRequest.
132
+
133
+ All required parameters must be populated in order to send to Azure.
134
+
135
+ :param series: Required. Time series data points. Points should be sorted by timestamp in
136
+ ascending order to match the anomaly detection result. If the data is not sorted correctly or
137
+ there is duplicated timestamp, the API will not work. In such case, an error message will be
138
+ returned.
139
+ :type series: list[~azure.ai.anomalydetector.models.TimeSeriesPoint]
140
+ :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly,
141
+ minutely or secondly. Granularity is used for verify whether input series is valid. Possible
142
+ values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly".
143
+ :type granularity: str or ~azure.ai.anomalydetector.models.TimeGranularity
144
+ :param custom_interval: Custom Interval is used to set non-standard time interval, for example,
145
+ if the series is 5 minutes, request can be set as {"granularity":"minutely",
146
+ "customInterval":5}.
147
+ :type custom_interval: int
148
+ :param period: Optional argument, periodic value of a time series. If the value is null or does
149
+ not present, the API will determine the period automatically.
150
+ :type period: int
151
+ :param max_anomaly_ratio: Optional argument, advanced model parameter, max anomaly ratio in a
152
+ time series.
153
+ :type max_anomaly_ratio: float
154
+ :param sensitivity: Optional argument, advanced model parameter, between 0-99, the lower the
155
+ value is, the larger the margin value will be which means less anomalies will be accepted.
156
+ :type sensitivity: int
157
+ """
158
+
159
+ _validation = {
160
+ 'series' : {'required' : True },
161
+ 'granularity' : {'required' : True },
162
+ }
163
+
164
+ _attribute_map = {
165
+ 'series' : {'key' : 'series' , 'type' : '[TimeSeriesPoint]' },
166
+ 'granularity' : {'key' : 'granularity' , 'type' : 'str' },
167
+ 'custom_interval' : {'key' : 'customInterval' , 'type' : 'int' },
168
+ 'period' : {'key' : 'period' , 'type' : 'int' },
169
+ 'max_anomaly_ratio' : {'key' : 'maxAnomalyRatio' , 'type' : 'float' },
170
+ 'sensitivity' : {'key' : 'sensitivity' , 'type' : 'int' },
171
+ }
172
+
173
+ def __init__ (
174
+ self ,
175
+ ** kwargs
176
+ ):
177
+ super (DetectRequest , self ).__init__ (** kwargs )
178
+ self .series = kwargs ['series' ]
179
+ self .granularity = kwargs ['granularity' ]
180
+ self .custom_interval = kwargs .get ('custom_interval' , None )
181
+ self .period = kwargs .get ('period' , None )
182
+ self .max_anomaly_ratio = kwargs .get ('max_anomaly_ratio' , None )
183
+ self .sensitivity = kwargs .get ('sensitivity' , None )
184
+
185
+
130
186
class EntireDetectResponse (msrest .serialization .Model ):
131
187
"""EntireDetectResponse.
132
188
@@ -268,8 +324,8 @@ def __init__(
268
324
self .is_positive_anomaly = kwargs ['is_positive_anomaly' ]
269
325
270
326
271
- class Point (msrest .serialization .Model ):
272
- """Point .
327
+ class TimeSeriesPoint (msrest .serialization .Model ):
328
+ """TimeSeriesPoint .
273
329
274
330
All required parameters must be populated in order to send to Azure.
275
331
@@ -293,62 +349,6 @@ def __init__(
293
349
self ,
294
350
** kwargs
295
351
):
296
- super (Point , self ).__init__ (** kwargs )
352
+ super (TimeSeriesPoint , self ).__init__ (** kwargs )
297
353
self .timestamp = kwargs ['timestamp' ]
298
354
self .value = kwargs ['value' ]
299
-
300
-
301
- class Request (msrest .serialization .Model ):
302
- """Request.
303
-
304
- All required parameters must be populated in order to send to Azure.
305
-
306
- :param series: Required. Time series data points. Points should be sorted by timestamp in
307
- ascending order to match the anomaly detection result. If the data is not sorted correctly or
308
- there is duplicated timestamp, the API will not work. In such case, an error message will be
309
- returned.
310
- :type series: list[~azure.ai.anomalydetector.models.Point]
311
- :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly,
312
- minutely or secondly. Granularity is used for verify whether input series is valid. Possible
313
- values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly".
314
- :type granularity: str or ~azure.ai.anomalydetector.models.Granularity
315
- :param custom_interval: Custom Interval is used to set non-standard time interval, for example,
316
- if the series is 5 minutes, request can be set as {"granularity":"minutely",
317
- "customInterval":5}.
318
- :type custom_interval: int
319
- :param period: Optional argument, periodic value of a time series. If the value is null or does
320
- not present, the API will determine the period automatically.
321
- :type period: int
322
- :param max_anomaly_ratio: Optional argument, advanced model parameter, max anomaly ratio in a
323
- time series.
324
- :type max_anomaly_ratio: float
325
- :param sensitivity: Optional argument, advanced model parameter, between 0-99, the lower the
326
- value is, the larger the margin value will be which means less anomalies will be accepted.
327
- :type sensitivity: int
328
- """
329
-
330
- _validation = {
331
- 'series' : {'required' : True },
332
- 'granularity' : {'required' : True },
333
- }
334
-
335
- _attribute_map = {
336
- 'series' : {'key' : 'series' , 'type' : '[Point]' },
337
- 'granularity' : {'key' : 'granularity' , 'type' : 'str' },
338
- 'custom_interval' : {'key' : 'customInterval' , 'type' : 'int' },
339
- 'period' : {'key' : 'period' , 'type' : 'int' },
340
- 'max_anomaly_ratio' : {'key' : 'maxAnomalyRatio' , 'type' : 'float' },
341
- 'sensitivity' : {'key' : 'sensitivity' , 'type' : 'int' },
342
- }
343
-
344
- def __init__ (
345
- self ,
346
- ** kwargs
347
- ):
348
- super (Request , self ).__init__ (** kwargs )
349
- self .series = kwargs ['series' ]
350
- self .granularity = kwargs ['granularity' ]
351
- self .custom_interval = kwargs .get ('custom_interval' , None )
352
- self .period = kwargs .get ('period' , None )
353
- self .max_anomaly_ratio = kwargs .get ('max_anomaly_ratio' , None )
354
- self .sensitivity = kwargs .get ('sensitivity' , None )
0 commit comments