AnomalyDetectorClient Class

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.

Inheritance
azure.ai.anomalydetector._operations._operations.AnomalyDetectorClientOperationsMixin
AnomalyDetectorClient

Constructor

AnomalyDetectorClient(endpoint: str, credential: AzureKeyCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). Required.

credential
Required

Credential needed for the client to connect to Azure. Required.

Keyword-Only Parameters

Name Description
api_version
str

Api Version. Default value is "v1.1". Note that overriding this default value may result in unsupported behavior.

Methods

close
delete_multivariate_model

Delete Multivariate Model.

Delete an existing multivariate model according to the modelId.

detect_multivariate_batch_anomaly

Detect Multivariate Anomaly.

Submit multivariate anomaly detection task with the modelId of trained model and inference data, the input schema should be the same with the training request. The request will complete asynchronously and return a resultId to query the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri, either pointed to an Azure blob storage folder, or pointed to a CSV file in Azure blob storage.

detect_multivariate_last_anomaly

Detect anomalies in the last point of the request body.

Submit multivariate anomaly detection task with the modelId of trained model and inference data, and the inference data should be put into request body in a JSON format. The request will complete synchronously and return the detection immediately in the response body.

detect_univariate_change_point

Detect change point for the entire series.

Evaluate change point score of every series point.

detect_univariate_entire_series

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.

detect_univariate_last_point

Detect anomaly status of the latest point in time series.

This operation generates a model using the points that you sent into the API, and based on all data to determine whether the last point is anomalous.

get_multivariate_batch_detection_result

Get Multivariate Anomaly Detection Result.

For asynchronous inference, get multivariate anomaly detection result based on resultId returned by the BatchDetectAnomaly api.

get_multivariate_model

Get Multivariate Model.

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

list_multivariate_models

List Multivariate Models.

List models of a resource.

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

train_multivariate_model

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 blob storage URI.There are two types of data input: An URI pointed to an Azure blob storage folder which contains multiple CSV files, and each CSV file contains two columns, timestamp and variable. Another type of input is an URI pointed to a CSV file in Azure blob storage, which contains all the variables and a timestamp column.

close

close() -> None

delete_multivariate_model

Delete Multivariate Model.

Delete an existing multivariate model according to the modelId.

delete_multivariate_model(model_id: str, **kwargs: Any) -> None

Parameters

Name Description
model_id
Required
str

Model identifier. Required.

Returns

Type Description

None

Exceptions

Type Description

detect_multivariate_batch_anomaly

Detect Multivariate Anomaly.

Submit multivariate anomaly detection task with the modelId of trained model and inference data, the input schema should be the same with the training request. The request will complete asynchronously and return a resultId to query the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri, either pointed to an Azure blob storage folder, or pointed to a CSV file in Azure blob storage.

detect_multivariate_batch_anomaly(model_id: str, options: MultivariateBatchDetectionOptions | MutableMapping[str, Any] | IO, **kwargs: Any) -> MultivariateDetectionResult

Parameters

Name Description
model_id
Required
str

Model identifier. Required.

options
Required

Request of multivariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword-Only Parameters

Name Description
content_type
str

Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

Type Description

MultivariateDetectionResult. The MultivariateDetectionResult is compatible with MutableMapping

Exceptions

Type Description

detect_multivariate_last_anomaly

Detect anomalies in the last point of the request body.

Submit multivariate anomaly detection task with the modelId of trained model and inference data, and the inference data should be put into request body in a JSON format. The request will complete synchronously and return the detection immediately in the response body.

detect_multivariate_last_anomaly(model_id: str, options: MultivariateLastDetectionOptions | MutableMapping[str, Any] | IO, **kwargs: Any) -> MultivariateLastDetectionResult

Parameters

Name Description
model_id
Required
str

Model identifier. Required.

options
Required

Request of last detection. Is one of the following types: model, JSON, IO Required.

Keyword-Only Parameters

Name Description
content_type
str

Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

Type Description

MultivariateLastDetectionResult. The MultivariateLastDetectionResult is compatible with MutableMapping

Exceptions

Type Description

detect_univariate_change_point

Detect change point for the entire series.

Evaluate change point score of every series point.

