Condividi tramite


AnomalyDetectorClient.DetectUnivariateChangePointAsync Method

Definition

Overloads

DetectUnivariateChangePointAsync(UnivariateChangePointDetectionOptions, CancellationToken)

Detect change point for the entire series.

DetectUnivariateChangePointAsync(RequestContent, RequestContext)

[Protocol Method] Detect change point for the entire series

DetectUnivariateChangePointAsync(UnivariateChangePointDetectionOptions, CancellationToken)

Source:
AnomalyDetectorClient.cs

Detect change point for the entire series.

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

Parameters

options
UnivariateChangePointDetectionOptions

Method of univariate anomaly detection.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

options is null.

Examples

This sample shows how to call DetectUnivariateChangePointAsync 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 UnivariateChangePointDetectionOptions(new TimeSeriesPoint[] 
{
    new TimeSeriesPoint(3.14f)
{
        Timestamp = DateTimeOffset.UtcNow,
    }
}, TimeGranularity.Yearly)
{
    CustomInterval = 1234,
    Period = 1234,
    StableTrendWindow = 1234,
    Threshold = 3.14f,
};
var result = await client.DetectUnivariateChangePointAsync(options);

Remarks

Evaluate the change point score of every series point.

Applies to

DetectUnivariateChangePointAsync(RequestContent, RequestContext)

Source:
AnomalyDetectorClient.cs

[Protocol Method] Detect change point for the entire series

public virtual System.Threading.Tasks.Task<Azure.Response> DetectUnivariateChangePointAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member DetectUnivariateChangePointAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.DetectUnivariateChangePointAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function DetectUnivariateChangePointAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of 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 DetectUnivariateChangePointAsync 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,
        }
    },
    granularity = "yearly",
};

Response response = await client.DetectUnivariateChangePointAsync(RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

This sample shows how to call DetectUnivariateChangePointAsync 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,
    stableTrendWindow = 1234,
    threshold = 123.45f,
};

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

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("period").ToString());
Console.WriteLine(result.GetProperty("isChangePoint")[0].ToString());
Console.WriteLine(result.GetProperty("confidenceScores")[0].ToString());

Remarks

Evaluate change point score of every series point

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

Request Body:

Schema for UnivariateChangePointDetectionOptions:

{
  series: [
    {
      timestamp: string (date & time), # Optional.
      value: number, # Required.
    }
  ], # Required.
  granularity: "yearly" | "monthly" | "weekly" | "daily" | "hourly" | "minutely" | "secondly" | "microsecond" | "none", # Required.
  customInterval: number, # Optional.
  period: number, # Optional.
  stableTrendWindow: number, # Optional.
  threshold: number, # Optional.
}

Response Body:

Schema for UnivariateChangePointDetectionResult:

{
  period: number, # Optional.
  isChangePoint: [boolean], # Optional.
  confidenceScores: [number], # Optional.
}

Applies to