Share via


AnomalyDetectorClient.DetectUnivariateChangePoint Method

Definition

Overloads

DetectUnivariateChangePoint(UnivariateChangePointDetectionOptions, CancellationToken)

Detect change point for the entire series.

DetectUnivariateChangePoint(RequestContent, RequestContext)

[Protocol Method] Detect change point for the entire series

DetectUnivariateChangePoint(UnivariateChangePointDetectionOptions, CancellationToken)

Source:
AnomalyDetectorClient.cs

Detect change point for the entire series.

public virtual Azure.Response<Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult> DetectUnivariateChangePoint (Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member DetectUnivariateChangePoint : Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult>
override this.DetectUnivariateChangePoint : Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult>
Public Overridable Function DetectUnivariateChangePoint (options As UnivariateChangePointDetectionOptions, Optional cancellationToken As CancellationToken = Nothing) As 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 DetectUnivariateChangePoint 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 = client.DetectUnivariateChangePoint(options);

Remarks

Evaluate the change point score of every series point.

Applies to

DetectUnivariateChangePoint(RequestContent, RequestContext)

Source:
AnomalyDetectorClient.cs

[Protocol Method] Detect change point for the entire series

public virtual Azure.Response DetectUnivariateChangePoint (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member DetectUnivariateChangePoint : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.DetectUnivariateChangePoint : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function DetectUnivariateChangePoint (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 DetectUnivariateChangePoint 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 = client.DetectUnivariateChangePoint(RequestContent.Create(data));

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

This sample shows how to call DetectUnivariateChangePoint 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 = client.DetectUnivariateChangePoint(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