AnomalyDetectorClient.DetectMultivariateBatchAnomaly Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DetectMultivariateBatchAnomaly(String, MultivariateBatchDetectionOptions, CancellationToken) |
Detect Multivariate Anomaly. |
DetectMultivariateBatchAnomaly(String, RequestContent, RequestContext) |
[Protocol Method] Detect Multivariate Anomaly
|
DetectMultivariateBatchAnomaly(String, MultivariateBatchDetectionOptions, CancellationToken)
- Source:
- AnomalyDetectorClient.cs
Detect Multivariate Anomaly.
public virtual Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult> DetectMultivariateBatchAnomaly (string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member DetectMultivariateBatchAnomaly : string * Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult>
override this.DetectMultivariateBatchAnomaly : string * Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult>
Public Overridable Function DetectMultivariateBatchAnomaly (modelId As String, options As MultivariateBatchDetectionOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of MultivariateDetectionResult)
Parameters
- modelId
- String
Model identifier.
Request of multivariate anomaly detection.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
modelId
or options
is null.
modelId
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call DetectMultivariateBatchAnomaly with required parameters.
var credential = new AzureKeyCredential("<key>");
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new AnomalyDetectorClient(endpoint, credential);
var options = new MultivariateBatchDetectionOptions("<dataSource>", 1234, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow);
var result = client.DetectMultivariateBatchAnomaly("<modelId>", options);
Remarks
Submit a multivariate anomaly detection task with the modelId value of a trained model and inference data. The input schema should be the same with the training request. The request will finish asynchronously and return a resultId value to query the detection result. The request should be a source link to indicate an externally accessible Azure Storage URI that either points to an Azure Blob Storage folder or points to a CSV file in Azure Blob Storage.
Applies to
DetectMultivariateBatchAnomaly(String, RequestContent, RequestContext)
- Source:
- AnomalyDetectorClient.cs
[Protocol Method] Detect Multivariate Anomaly
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler DetectMultivariateBatchAnomaly(String, MultivariateBatchDetectionOptions, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response DetectMultivariateBatchAnomaly (string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member DetectMultivariateBatchAnomaly : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.DetectMultivariateBatchAnomaly : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function DetectMultivariateBatchAnomaly (modelId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response
Parameters
- modelId
- String
Model identifier.
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
modelId
or content
is null.
modelId
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call DetectMultivariateBatchAnomaly with required parameters and request content and parse the result.
var credential = new AzureKeyCredential("<key>");
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new AnomalyDetectorClient(endpoint, credential);
var data = new {
dataSource = "<dataSource>",
topContributorCount = 1234,
startTime = "2022-05-10T14:57:31.2311892-04:00",
endTime = "2022-05-10T14:57:31.2311892-04:00",
};
Response response = client.DetectMultivariateBatchAnomaly("<modelId>", RequestContent.Create(data), new RequestContext());
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("resultId").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("errors")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("errors")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("variableStates")[0].GetProperty("variable").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("variableStates")[0].GetProperty("filledNARatio").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("variableStates")[0].GetProperty("effectiveCount").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("variableStates")[0].GetProperty("firstTimestamp").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("variableStates")[0].GetProperty("lastTimestamp").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("topContributorCount").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("isAnomaly").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("severity").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("score").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("variable").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("contributionScore").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("value").GetProperty("interpretation")[0].GetProperty("correlationChanges").GetProperty("changedVariables")[0].ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("results")[0].GetProperty("errors")[0].GetProperty("message").ToString());
Remarks
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.
Below is the JSON schema for the request and response payloads.
Request Body:
Schema for MultivariateBatchDetectionOptions
:
{
dataSource: string, # Required.
topContributorCount: number, # Required.
startTime: string (date & time), # Required.
endTime: string (date & time), # Required.
}
Response Body:
Schema for MultivariateDetectionResult
:
{
resultId: string, # Required.
summary: {
status: "CREATED" | "RUNNING" | "READY" | "FAILED", # Required.
errors: [ErrorResponse], # Optional.
variableStates: [VariableState], # Optional.
setupInfo: {
dataSource: string, # Required.
topContributorCount: number, # Required.
startTime: string (date & time), # Required.
endTime: string (date & time), # Required.
}, # Required.
}, # Required.
results: [
{
timestamp: string (date & time), # Required.
value: {
isAnomaly: boolean, # Required.
severity: number, # Required.
score: number, # Required.
interpretation: [AnomalyInterpretation], # Optional.
}, # Optional.
errors: [ErrorResponse], # Optional.
}
], # Required.
}
Applies to
Azure SDK for .NET