共用方式為


AnomalyDetectorClient Class

  • java.lang.Object
    • com.azure.ai.anomalydetector.AnomalyDetectorClient

public final class AnomalyDetectorClient

Initializes a new instance of the synchronous AnomalyDetectorClient type.

Method Summary

Modifier and Type Method and Description
void deleteMultivariateModel(String modelId)

Delete Multivariate Model

Response<Void> deleteMultivariateModelWithResponse(String modelId, RequestOptions requestOptions)

Delete Multivariate Model

MultivariateDetectionResult detectMultivariateBatchAnomaly(String modelId, MultivariateBatchDetectionOptions options)

Detect Multivariate Anomaly

Response<BinaryData> detectMultivariateBatchAnomalyWithResponse(String modelId, BinaryData options, RequestOptions requestOptions)

Detect Multivariate Anomaly

MultivariateLastDetectionResult detectMultivariateLastAnomaly(String modelId, MultivariateLastDetectionOptions options)

Detect anomalies in the last point of the request body

Response<BinaryData> detectMultivariateLastAnomalyWithResponse(String modelId, BinaryData options, RequestOptions requestOptions)

Detect anomalies in the last point of the request body

UnivariateChangePointDetectionResult detectUnivariateChangePoint(UnivariateChangePointDetectionOptions options)

Detect change point for the entire series

Response<BinaryData> detectUnivariateChangePointWithResponse(BinaryData options, RequestOptions requestOptions)

Detect change point for the entire series

UnivariateEntireDetectionResult detectUnivariateEntireSeries(UnivariateDetectionOptions options)

Detect anomalies for the entire series in batch.

Response<BinaryData> detectUnivariateEntireSeriesWithResponse(BinaryData options, RequestOptions requestOptions)

Detect anomalies for the entire series in batch.

UnivariateLastDetectionResult detectUnivariateLastPoint(UnivariateDetectionOptions options)

Detect anomaly status of the latest point in time series.

Response<BinaryData> detectUnivariateLastPointWithResponse(BinaryData options, RequestOptions requestOptions)

Detect anomaly status of the latest point in time series.

MultivariateDetectionResult getMultivariateBatchDetectionResult(String resultId)

Get Multivariate Anomaly Detection Result

Response<BinaryData> getMultivariateBatchDetectionResultWithResponse(String resultId, RequestOptions requestOptions)

Get Multivariate Anomaly Detection Result

AnomalyDetectionModel getMultivariateModel(String modelId)

Get Multivariate Model

Response<BinaryData> getMultivariateModelWithResponse(String modelId, RequestOptions requestOptions)

Get Multivariate Model

PagedIterable<AnomalyDetectionModel> listMultivariateModels()

List Multivariate Models

PagedIterable<BinaryData> listMultivariateModels(RequestOptions requestOptions)

List Multivariate Models

AnomalyDetectionModel trainMultivariateModel(ModelInfo modelInfo)

Train a Multivariate Anomaly Detection Model

Response<BinaryData> trainMultivariateModelWithResponse(BinaryData modelInfo, RequestOptions requestOptions)

Train a Multivariate Anomaly Detection Model

Methods inherited from java.lang.Object

Method Details

deleteMultivariateModel

public void deleteMultivariateModel(String modelId)

Delete Multivariate Model

Delete an existing multivariate model according to the modelId.

Parameters:

modelId - Model identifier.

deleteMultivariateModelWithResponse

public Response deleteMultivariateModelWithResponse(String modelId, RequestOptions requestOptions)

Delete Multivariate Model

Delete an existing multivariate model according to the modelId.

Parameters:

modelId - Model identifier.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

detectMultivariateBatchAnomaly

public MultivariateDetectionResult detectMultivariateBatchAnomaly(String modelId, MultivariateBatchDetectionOptions options)

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:

modelId - Model identifier.
options - Request of multivariate anomaly detection.

Returns:

detection results for the given resultId.

detectMultivariateBatchAnomalyWithResponse

public Response detectMultivariateBatchAnomalyWithResponse(String modelId, BinaryData options, RequestOptions requestOptions)

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.

Request Body Schema

{
     dataSource: String (Required)
     topContributorCount: int (Required)
     startTime: OffsetDateTime (Required)
     endTime: OffsetDateTime (Required)
 }

