azure.ai.anomalydetector package

class azure.ai.anomalydetector.AnomalyDetectorClient(endpoint: str, credential: azure.core.credentials.AzureKeyCredential, **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) – Api Version. Default value is “v1.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. Required.

Returns

None

Return type

None

Raises

HttpResponseError

detect_multivariate_batch_anomaly(model_id: str, options: Union[azure.ai.anomalydetector.models._models.MultivariateBatchDetectionOptions, collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)azure.ai.anomalydetector.models._models.MultivariateDetectionResult

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.

Parameters
  • model_id (str) – Model identifier. Required.

  • options (MultivariateBatchDetectionOptions or JSON or IO) – Request of multivariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword Arguments

content_type (str) – Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

MultivariateDetectionResult. The MultivariateDetectionResult is compatible with MutableMapping

Return type

MultivariateDetectionResult

Raises

HttpResponseError

detect_multivariate_last_anomaly(model_id: str, options: Union[azure.ai.anomalydetector.models._models.MultivariateLastDetectionOptions, collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)azure.ai.anomalydetector.models._models.MultivariateLastDetectionResult

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.

Parameters
  • model_id (str) – Model identifier. Required.

  • options (MultivariateLastDetectionOptions or JSON or IO) – Request of last detection. Is one of the following types: model, JSON, IO Required.

Keyword Arguments

content_type (str) – Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

MultivariateLastDetectionResult. The MultivariateLastDetectionResult is compatible with MutableMapping

Return type

MultivariateLastDetectionResult

Raises

HttpResponseError

detect_univariate_change_point(options: Union[azure.ai.anomalydetector.models._models.UnivariateChangePointDetectionOptions, collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)azure.ai.anomalydetector.models._models.UnivariateChangePointDetectionResult

Detect change point for the entire series.

Evaluate change point score of every series point.

Parameters

options (UnivariateChangePointDetectionOptions or JSON or IO) – Method of univariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword Arguments

content_type (str) – Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

UnivariateChangePointDetectionResult. The UnivariateChangePointDetectionResult is compatible with MutableMapping

Return type

UnivariateChangePointDetectionResult

Raises

HttpResponseError

detect_univariate_entire_series(options: Union[azure.ai.anomalydetector.models._models.UnivariateDetectionOptions, collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)azure.ai.anomalydetector.models._models.UnivariateEntireDetectionResult

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

options (UnivariateDetectionOptions or JSON or IO) – Method of univariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword Arguments

content_type (str) – Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

UnivariateEntireDetectionResult. The UnivariateEntireDetectionResult is compatible with MutableMapping

Return type

UnivariateEntireDetectionResult

Raises

HttpResponseError

detect_univariate_last_point(options: Union[azure.ai.anomalydetector.models._models.UnivariateDetectionOptions, collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)azure.ai.anomalydetector.models._models.UnivariateLastDetectionResult

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.

Parameters

options (UnivariateDetectionOptions or JSON or IO) – Method of univariate anomaly detection. Is one of the following types: model, JSON, IO Required.

Keyword Arguments

content_type (str) – Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

UnivariateLastDetectionResult. The UnivariateLastDetectionResult is compatible with MutableMapping

Return type

UnivariateLastDetectionResult

Raises

HttpResponseError

get_multivariate_batch_detection_result(result_id: str, **kwargs: Any)azure.ai.anomalydetector.models._models.MultivariateDetectionResult

Get Multivariate Anomaly Detection Result.

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

Parameters

result_id (str) – ID of a batch detection result. Required.

Returns

MultivariateDetectionResult. The MultivariateDetectionResult is compatible with MutableMapping

Return type

MultivariateDetectionResult

Raises

HttpResponseError

get_multivariate_model(model_id: str, **kwargs: Any)azure.ai.anomalydetector.models._models.AnomalyDetectionModel

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. Required.

Returns

AnomalyDetectionModel. The AnomalyDetectionModel is compatible with MutableMapping

Return type

AnomalyDetectionModel

Raises

HttpResponseError

list_multivariate_models(*, skip: Optional[int] = None, top: Optional[int] = None, **kwargs: Any)Iterable[azure.ai.anomalydetector.models._models.AnomalyDetectionModel]

List Multivariate Models.

List models of a resource.

Keyword Arguments
  • 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

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

Return type

ItemPaged[AnomalyDetectionModel]

Raises

HttpResponseError

send_request(request: azure.core.rest._rest_py3.HttpRequest, **kwargs: Any)azure.core.rest._rest_py3.HttpResponse[source]

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

Parameters

request (HttpRequest) – The network request you want to make. Required.

Keyword Arguments

stream (bool) – Whether the response payload will be streamed. Defaults to False.

Returns

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

Return type

HttpResponse

train_multivariate_model(model_info: Union[azure.ai.anomalydetector.models._models.ModelInfo, collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)azure.ai.anomalydetector.models._models.AnomalyDetectionModel

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.

Parameters

model_info (ModelInfo or JSON or IO) – Model information. Is one of the following types: model, JSON, IO Required.

Keyword Arguments

content_type (str) – Body parameter Content-Type. Known values are: application/json. Default value is None.

Returns

AnomalyDetectionModel. The AnomalyDetectionModel is compatible with MutableMapping

Return type

AnomalyDetectionModel

Raises

HttpResponseError