detect_univariate_change_point(options: UnivariateChangePointDetectionOptions | MutableMapping[str, Any] | IO, **kwargs: Any) -> UnivariateChangePointDetectionResult

Parameters

Name Description
options
Required

Method of univariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword-Only Parameters

Name Description
content_type
str

Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

Type Description

UnivariateChangePointDetectionResult. The UnivariateChangePointDetectionResult is compatible with MutableMapping

Exceptions

Type Description

detect_univariate_entire_series

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.

detect_univariate_entire_series(options: UnivariateDetectionOptions | MutableMapping[str, Any] | IO, **kwargs: Any) -> UnivariateEntireDetectionResult

Parameters

Name Description
options
Required
UnivariateDetectionOptions or <xref:JSON> or IO

Method of univariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword-Only Parameters

Name Description
content_type
str

Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

Type Description

UnivariateEntireDetectionResult. The UnivariateEntireDetectionResult is compatible with MutableMapping

Exceptions

Type Description

detect_univariate_last_point

Detect anomaly status of the latest point in time series.

This operation generates a model using the points that you sent into the API, and based on all data to determine whether the last point is anomalous.

detect_univariate_last_point(options: UnivariateDetectionOptions | MutableMapping[str, Any] | IO, **kwargs: Any) -> UnivariateLastDetectionResult

Parameters

Name Description
options
Required
UnivariateDetectionOptions or <xref:JSON> or IO

Method of univariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword-Only Parameters

Name Description
content_type
str

Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

Type Description

UnivariateLastDetectionResult. The UnivariateLastDetectionResult is compatible with MutableMapping

Exceptions

Type Description

get_multivariate_batch_detection_result

Get Multivariate Anomaly Detection Result.

For asynchronous inference, get multivariate anomaly detection result based on resultId returned by the BatchDetectAnomaly api.

get_multivariate_batch_detection_result(result_id: str, **kwargs: Any) -> MultivariateDetectionResult

Parameters

Name Description
result_id
Required
str

ID of a batch detection result. Required.

Returns

Type Description

MultivariateDetectionResult. The MultivariateDetectionResult is compatible with MutableMapping

Exceptions

Type Description

get_multivariate_model

Get Multivariate Model.

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

get_multivariate_model(model_id: str, **kwargs: Any) -> AnomalyDetectionModel

Parameters

Name Description
model_id
Required
str

Model identifier. Required.

Returns

Type Description

AnomalyDetectionModel. The AnomalyDetectionModel is compatible with MutableMapping

Exceptions

Type Description

list_multivariate_models

List Multivariate Models.

List models of a resource.

list_multivariate_models(*, skip: int | None = None, top: int | None = None, **kwargs: Any) -> Iterable[AnomalyDetectionModel]

Keyword-Only Parameters

Name Description
skip
int

Skip indicates how many models will be skipped. Default value is None.

top
int

Top indicates how many models will be fetched. Default value is None.

Returns

Type Description

An iterator like instance of AnomalyDetectionModel. The AnomalyDetectionModel is compatible with MutableMapping

Exceptions

Type Description

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, **kwargs: Any) -> HttpResponse

Parameters

Name Description
request
Required

The network request you want to make. Required.

Keyword-Only Parameters

Name Description
stream

Whether the response payload will be streamed. Defaults to False.

Returns

Type Description

The response of your network call. Does not do error handling on your response.

train_multivariate_model

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 blob storage URI.There are two types of data input: An URI pointed to an Azure blob storage folder which contains multiple CSV files, and each CSV file contains two columns, timestamp and variable. Another type of input is an URI pointed to a CSV file in Azure blob storage, which contains all the variables and a timestamp column.

train_multivariate_model(model_info: ModelInfo | MutableMapping[str, Any] | IO, **kwargs: Any) -> AnomalyDetectionModel

Parameters

Name Description
model_info
Required
ModelInfo or <xref:JSON> or IO

Model information. Is one of the following types: model, JSON, IO Required.

Keyword-Only Parameters

Name Description
content_type
str

Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

Type Description

AnomalyDetectionModel. The AnomalyDetectionModel is compatible with MutableMapping

Exceptions

Type Description