Response Body Schema

{
     resultId: String (Required)
     summary (Required): {
         status: String(CREATED/RUNNING/READY/FAILED) (Required)
         errors (Optional): [
              (Optional){
                 code: String (Required)
                 message: String (Required)
             }
         ]
         variableStates (Optional): [
              (Optional){
                 variable: String (Optional)
                 filledNARatio: Double (Optional)
                 effectiveCount: Integer (Optional)
                 firstTimestamp: OffsetDateTime (Optional)
                 lastTimestamp: OffsetDateTime (Optional)
             }
         ]
         setupInfo (Required): {
             dataSource: String (Required)
             topContributorCount: int (Required)
             startTime: OffsetDateTime (Required)
             endTime: OffsetDateTime (Required)
         }
     }
     results (Required): [
          (Required){
             timestamp: OffsetDateTime (Required)
             value (Optional): {
                 isAnomaly: boolean (Required)
                 severity: double (Required)
                 score: double (Required)
                 interpretation (Optional): [
                      (Optional){
                         variable: String (Optional)
                         contributionScore: Double (Optional)
                         correlationChanges (Optional): {
                             changedVariables (Optional): [
                                 String (Optional)
                             ]
                         }
                     }
                 ]
             }
             errors (Optional): [
                 (recursive schema, see above)
             ]
         }
     ]
 }

Parameters:

modelId - Model identifier.
options - Request of multivariate anomaly detection.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

detection results for the given resultId along with Response<T>.

detectMultivariateLastAnomaly

public MultivariateLastDetectionResult detectMultivariateLastAnomaly(String modelId, MultivariateLastDetectionOptions options)

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:

modelId - Model identifier.
options - Request of last detection.

Returns:

results of last detection.

detectMultivariateLastAnomalyWithResponse

public Response detectMultivariateLastAnomalyWithResponse(String modelId, BinaryData options, RequestOptions requestOptions)

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.

Request Body Schema

{
     variables (Required): [
          (Required){
             variable: String (Required)
             timestamps (Required): [
                 String (Required)
             ]
             values (Required): [
                 double (Required)
             ]
         }
     ]
     topContributorCount: int (Required)
 }

Response Body Schema

{
     variableStates (Optional): [
          (Optional){
             variable: String (Optional)
             filledNARatio: Double (Optional)
             effectiveCount: Integer (Optional)
             firstTimestamp: OffsetDateTime (Optional)
             lastTimestamp: OffsetDateTime (Optional)
         }
     ]
     results (Optional): [
          (Optional){
             timestamp: OffsetDateTime (Required)
             value (Optional): {
                 isAnomaly: boolean (Required)
                 severity: double (Required)
                 score: double (Required)
                 interpretation (Optional): [
                      (Optional){
                         variable: String (Optional)
                         contributionScore: Double (Optional)
                         correlationChanges (Optional): {
                             changedVariables (Optional): [
                                 String (Optional)
                             ]
                         }
                     }
                 ]
             }
             errors (Optional): [
                  (Optional){
                     code: String (Required)
                     message: String (Required)
                 }
             ]
         }
     ]
 }

Parameters:

modelId - Model identifier.
options - Request of last detection.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

results of last detection along with Response<T>.

detectUnivariateChangePoint

public UnivariateChangePointDetectionResult detectUnivariateChangePoint(UnivariateChangePointDetectionOptions options)

Detect change point for the entire series

Evaluate change point score of every series point.

Parameters:

options - Method of univariate anomaly detection.

Returns:

the response of change point detection.

detectUnivariateChangePointWithResponse

public Response detectUnivariateChangePointWithResponse(BinaryData options, RequestOptions requestOptions)

Detect change point for the entire series

Evaluate change point score of every series point.

Request Body Schema

{
     series (Required): [
          (Required){
             timestamp: OffsetDateTime (Optional)
             value: double (Required)
         }
     ]
     granularity: String(yearly/monthly/weekly/daily/hourly/minutely/secondly/microsecond/none) (Required)
     customInterval: Integer (Optional)
     period: Integer (Optional)
     stableTrendWindow: Integer (Optional)
     threshold: Double (Optional)
 }

