HOW TO:在您的時間序列資料上使用異常偵測器 APIHow to: Use the Anomaly Detector API on your time series data

異常偵測器API提供兩種異常偵測方法。The Anomaly Detector API provides two methods of anomaly detection. 您可以在整個時間序列中以批次方式來偵測異常狀況, 或藉由偵測最新資料點的異常狀態來產生資料。You can either detect anomalies as a batch throughout your times series, or as your data is generated by detecting the anomaly status of the latest data point. 偵測模型會傳回異常結果以及每個資料點的預期值, 以及最高和較低的異常偵測界限。The detection model returns anomaly results along with each data point's expected value, and the upper and lower anomaly detection boundaries. 您可以使用這些值來視覺化標準值的範圍, 以及資料中的異常。you can use these values to visualize the range of normal values, and anomalies in the data.

異常偵測模式Anomaly detection modes

異常偵測器 API 提供偵測模式: 批次和串流。The Anomaly Detector API provides detection modes: batch and streaming.

注意

下列要求 Url 必須與您的訂用帳戶的適當端點結合。The following request URLs must be combined with the appropriate endpoint for your subscription. 例如:https://westus2.api.cognitive.microsoft.com/anomalydetector/v1.0/timeseries/entire/detectFor example: https://westus2.api.cognitive.microsoft.com/anomalydetector/v1.0/timeseries/entire/detect

批次偵測Batch detection

若要在指定的時間範圍內, 偵測整個資料點批次中的異常狀況, 請使用下列要求 URI 搭配您的時間序列資料:To detect anomalies throughout a batch of data points over a given time range, use the following request URI with your time series data:

/timeseries/entire/detect./timeseries/entire/detect.

藉由一次傳送您的時間序列資料, API 將會使用整個數列來產生模型, 並使用它來分析每個資料點。By sending your time series data at once, the API will generate a model using the entire series, and analyze each data point with it.

串流偵測Streaming detection

若要持續偵測串流資料的異常狀況, 請使用下列要求 URI 搭配您的最新資料點:To continuously detect anomalies on streaming data, use the following request URI with your latest data point:

/timeseries/last/detect'./timeseries/last/detect'.

藉由在產生新資料點時傳送它們, 您可以即時監視資料。By sending new data points as you generate them, you can monitor your data in real time. 系統會使用您傳送的資料點來產生模型, 而 API 會判斷時間序列中的最新點是否為異常。A model will be generated with the data points you send, and the API will determine if the latest point in the time series is an anomaly.

調整較低和較高的異常偵測界限Adjusting lower and upper anomaly detection boundaries

根據預設, 系統會使用expectedValueupperMarginlowerMargin來計算異常偵測的上限和下限。By default, the upper and lower boundaries for anomaly detection are calculated using expectedValue, upperMargin, and lowerMargin. 如果您需要不同的界限, marginScale建議您將套用至lowerMargin upperMargin或。If you require different boundaries, we recommend applying a marginScale to upperMargin or lowerMargin. 界限的計算方式如下:The boundaries would be calculated as follows:

範圍Boundary 計算Calculation
upperBoundary expectedValue + (100 - marginScale) * upperMargin
lowerBoundary expectedValue - (100 - marginScale) * lowerMargin

下列範例會以不同的敏感性顯示異常偵測器 API 結果。The following examples show an Anomaly Detector API result at different sensitivities.

敏感度為99的範例Example with sensitivity at 99

預設敏感度

敏感度為95的範例Example with sensitivity at 95

99敏感度

敏感度為85的範例Example with sensitivity at 85

85敏感度

後續步驟Next Steps