azure.ai.anomalydetector package

class azure.ai.anomalydetector.AnomalyDetectorClient(credential: AzureKeyCredential, endpoint: str, **kwargs: Any)[source]

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.

Parameters
Keyword Arguments

api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

close()None[source]
delete_multivariate_model(model_id: str, **kwargs: Any)None

Delete Multivariate Model.

Delete an existing multivariate model according to the modelId.

Parameters

model_id (str) – Model identifier.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

detect_anomaly(model_id: str, body: _models.DetectionRequest, **kwargs: Any)None

Detect Multivariate Anomaly.

Submit detection multivariate anomaly task with the trained model of modelId, the input schema should be the same with the training request. Thus request will be complete asynchronously and will return a resultId for querying the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one single file. Each time-series will be as follows: the first column is timestamp and the second column is value.

Parameters
Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

detect_change_point(body: _models.ChangePointDetectRequest, **kwargs: Any)_models.ChangePointDetectResponse

Detect change point for the entire series.

Evaluate change point score of every series point.

Parameters

body (ChangePointDetectRequest) – Time series points and granularity is needed. Advanced model parameters can also be set in the request if needed.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

ChangePointDetectResponse, or the result of cls(response)

Return type

ChangePointDetectResponse

Raises

~azure.core.exceptions.HttpResponseError

detect_entire_series(body: _models.DetectRequest, **kwargs: Any)_models.EntireDetectResponse

Detect anomalies for the entire series in batch.

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.

Parameters

body (DetectRequest) – Time series points and period if needed. Advanced model parameters can also be set in the request.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

EntireDetectResponse, or the result of cls(response)

Return type

EntireDetectResponse

Raises

~azure.core.exceptions.HttpResponseError

detect_last_point(body: _models.DetectRequest, **kwargs: Any)_models.LastDetectResponse

Detect anomaly status of the latest point in time series.

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.

Parameters

body (DetectRequest) – Time series points and period if needed. Advanced model parameters can also be set in the request.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

LastDetectResponse, or the result of cls(response)

Return type

LastDetectResponse

Raises

~azure.core.exceptions.HttpResponseError

export_model(model_id: str, **kwargs: Any)IO

Export Multivariate Anomaly Detection Model as Zip file.

Export multivariate anomaly detection model based on modelId.

Parameters

model_id (str) – Model identifier.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

IO, or the result of cls(response)

Return type

IO

Raises

~azure.core.exceptions.HttpResponseError

get_detection_result(result_id: str, **kwargs: Any)_models.DetectionResult

Get Multivariate Anomaly Detection Result.

Get multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api.

Parameters

result_id (str) – Result identifier.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

DetectionResult, or the result of cls(response)

Return type

DetectionResult

Raises

~azure.core.exceptions.HttpResponseError

get_multivariate_model(model_id: str, **kwargs: Any)_models.Model

Get Multivariate Model.

Get detailed information of multivariate model, including the training status and variables used in the model.

Parameters

model_id (str) – Model identifier.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

Model, or the result of cls(response)

Return type

Model

Raises

~azure.core.exceptions.HttpResponseError

last_detect_anomaly(model_id: str, body: _models.LastDetectionRequest, **kwargs: Any)_models.LastDetectionResult

Detect anomalies in the last a few points of the request body.

Synchronized API for anomaly detection.

Parameters
Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

LastDetectionResult, or the result of cls(response)

Return type

LastDetectionResult

Raises

~azure.core.exceptions.HttpResponseError

list_multivariate_model(skip: Optional[int] = 0, top: Optional[int] = 5, **kwargs: Any)Iterable[_models.ModelList]

List Multivariate Models.

List models of a subscription.

Parameters
  • skip (int) – $skip indicates how many models will be skipped.

  • top (int) – $top indicates how many models will be fetched.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

An iterator like instance of either ModelList or the result of cls(response)

Return type

ItemPaged[ModelList]

Raises

~azure.core.exceptions.HttpResponseError

train_multivariate_model(body: _models.ModelInfo, **kwargs: Any)None

Train a Multivariate Anomaly Detection Model.

Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one single file. Each time-series will be in a single CSV file in which the first column is timestamp and the second column is value.

Parameters

body (ModelInfo) – Training request.

Keyword Arguments
  • api_version (str) – Anomaly Detector API version (for example, v1.0). The default value is “v1.1-preview.1”. Note that overriding this default value may result in unsupported behavior.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

None

Raises

~azure.core.exceptions.HttpResponseError