Response Body Schema

{
     period: Integer (Optional)
     isChangePoint (Optional): [
         boolean (Optional)
     ]
     confidenceScores (Optional): [
         double (Optional)
     ]
 }

Parameters:

options - Method of univariate anomaly detection.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

the response of change point detection along with Response<T>.

detectUnivariateEntireSeries

public UnivariateEntireDetectionResult detectUnivariateEntireSeries(UnivariateDetectionOptions options)

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 - Method of univariate anomaly detection.

Returns:

the response of entire anomaly detection.

detectUnivariateEntireSeriesWithResponse

public Response detectUnivariateEntireSeriesWithResponse(BinaryData options, RequestOptions requestOptions)

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.

Request Body Schema

{
     series (Required): [
          (Required){
             timestamp: OffsetDateTime (Optional)
             value: double (Required)
         }
     ]
     granularity: String(yearly/monthly/weekly/daily/hourly/minutely/secondly/microsecond/none) (Optional)
     customInterval: Integer (Optional)
     period: Integer (Optional)
     maxAnomalyRatio: Double (Optional)
     sensitivity: Integer (Optional)
     imputeMode: String(auto/previous/linear/fixed/zero/notFill) (Optional)
     imputeFixedValue: Double (Optional)
 }

Response Body Schema

{
     period: int (Required)
     expectedValues (Required): [
         double (Required)
     ]
     upperMargins (Required): [
         double (Required)
     ]
     lowerMargins (Required): [
         double (Required)
     ]
     isAnomaly (Required): [
         boolean (Required)
     ]
     isNegativeAnomaly (Required): [
         boolean (Required)
     ]
     isPositiveAnomaly (Required): [
         boolean (Required)
     ]
     severity (Optional): [
         double (Optional)
     ]
 }

Parameters:

options - Method of univariate anomaly detection.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

the response of entire anomaly detection along with Response<T>.

detectUnivariateLastPoint

public UnivariateLastDetectionResult detectUnivariateLastPoint(UnivariateDetectionOptions options)

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 - Method of univariate anomaly detection.

Returns:

the response of last anomaly detection.

detectUnivariateLastPointWithResponse

public Response detectUnivariateLastPointWithResponse(BinaryData options, RequestOptions requestOptions)

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.

Request Body Schema

{
     series (Required): [
          (Required){
             timestamp: OffsetDateTime (Optional)
             value: double (Required)
         }
     ]
     granularity: String(yearly/monthly/weekly/daily/hourly/minutely/secondly/microsecond/none) (Optional)
     customInterval: Integer (Optional)
     period: Integer (Optional)
     maxAnomalyRatio: Double (Optional)
     sensitivity: Integer (Optional)
     imputeMode: String(auto/previous/linear/fixed/zero/notFill) (Optional)
     imputeFixedValue: Double (Optional)
 }

Response Body Schema

{
     period: int (Required)
     suggestedWindow: int (Required)
     expectedValue: double (Required)
     upperMargin: double (Required)
     lowerMargin: double (Required)
     isAnomaly: boolean (Required)
     isNegativeAnomaly: boolean (Required)
     isPositiveAnomaly: boolean (Required)
     severity: Double (Optional)
 }

Parameters:

options - Method of univariate anomaly detection.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

the response of last anomaly detection along with Response<T>.

getMultivariateBatchDetectionResult

public MultivariateDetectionResult getMultivariateBatchDetectionResult(String resultId)

Get Multivariate Anomaly Detection Result

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

Parameters:

resultId - ID of a batch detection result.

Returns:

detection results for the given resultId.

getMultivariateBatchDetectionResultWithResponse

public Response getMultivariateBatchDetectionResultWithResponse(String resultId, RequestOptions requestOptions)

Get Multivariate Anomaly Detection Result

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

Response Body Schema

