Anomaly Detector v1.1-preview.2

The Anomaly Detector service detects anomalies in time series data. It supports several functionalities:

  • Detecting anomalies in single time-series, including entire, last and change point detection. With this univariate anomaly detection capability, business customers can discover incidents.
  • Detecting anomalies in multiple time-series. This set of multivariate anomaly detection APIs in Anomaly Detector analyze dependencies and inter-correlation changes between different signals. It enables customers to gather a group of related time-series and detect failures in a system level.

To ensure online service quality is one of the main reasons we developed this service. Our team is dedicated to continuing to improve the Anomaly Detector service to provide precise results.

This Univariate Anomaly Detection is currently available in:

This Multivariate Anomaly Detection is currently available in:

  • East US - eastus.api.cognitive.microsoft.com
  • East US 2 - eastus2.api.cognitive.microsoft.com
  • South Central US - southcentralus.api.cognitive.microsoft.com
  • UK South - uksouth.api.cognitive.microsoft.com
  • West Europe - westeurope.api.cognitive.microsoft.com
  • West US 2 - westus2.api.cognitive.microsoft.com

Multivariate Anomaly Detection - Get Multivariate Model

Get detailed information of multivariate model, including the training status and variables used in the model.

Select the testing console in the region where you created your resource:

Open API testing console

Request URL

Request parameters

string

Format - uuid. Model identifier.

Request headers

string
Subscription key which provides access to this API. Found in your Cognitive Services accounts.

Request body

Response 200

Get multivariate model details successfully.

