AnomalyDetectorClient.DetectUnivariateLastPoint 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
DetectUnivariateLastPoint(UnivariateDetectionOptions, CancellationToken) |
Detect anomaly status of the latest point in time series. |
DetectUnivariateLastPoint(RequestContent, RequestContext) |
[Protocol Method] Detect anomaly status of the latest point in time series.
|
DetectUnivariateLastPoint(UnivariateDetectionOptions, CancellationToken)
- Source:
- AnomalyDetectorClient.cs
Detect anomaly status of the latest point in time series.
public virtual Azure.Response<Azure.AI.AnomalyDetector.UnivariateLastDetectionResult> DetectUnivariateLastPoint (Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member DetectUnivariateLastPoint : Azure.AI.AnomalyDetector.UnivariateDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.UnivariateLastDetectionResult>
override this.DetectUnivariateLastPoint : Azure.AI.AnomalyDetector.UnivariateDetectionOptions * System.Threading.CancellationToken -> Azure.Response<Azure.AI.AnomalyDetector.UnivariateLastDetectionResult>
Public Overridable Function DetectUnivariateLastPoint (options As UnivariateDetectionOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of UnivariateLastDetectionResult)
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 DetectUnivariateLastPoint 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.DetectUnivariateLastPoint(options);
Remarks
This operation generates a model by using the points that you sent in to the API and based on all data to determine whether the last point is anomalous.
Applies to
DetectUnivariateLastPoint(RequestContent, RequestContext)
- Source:
- AnomalyDetectorClient.cs
[Protocol Method] Detect anomaly status of the latest point in time series.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler DetectUnivariateLastPoint(UnivariateDetectionOptions, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response DetectUnivariateLastPoint (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member DetectUnivariateLastPoint : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.DetectUnivariateLastPoint : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function DetectUnivariateLastPoint (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 DetectUnivariateLastPoint 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.DetectUnivariateLastPoint(RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("period").ToString());
Console.WriteLine(result.GetProperty("suggestedWindow").ToString());
Console.WriteLine(result.GetProperty("expectedValue").ToString());
Console.WriteLine(result.GetProperty("upperMargin").ToString());
Console.WriteLine(result.GetProperty("lowerMargin").ToString());
Console.WriteLine(result.GetProperty("isAnomaly").ToString());
Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString());
Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString());
This sample shows how to call DetectUnivariateLastPoint 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.DetectUnivariateLastPoint(RequestContent.Create(data), new RequestContext());
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("period").ToString());
Console.WriteLine(result.GetProperty("suggestedWindow").ToString());
Console.WriteLine(result.GetProperty("expectedValue").ToString());
Console.WriteLine(result.GetProperty("upperMargin").ToString());
Console.WriteLine(result.GetProperty("lowerMargin").ToString());
Console.WriteLine(result.GetProperty("isAnomaly").ToString());
Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString());
Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString());
Console.WriteLine(result.GetProperty("severity").ToString());
Remarks
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.
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 UnivariateLastDetectionResult
:
{
period: number, # Required.
suggestedWindow: number, # Required.
expectedValue: number, # Required.
upperMargin: number, # Required.
lowerMargin: number, # Required.
isAnomaly: boolean, # Required.
isNegativeAnomaly: boolean, # Required.
isPositiveAnomaly: boolean, # Required.
severity: number, # Optional.
}
Applies to
Azure SDK for .NET