{
     resultId: String (Required)
     summary (Required): {
         status: String(CREATED/RUNNING/READY/FAILED) (Required)
         errors (Optional): [
              (Optional){
                 code: String (Required)
                 message: String (Required)
             }
         ]
         variableStates (Optional): [
              (Optional){
                 variable: String (Optional)
                 filledNARatio: Double (Optional)
                 effectiveCount: Integer (Optional)
                 firstTimestamp: OffsetDateTime (Optional)
                 lastTimestamp: OffsetDateTime (Optional)
             }
         ]
         setupInfo (Required): {
             dataSource: String (Required)
             topContributorCount: int (Required)
             startTime: OffsetDateTime (Required)
             endTime: OffsetDateTime (Required)
         }
     }
     results (Required): [
          (Required){
             timestamp: OffsetDateTime (Required)
             value (Optional): {
                 isAnomaly: boolean (Required)
                 severity: double (Required)
                 score: double (Required)
                 interpretation (Optional): [
                      (Optional){
                         variable: String (Optional)
                         contributionScore: Double (Optional)
                         correlationChanges (Optional): {
                             changedVariables (Optional): [
                                 String (Optional)
                             ]
                         }
                     }
                 ]
             }
             errors (Optional): [
                 (recursive schema, see above)
             ]
         }
     ]
 }

Parameters:

resultId - ID of a batch detection result.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

detection results for the given resultId along with Response<T>.

getMultivariateModel

public AnomalyDetectionModel getMultivariateModel(String modelId)

Get Multivariate Model

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

Parameters:

modelId - Model identifier.

Returns:

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

getMultivariateModelWithResponse

public Response getMultivariateModelWithResponse(String modelId, RequestOptions requestOptions)

Get Multivariate Model

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

Response Body Schema

{
     modelId: String (Required)
     createdTime: OffsetDateTime (Required)
     lastUpdatedTime: OffsetDateTime (Required)
     modelInfo (Optional): {
         dataSource: String (Required)
         dataSchema: String(OneTable/MultiTable) (Optional)
         startTime: OffsetDateTime (Required)
         endTime: OffsetDateTime (Required)
         displayName: String (Optional)
         slidingWindow: Integer (Optional)
         alignPolicy (Optional): {
             alignMode: String(Inner/Outer) (Optional)
             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed) (Optional)
             paddingValue: Double (Optional)
         }
         status: String(CREATED/RUNNING/READY/FAILED) (Optional)
         errors (Optional): [
              (Optional){
                 code: String (Required)
                 message: String (Required)
             }
         ]
         diagnosticsInfo (Optional): {
             modelState (Optional): {
                 epochIds (Optional): [
                     int (Optional)
                 ]
                 trainLosses (Optional): [
                     double (Optional)
                 ]
                 validationLosses (Optional): [
                     double (Optional)
                 ]
                 latenciesInSeconds (Optional): [
                     double (Optional)
                 ]
             }
             variableStates (Optional): [
                  (Optional){
                     variable: String (Optional)
                     filledNARatio: Double (Optional)
                     effectiveCount: Integer (Optional)
                     firstTimestamp: OffsetDateTime (Optional)
                     lastTimestamp: OffsetDateTime (Optional)
                 }
             ]
         }
     }
 }

Parameters:

modelId - Model identifier.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

detailed information of multivariate model, including the training status and variables used in the model along with Response<T>.

listMultivariateModels

public PagedIterable listMultivariateModels()

List Multivariate Models

List models of a resource.

Returns:

response of listing models as paginated response with PagedIterable<T>.

listMultivariateModels

public PagedIterable listMultivariateModels(RequestOptions requestOptions)

List Multivariate Models

List models of a resource.

Query Parameters

| ---- | ------- | -------- | ----------------------------------------------- |
| Name | Type    | Required | Description                                     |
| skip | Integer | No       | Skip indicates how many models will be skipped. |
| top  | Integer | No       | Top indicates how many models will be fetched.  |

You can add these to a request with RequestOptions#addQueryParam

Response Body Schema