{
  "modelId": "73d10650-f829-11eb-92f8-0e9a1b90042a",
  "createdTime": "2021-08-08T09:17:29+00:00",
  "lastUpdatedTime": "2021-08-08T09:20:32+00:00",
  "modelInfo": {
    "slidingWindow": 200,
    "alignPolicy": {
      "alignMode": "Outer",
      "fillNAMethod": "Linear",
      "paddingValue": 0
    },
    "source": "{your_sas_url}",
    "startTime": "2019-04-09T00:00:00+00:00",
    "endTime": "2019-04-21T00:00:00+00:00",
    "displayName": "SampleRequest",
    "status": "READY",
    "errors": [],
    "diagnosticsInfo": {
      "modelState": {
        "epochIds": [
          10,
          20,
          30,
          40,
          50,
          60,
          70,
          80,
          90,
          100
        ],
        "trainLosses": [
          1.31489654183388,
          1.17678023129702,
          1.19430365413427,
          1.12685751244426,
          1.10806355252862,
          1.13284762948751,
          1.10873586982489,
          1.07150934487581,
          1.14442977681756,
          1.12112107500434
        ],
        "validationLosses": [
          0.841338058312734,
          1.04808860272169,
          0.993009338776271,
          1.01609475910664,
          0.819686387976011,
          0.956957473109166,
          1.62071681395173,
          1.41156827658415,
          1.27665486062566,
          1.60504793624083
        ],
        "latenciesInSeconds": [
          1.38910412788391,
          1.45727849006653,
          1.39628529548645,
          1.40202021598816,
          1.48186683654785,
          1.30679655075073,
          1.37642407417297,
          1.41343760490417,
          1.31761693954468,
          1.28593230247498
        ]
      },
      "variableStates": [
        {
          "variable": "opticalRFiltered",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "pumpPressureB",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "rotationalC",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "pumpPressureTarget",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "rotationalA",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "rotationalB",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "opticalLFiltered",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        },
        {
          "variable": "pumpPressureA",
          "filledNARatio": 0,
          "effectiveCount": 1062,
          "startTime": "2019-04-09T12:20:00+00:00",
          "endTime": "2019-04-21T00:00:00+00:00",
          "errors": []
        }
      ]
    }
  }
}
{
  "description": "Response of getting a model.",
  "required": [
    "createdTime",
    "lastUpdatedTime",
    "modelId"
  ],
  "type": "object",
  "properties": {
    "modelId": {
      "format": "uuid",
      "description": "Model identifier.",
      "type": "string",
      "example": "45aad126-aafd-11ea-b8fb-d89ef3400c5f"
    },
    "createdTime": {
      "format": "date-time",
      "description": "Date and time (UTC) when the model was created.",
      "type": "string",
      "example": "2020-06-30T00:00:00Z"
    },
    "lastUpdatedTime": {
      "format": "date-time",
      "description": "Date and time (UTC) when the model was last updated.",
      "type": "string",
      "example": "2020-06-30T00:00:00Z"
    },
    "modelInfo": {
      "description": "Train result of a model including status, errors and diagnose info for model and variables.",
      "required": [
        "endTime",
        "source",
        "startTime"
      ],
      "type": "object",
      "properties": {
        "slidingWindow": {
          "description": "An optional field, indicating how many previous points will be used to compute the anomaly score of the subsequent point.",
          "type": "integer",
          "example": 200
        },
        "alignPolicy": {
          "type": "object",
          "properties": {
            "alignMode": {
              "description": "An optional field, indicating how we align different variables to the same time-range. Either Inner or Outer. ",
              "enum": [
                "Inner",
                "Outer"
              ],
              "type": "string",
              "example": "Outer",
              "x-ms-enum": {
                "name": "alignMode",
                "modelAsString": false
              }
            },
            "fillNAMethod": {
              "description": "An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed, and NotFill. Cannot be set to NotFill, when the alignMode is Outer.",
              "enum": [
                "Previous",
                "Subsequent",
                "Linear",
                "Zero",
                "Fixed",
                "NotFill"
              ],
              "type": "string",
              "example": "Linear",
              "x-ms-enum": {
                "name": "fillNAMethod",
                "modelAsString": true
              }
            },
            "paddingValue": {
              "description": "An optional field. Required when fillNAMethod is Fixed.",
              "type": "number"
            }
          }
        },
        "source": {
          "description": "Source link to the input variables. Each variable should be a csv file with two columns, `timestamp` and `value`. By default, the file name of the variable will be used as its variable name.",
          "type": "string",
          "example": "{your_sas_url}"
        },
        "startTime": {
          "format": "date-time",
          "description": "A required field, indicating the start time of training data. Should be date-time.",
          "type": "string",
          "example": "2019-04-01T00:00:00Z"
        },
        "endTime": {
          "format": "date-time",
          "description": "A required field, indicating the end time of training data. Should be date-time.",
          "type": "string",
          "example": "2019-04-02T00:00:00Z"
        },
        "displayName": {
          "description": "An optional field. The name of the model whose maximum length is 24.",
          "maxLength": 24,
          "type": "string",
          "example": "DevOps-MultiAD"
        },
        "status": {
          "description": "Model training status.",
          "enum": [
            "CREATED",
            "RUNNING",
            "READY",
            "FAILED"
          ],
          "type": "string",
          "readOnly": true,
          "example": "READY",
          "x-ms-enum": {
            "name": "modelStatus",
            "modelAsString": false
          }
        },
        "errors": {
          "description": "Error messages when failed to create a model.",
          "type": "array",
          "items": {
            "required": [
              "code",
              "message"
            ],
            "type": "object",
            "properties": {
              "code": {
                "description": "The error code.",
                "type": "string"
              },
              "message": {
                "description": "The message explaining the error reported by the service.",
                "type": "string"
              }
            }
          },
          "readOnly": true
        },
        "diagnosticsInfo": {
          "type": "object",
          "properties": {
            "modelState": {
              "type": "object",
              "properties": {
                "epochIds": {
                  "description": "Epoch id",
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "example": [
                    10,
                    20,
                    30,
                    40,
                    50,
                    60,
                    70,
                    80,
                    90,
                    100
                  ]
                },
                "trainLosses": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  },
                  "example": [
                    0.629132807254791,
                    0.167132690548897,
                    0.123542480170727,
                    0.102596640586853,
                    0.0958492755889893,
                    0.0906995236873627,
                    0.0868601649999619,
                    0.0860302299261093,
                    0.0828735455870628,
                    0.0823553800582886
                  ]
                },
                "validationLosses": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  },
                  "example": [
                    0.957342743873596,
                    0.318222999572754,
                    0.340264648199081,
                    0.276534885168076,
                    0.257401436567307,
                    0.269286036491394,
                    0.26372304558754,
                    0.259083300828934,
                    0.259716689586639,
                    0.259735018014908
                  ]
                },
                "latenciesInSeconds": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  },
                  "example": [
                    0.339859485626221,
                    0.365966558456421,
                    0.373606443405151,
                    0.351340770721436,
                    0.337030410766602,
                    0.31876277923584,
                    0.328330993652344,
                    0.350358724594116,
                    0.308002471923828,
                    0.332794666290283
                  ]
                }
              }
            },
            "variableStates": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "variable": {
                    "description": "Variable name.",
                    "type": "string"
                  },
                  "filledNARatio": {
                    "description": "Proportion of NaN values filled of the variable.",
                    "maximum": 1,
                    "minimum": 0,
                    "type": "number"
                  },
                  "effectiveCount": {
                    "description": "Number of effective points counted.",
                    "type": "integer"
                  },
                  "startTime": {
                    "format": "date-time",
                    "description": "Start time of the variable.",
                    "type": "string"
                  },
                  "endTime": {
                    "format": "date-time",
                    "description": "End time of the variable.",
                    "type": "string"
                  }
                }
              },
              "example": [
                {
                  "variable": "ad_input",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "ad_on_timer_output",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "ingestion",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "data_in_speed",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "cpu",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "ad_series_init",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "F-Link_last_check_point_duration",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "data_out_speed",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                },
                {
                  "variable": "ad_output",
                  "filledNARatio": 0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z"
                }
              ]
            }
          },
          "readOnly": true
        }
      },
      "example": "{\r\n  \"slidingWindow\": 200,\r\n  \"alignPolicy\": {\r\n    \"alignMode\": \"Outer\",\r\n    \"fillNAMethod\": \"Linear\",\r\n    \"paddingValue\": 0\r\n  },\r\n  \"source\": \"{your_sas_url}\",\r\n  \"startTime\": \"2019-04-09T00:00:00+00:00\",\r\n  \"endTime\": \"2019-04-21T00:00:00+00:00\",\r\n  \"displayName\": \"SampleRequest\"\r\n}"
    }
  }
}

Response 403

The certificate you provided is not accepted by server.

Response 404

Possible Errors:

  • ModelNotExist
    The model does not exist.

{
  "code": "ModelNotExist",
  "message": "The model does not exist."
}
{
  "required": [
    "code",
    "message"
  ],
  "type": "object",
  "properties": {
    "code": {
      "description": "The error code.",
      "type": "string"
    },
    "message": {
      "description": "The message explaining the error reported by the service.",
      "type": "string"
    }
  }
}

Response 405

Method Not Allowed.

Response 500

Internal Server Error.

Code samples

@ECHO OFF

curl -v -X GET "https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            var uri = "https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}?" + queryString;

            var response = await client.GetAsync(uri);
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}");


            URI uri = builder.build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
        };
      
        $.ajax({
            url: "https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "GET",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    // Request headers
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('*.cognitiveservices.azure.com')
    conn.request("GET", "/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
})

try:
    conn = http.client.HTTPSConnection('*.cognitiveservices.azure.com')
    conn.request("GET", "/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview.2/multivariate/models/{modelId}')
uri.query = URI.encode_www_form({
})

request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body