Condividi tramite


AnomalyDetectorClient.DetectUnivariateEntireSeries Method

Definition

Overloads

DetectUnivariateEntireSeries(UnivariateDetectionOptions, CancellationToken)

Detect anomalies for the entire series in batch.

DetectUnivariateEntireSeries(RequestContent, RequestContext)

[Protocol Method] Detect anomalies for the entire series in batch.

DetectUnivariateEntireSeries(UnivariateDetectionOptions, CancellationToken)

Source:
AnomalyDetectorClient.cs

Detect anomalies for the entire series in batch.

public virtual Azure.Response<Azure.AI.AnomalyDetector.UnivariateEntireDetectionResult> DetectUnivariateEntireSeries (Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member DetectUnivariateEntireSeries : Azure.AI.AnomalyDetector.UnivariateDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.UnivariateEntireDetectionResult>
override this.DetectUnivariateEntireSeries : Azure.AI.AnomalyDetector.UnivariateDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.UnivariateEntireDetectionResult>
Public Overridable Function DetectUnivariateEntireSeries (options As UnivariateDetectionOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of UnivariateEntireDetectionResult)

Parameters

options
UnivariateDetectionOptions

Method of univariate anomaly detection.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

options is null.

Examples

This sample shows how to call DetectUnivariateEntireSeries 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 UnivariateDetectionOptions(new TimeSeriesPoint[] 
{
    new TimeSeriesPoint(3.14f)
{
        Timestamp = DateTimeOffset.UtcNow,
    }
})
{
    Granularity = TimeGranularity.Yearly,
    CustomInterval = 1234,
    Period = 1234,
    MaxAnomalyRatio = 3.14f,
    Sensitivity = 1234,
    ImputeMode = ImputeMode.Auto,
    ImputeFixedValue = 3.14f,
};
var result = client.DetectUnivariateEntireSeries(options);

Remarks

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's an anomaly. The entire detection can give the user an overall status of the time series.

Applies to

DetectUnivariateEntireSeries(RequestContent, RequestContext)

Source:
AnomalyDetectorClient.cs

[Protocol Method] Detect anomalies for the entire series in batch.

public virtual Azure.Response DetectUnivariateEntireSeries (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member DetectUnivariateEntireSeries : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.DetectUnivariateEntireSeries : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function DetectUnivariateEntireSeries (content As RequestContent, Optional context As RequestContext = Nothing) As Response

Parameters

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

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call DetectUnivariateEntireSeries with required request content, and how to 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 {
    series = new[] {
        new {
            value = 123.45f,
        }
    },
};

Response response = client.DetectUnivariateEntireSeries(RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("period").ToString());
Console.WriteLine(result.GetProperty("expectedValues")[0].ToString());
Console.WriteLine(result.GetProperty("upperMargins")[0].ToString());
Console.WriteLine(result.GetProperty("lowerMargins")[0].ToString());
Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString());
Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString());
Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString());

This sample shows how to call DetectUnivariateEntireSeries with all request content, and how to 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 {
    series = new[] {
        new {
            timestamp = "2022-05-10T14:57:31.2311892-04:00",
            value = 123.45f,
        }
    },
    granularity = "yearly",
    customInterval = 1234,
    period = 1234,
    maxAnomalyRatio = 123.45f,
    sensitivity = 1234,
    imputeMode = "auto",
    imputeFixedValue = 123.45f,
};

Response response = client.DetectUnivariateEntireSeries(RequestContent.Create(data), new RequestContext());

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("period").ToString());
Console.WriteLine(result.GetProperty("expectedValues")[0].ToString());
Console.WriteLine(result.GetProperty("upperMargins")[0].ToString());
Console.WriteLine(result.GetProperty("lowerMargins")[0].ToString());
Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString());
Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString());
Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString());
Console.WriteLine(result.GetProperty("severity")[0].ToString());

Remarks

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.

Below is the JSON schema for the request and response payloads.

Request Body:

Schema for UnivariateDetectionOptions:

{
  series: [
    {
      timestamp: string (date & time), # Optional.
      value: number, # Required.
    }
  ], # Required.
  granularity: "yearly" | "monthly" | "weekly" | "daily" | "hourly" | "minutely" | "secondly" | "microsecond" | "none", # Optional.
  customInterval: number, # Optional.
  period: number, # Optional.
  maxAnomalyRatio: number, # Optional.
  sensitivity: number, # Optional.
  imputeMode: "auto" | "previous" | "linear" | "fixed" | "zero" | "notFill", # Optional.
  imputeFixedValue: number, # Optional.
}

Response Body:

Schema for UnivariateEntireDetectionResult:

{
  period: number, # Required.
  expectedValues: [number], # Required.
  upperMargins: [number], # Required.
  lowerMargins: [number], # Required.
  isAnomaly: [boolean], # Required.
  isNegativeAnomaly: [boolean], # Required.
  isPositiveAnomaly: [boolean], # Required.
  severity: [number], # Optional.
}

Applies to