azure.cognitiveservices.anomalydetector.models module

exception azure.cognitiveservices.anomalydetector.models.APIErrorException(deserialize, response, *args)[source]

Bases: msrest.exceptions.HttpOperationError

Server responsed with exception of type: ‘APIError’.

Parameters
  • deserialize – A deserializer

  • response – Server response to be deserialized.

class azure.cognitiveservices.anomalydetector.models.APIError(*, code=None, message: str = None, **kwargs)[source]

Bases: msrest.serialization.Model

Error information returned by the API.

Parameters
  • code (object) – The error code.

  • message (str) – A message explaining the error reported by the service.

class azure.cognitiveservices.anomalydetector.models.ChangePointDetectRequest(*, series, granularity, custom_interval: int = None, period: int = None, stable_trend_window: int = None, threshold: float = None, **kwargs)[source]

Bases: msrest.serialization.Model

ChangePointDetectRequest.

All required parameters must be populated in order to send to Azure.

Parameters
  • series (list[Point]) – Required. Time series data points. Points should be sorted by timestamp in ascending order to match the change point detection result.

  • granularity (str or Granularity) – Required. Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid. Possible values include: ‘yearly’, ‘monthly’, ‘weekly’, ‘daily’, ‘hourly’, ‘minutely’, ‘secondly’

  • custom_interval (int) – 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}.

  • period (int) – Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically.

  • stable_trend_window (int) – Optional argument, advanced model parameter, a default stableTrendWindow will be used in detection.

  • threshold (float) – 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.

class azure.cognitiveservices.anomalydetector.models.ChangePointDetectResponse(*, period: int, is_change_point, confidence_scores, **kwargs)[source]

Bases: msrest.serialization.Model

ChangePointDetectResponse.

All required parameters must be populated in order to send to Azure.

Parameters
  • period (int) – Required. Frequency extracted from the series, zero means no recurrent pattern has been found.

  • is_change_point (list[bool]) – Required. 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.

  • confidence_scores (list[float]) – Required. the change point confidence of each point

class azure.cognitiveservices.anomalydetector.models.EntireDetectResponse(*, period: int, expected_values, upper_margins, lower_margins, is_anomaly, is_negative_anomaly, is_positive_anomaly, **kwargs)[source]

Bases: msrest.serialization.Model

EntireDetectResponse.

All required parameters must be populated in order to send to Azure.

Parameters
  • period (int) – Required. Frequency extracted from the series, zero means no recurrent pattern has been found.

  • expected_values (list[float]) – Required. ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series.

  • upper_margins (list[float]) – Required. 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.

  • lower_margins (list[float]) – Required. 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.

  • is_anomaly (list[bool]) – Required. 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.

  • is_negative_anomaly (list[bool]) – Required. 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.

  • is_positive_anomaly (list[bool]) – Required. 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.

class azure.cognitiveservices.anomalydetector.models.LastDetectResponse(*, period: int, suggested_window: int, expected_value: float, upper_margin: float, lower_margin: float, is_anomaly: bool, is_negative_anomaly: bool, is_positive_anomaly: bool, **kwargs)[source]

Bases: msrest.serialization.Model

LastDetectResponse.

All required parameters must be populated in order to send to Azure.

Parameters
  • period (int) – Required. Frequency extracted from the series, zero means no recurrent pattern has been found.

  • suggested_window (int) – Required. Suggested input series points needed for detecting the latest point.

  • expected_value (float) – Required. Expected value of the latest point.

  • upper_margin (float) – Required. 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.

  • lower_margin (float) – Required. Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin.

  • is_anomaly (bool) – Required. Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction.

  • is_negative_anomaly (bool) – Required. 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.

  • is_positive_anomaly (bool) – Required. 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.

class azure.cognitiveservices.anomalydetector.models.Point(*, timestamp, value: float, **kwargs)[source]

Bases: msrest.serialization.Model

Point.

All required parameters must be populated in order to send to Azure.

Parameters
  • timestamp (datetime) – Required. Timestamp of a data point (ISO8601 format).

  • value (float) – Required. The measurement of that point, should be float.

class azure.cognitiveservices.anomalydetector.models.Request(*, series, granularity, custom_interval: int = None, period: int = None, max_anomaly_ratio: float = None, sensitivity: int = None, **kwargs)[source]

Bases: msrest.serialization.Model

Request.

All required parameters must be populated in order to send to Azure.

Parameters
  • series (list[Point]) – Required. 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.

  • granularity (str or Granularity) – Required. Possible values include: ‘yearly’, ‘monthly’, ‘weekly’, ‘daily’, ‘hourly’, ‘minutely’, ‘secondly’

  • custom_interval (int) – 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}.

  • period (int) – Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically.

  • max_anomaly_ratio (float) – Optional argument, advanced model parameter, max anomaly ratio in a time series.

  • sensitivity (int) – 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.

class azure.cognitiveservices.anomalydetector.models.Granularity[source]

Bases: str, enum.Enum

An enumeration.

daily = 'daily'
hourly = 'hourly'
minutely = 'minutely'
monthly = 'monthly'
secondly = 'secondly'
weekly = 'weekly'
yearly = 'yearly'