次の方法で共有


AnomalyDetectorClient.DetectMultivariateBatchAnomalyAsync メソッド

定義

オーバーロード

DetectMultivariateBatchAnomalyAsync(String, MultivariateBatchDetectionOptions, CancellationToken)

多変量異常を検出します。

DetectMultivariateBatchAnomalyAsync(String, RequestContent, RequestContext)

[プロトコルメソッド]多変量異常の検出

DetectMultivariateBatchAnomalyAsync(String, MultivariateBatchDetectionOptions, CancellationToken)

Source:
AnomalyDetectorClient.cs

多変量異常を検出します。

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

パラメーター

modelId
String

モデル識別子。

options
MultivariateBatchDetectionOptions

多変量異常検出の要求。

cancellationToken
CancellationToken

使用する取り消しトークン。

戻り値

例外

modelId または options が null です。

modelId は空の文字列であり、空でないと想定されていました。

このサンプルでは、必要なパラメーターを使用して DetectMultivariateBatchAnomalyAsync を呼び出す方法を示します。

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 = await client.DetectMultivariateBatchAnomalyAsync("<modelId>", options);

注釈

トレーニング済みのモデルと推論データの modelId 値を使用して、多変量異常検出タスクを送信します。 入力スキーマは、トレーニング要求と同じである必要があります。 要求は非同期的に完了し、resultId 値を返して検出結果を照会します。 要求は、Azure Blob Storage フォルダーを指すか、Azure Blob Storageの CSV ファイルを指す、外部からアクセス可能な Azure Storage URI を示すソース リンクである必要があります。

適用対象

DetectMultivariateBatchAnomalyAsync(String, RequestContent, RequestContext)

Source:
AnomalyDetectorClient.cs

[プロトコルメソッド]多変量異常の検出

public virtual System.Threading.Tasks.Task<Azure.Response> DetectMultivariateBatchAnomalyAsync (string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member DetectMultivariateBatchAnomalyAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.DetectMultivariateBatchAnomalyAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function DetectMultivariateBatchAnomalyAsync (modelId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

パラメーター

modelId
String

モデル識別子。

content
RequestContent

要求の本文として送信するコンテンツ。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

サービスから返された応答。

例外

modelId または content が null です。

modelId は空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターを使用して DetectMultivariateBatchAnomalyAsync を呼び出し、コンテンツを要求し、結果を解析する方法を示します。

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 = await client.DetectMultivariateBatchAnomalyAsync("<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());

注釈

トレーニング済みのモデルと推論データの modelId を使用して多変量異常検出タスクを送信します。入力スキーマはトレーニング要求と同じである必要があります。 要求は非同期的に完了し、resultId を返して検出結果を照会します。要求は、外部からアクセス可能な Azure ストレージ URI を示すソース リンクである必要があります。これは、Azure BLOB ストレージ フォルダーを指しているか、Azure BLOB ストレージ内の CSV ファイルを指しています。

要求と応答のペイロードの JSON スキーマを次に示します。

要求本文:

MultivariateBatchDetectionOptionsスキーマ:

{
  dataSource: string, # Required.
  topContributorCount: number, # Required.
  startTime: string (date & time), # Required.
  endTime: string (date & time), # Required.
}

応答本文:

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.
}

適用対象