{
     modelId: String (Required)
     createdTime: OffsetDateTime (Required)
     lastUpdatedTime: OffsetDateTime (Required)
     modelInfo (Optional): {
         dataSource: String (Required)
         dataSchema: String(OneTable/MultiTable) (Optional)
         startTime: OffsetDateTime (Required)
         endTime: OffsetDateTime (Required)
         displayName: String (Optional)
         slidingWindow: Integer (Optional)
         alignPolicy (Optional): {
             alignMode: String(Inner/Outer) (Optional)
             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed) (Optional)
             paddingValue: Double (Optional)
         }
         status: String(CREATED/RUNNING/READY/FAILED) (Optional)
         errors (Optional): [
              (Optional){
                 code: String (Required)
                 message: String (Required)
             }
         ]
         diagnosticsInfo (Optional): {
             modelState (Optional): {
                 epochIds (Optional): [
                     int (Optional)
                 ]
                 trainLosses (Optional): [
                     double (Optional)
                 ]
                 validationLosses (Optional): [
                     double (Optional)
                 ]
                 latenciesInSeconds (Optional): [
                     double (Optional)
                 ]
             }
             variableStates (Optional): [
                  (Optional){
                     variable: String (Optional)
                     filledNARatio: Double (Optional)
                     effectiveCount: Integer (Optional)
                     firstTimestamp: OffsetDateTime (Optional)
                     lastTimestamp: OffsetDateTime (Optional)
                 }
             ]
         }
     }
 }

Parameters:

requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

response of listing models as paginated response with PagedIterable<T>.

trainMultivariateModel

public AnomalyDetectionModel trainMultivariateModel(ModelInfo modelInfo)

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:

modelInfo - Model information.

Returns:

response of getting a model.

trainMultivariateModelWithResponse

public Response trainMultivariateModelWithResponse(BinaryData modelInfo, RequestOptions requestOptions)

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.

Request Body Schema

{
     dataSource: String (Required)
     dataSchema: String(OneTable/MultiTable) (Optional)
     startTime: OffsetDateTime (Required)
     endTime: OffsetDateTime (Required)
     displayName: String (Optional)
     slidingWindow: Integer (Optional)
     alignPolicy (Optional): {
         alignMode: String(Inner/Outer) (Optional)
         fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed) (Optional)
         paddingValue: Double (Optional)
     }
     status: String(CREATED/RUNNING/READY/FAILED) (Optional)
     errors (Optional): [
          (Optional){
             code: String (Required)
             message: String (Required)
         }
     ]
     diagnosticsInfo (Optional): {
         modelState (Optional): {
             epochIds (Optional): [
                 int (Optional)
             ]
             trainLosses (Optional): [
                 double (Optional)
             ]
             validationLosses (Optional): [
                 double (Optional)
             ]
             latenciesInSeconds (Optional): [
                 double (Optional)
             ]
         }
         variableStates (Optional): [
              (Optional){
                 variable: String (Optional)
                 filledNARatio: Double (Optional)
                 effectiveCount: Integer (Optional)
                 firstTimestamp: OffsetDateTime (Optional)
                 lastTimestamp: OffsetDateTime (Optional)
             }
         ]
     }
 }

Response Body Schema

{
     modelId: String (Required)
     createdTime: OffsetDateTime (Required)
     lastUpdatedTime: OffsetDateTime (Required)
     modelInfo (Optional): {
         dataSource: String (Required)
         dataSchema: String(OneTable/MultiTable) (Optional)
         startTime: OffsetDateTime (Required)
         endTime: OffsetDateTime (Required)
         displayName: String (Optional)
         slidingWindow: Integer (Optional)
         alignPolicy (Optional): {
             alignMode: String(Inner/Outer) (Optional)
             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed) (Optional)
             paddingValue: Double (Optional)
         }
         status: String(CREATED/RUNNING/READY/FAILED) (Optional)
         errors (Optional): [
              (Optional){
                 code: String (Required)
                 message: String (Required)
             }
         ]
         diagnosticsInfo (Optional): {
             modelState (Optional): {
                 epochIds (Optional): [
                     int (Optional)
                 ]
                 trainLosses (Optional): [
                     double (Optional)
                 ]
                 validationLosses (Optional): [
                     double (Optional)
                 ]
                 latenciesInSeconds (Optional): [
                     double (Optional)
                 ]
             }
             variableStates (Optional): [
                  (Optional){
                     variable: String (Optional)
                     filledNARatio: Double (Optional)
                     effectiveCount: Integer (Optional)
                     firstTimestamp: OffsetDateTime (Optional)
                     lastTimestamp: OffsetDateTime (Optional)
                 }
             ]
         }
     }
 }

Parameters:

modelInfo - Model information.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

response of getting a model along with Response<T>.

Applies to