Anomaly Detector v1.1-preview

The Anomaly Detection service detects anomalies automatically in time series data. It supports several functionalities, one is for detecting anomalies in single time-series, including entire, last and change point detection. The other is detecting anomalies in multiple time-series. With univariate anomaly detection ability, business customers can discover incidents and establish a logic flow for root cause analysis. The multivariate anomaly detection APIs in Anomaly Detector analyze dependencies and inter-correlations between different signals. It enables customers to gather a group of related time-series and detect failures with a wholistic view. 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 detection service to provide precise results.

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:29Z",
    "lastUpdatedTime": "2021-08-08T09:20:32Z",
    "modelInfo": {
        "slidingWindow": 200,
        "alignPolicy": {
            "alignMode": "Outer",
            "fillNAMethod": "Linear",
            "paddingValue": 0
        },
        "source": "https://sampledatamvad.blob.core.windows.net/sample/train_iot.zip?sp=r&st=2021-08-05T03:42:15Z&se=2023-06-09T11:42:15Z&spr=https&sv=2020-08-04&sr=b&sig=MROMCzzJ52PtT2BNRu9egM0NFYz6JeybzbGgu8KCPAM%3D",
        "startTime": "2019-04-09T00:00:00Z",
        "endTime": "2019-04-21T00:00:00Z",
        "displayName": "SampleRequest",
        "status": "READY",
        "errors": [],
        "diagnosticsInfo": {
            "modelState": {
                "epochIds": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
                "trainLosses": [1.3148965418338776, 1.1767802312970161, 1.1943036541342735, 1.1268575124442577, 1.1080635525286198, 1.1328476294875145, 1.1087358698248864, 1.0715093448758126, 1.1444297768175602, 1.1211210750043392],
                "validationLosses": [0.8413380583127339, 1.0480886027216911, 0.9930093387762705, 1.016094759106636, 0.8196863879760106, 0.9569574731091658, 1.6207168139517307, 1.4115682765841484, 1.2766548606256645, 1.605047936240832],
                "latenciesInSeconds": [1.3891041278839111, 1.4572784900665283, 1.3962852954864502, 1.4020202159881592, 1.4818668365478516, 1.3067965507507324, 1.3764240741729736, 1.4134376049041748, 1.3176169395446777, 1.2859323024749756]
            },
            "variableStates": [{
                "variable": "opticalRFiltered",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "pumpPressureB",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "rotationalC",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "pumpPressureTarget",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "rotationalA",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "rotationalB",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "opticalLFiltered",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }, {
                "variable": "pumpPressureA",
                "filledNARatio": 0.0,
                "effectiveCount": 1062,
                "startTime": "2019-04-09T12:20:00Z",
                "endTime": "2019-04-21T00:00:00Z",
                "errors": []
            }]
        }
    }
}
{
  "required": [
    "createdTime",
    "lastUpdatedTime",
    "modelId"
  ],
  "properties": {
    "modelId": {
      "type": "string",
      "format": "uuid",
      "description": "Model identifier.",
      "example": "45aad126-aafd-11ea-b8fb-d89ef3400c5f"
    },
    "createdTime": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time (UTC) when the model was created.",
      "example": "2020-06-30T00:00:00Z"
    },
    "lastUpdatedTime": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time (UTC) when the model was last updated.",
      "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"
      ],
      "properties": {
        "slidingWindow": {
          "type": "integer",
          "description": "An optional field, indicates how many history points will be used to determine the anomaly score of one subsequent point.",
          "example": 28
        },
        "alignPolicy": {
          "description": "An optional field, since those multivariate need to be aligned in the same timestamp before starting the detection.",
          "properties": {
            "alignMode": {
              "type": "string",
              "description": "An optional field, indicates how we align different variables into the same time-range which is required by the model.{Inner, Outer}",
              "example": "Outer",
              "enum": [
                "Inner",
                "Outer"
              ],
              "x-ms-enum": {
                "name": "alignMode",
                "modelAsString": false
              }
            },
            "fillNAMethod": {
              "type": "string",
              "description": "An optional field, indicates how missed values will be filled with. Can not be set to NotFill, when alignMode is Outer.{Previous, Subsequent, Linear, Zero, Fix, NotFill}",
              "example": "Linear",
              "enum": [
                "Previous",
                "Subsequent",
                "Linear",
                "Zero",
                "Pad",
                "NotFill"
              ],
              "x-ms-enum": {
                "name": "fillNAMethod",
                "modelAsString": false
              }
            },
            "paddingValue": {
              "type": "integer",
              "description": "optional field, only be useful if FillNAMethod is set to Pad."
            }
          },
          "type": "object"
        },
        "source": {
          "type": "string",
          "description": "The blob link to the input data. It should be a zipped folder containing csv files. Each csv file should has two columns with header 'timestamp' and 'value' (case sensitive). The file name will be used as the variable name. Please refer to the sample data to prepare your own data accordingly.",
          "example": "https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D"
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "required field, start time of data to be used for generating multivariate anomaly detection model, should be date-time",
          "example": "2019-04-01T00:00:00Z"
        },
        "endTime": {
          "type": "string",
          "format": "date-time",
          "description": "required field, end time of data to be used for generating multivariate anomaly detection model, should be date-time",
          "example": "2019-04-02T00:00:00Z"
        },
        "displayName": {
          "type": "string",
          "description": "optional field, name of the model",
          "example": "DevOps-MultiAD",
          "maxLength": 24
        },
        "status": {
          "type": "string",
          "description": "Model training status.",
          "x-nullable": false,
          "x-ms-enum": {
            "name": "modelStatus",
            "modelAsString": false
          },
          "example": "READY",
          "enum": [
            "CREATED",
            "RUNNING",
            "READY",
            "FAILED"
          ],
          "readOnly": true
        },
        "errors": {
          "type": "array",
          "description": "Error message when fails to create a model.",
          "readOnly": true,
          "items": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "x-nullable": false,
                "description": "The error Code"
              },
              "message": {
                "type": "string",
                "x-nullable": false,
                "description": "A message explaining the error reported by the service."
              }
            },
            "type": "object"
          }
        },
        "diagnosticsInfo": {
          "properties": {
            "modelState": {
              "properties": {
                "epochIds": {
                  "type": "array",
                  "description": "Epoch id",
                  "example": [
                    10,
                    20,
                    30,
                    40,
                    50,
                    60,
                    70,
                    80,
                    90,
                    100
                  ],
                  "items": {
                    "type": "integer"
                  }
                },
                "trainLosses": {
                  "type": "array",
                  "example": [
                    0.62913280725479126,
                    0.16713269054889679,
                    0.12354248017072678,
                    0.10259664058685303,
                    0.095849275588989258,
                    0.090699523687362671,
                    0.086860164999961853,
                    0.086030229926109314,
                    0.082873545587062836,
                    0.082355380058288574
                  ],
                  "items": {
                    "type": "number"
                  }
                },
                "validationLosses": {
                  "type": "array",
                  "example": [
                    0.95734274387359619,
                    0.31822299957275391,
                    0.34026464819908142,
                    0.27653488516807556,
                    0.25740143656730652,
                    0.26928603649139404,
                    0.26372304558753967,
                    0.25908330082893372,
                    0.2597166895866394,
                    0.25973501801490784
                  ],
                  "items": {
                    "type": "number"
                  }
                },
                "latenciesInSeconds": {
                  "type": "array",
                  "example": [
                    0.3398594856262207,
                    0.3659665584564209,
                    0.37360644340515137,
                    0.35134077072143555,
                    0.33703041076660156,
                    0.31876277923583984,
                    0.32833099365234375,
                    0.35035872459411621,
                    0.30800247192382812,
                    0.3327946662902832
                  ],
                  "items": {
                    "type": "number"
                  }
                }
              },
              "type": "object"
            },
            "variableStates": {
              "type": "array",
              "example": [
                {
                  "variable": "ad_input",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "ad_on_timer_output",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "ingestion",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "data_in_speed",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "cpu",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "ad_series_init",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "F-Link_last_check_point_duration",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "data_out_speed",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                },
                {
                  "variable": "ad_output",
                  "filledNARatio": 0.0,
                  "effectiveCount": 1441,
                  "startTime": "2019-04-01T00:00:00Z",
                  "endTime": "2019-04-02T00:00:00Z",
                  "errors": []
                }
              ],
              "items": {
                "properties": {
                  "variable": {
                    "type": "string",
                    "description": "Variable name."
                  },
                  "filledNARatio": {
                    "type": "number",
                    "description": "Merged NA ratio of a variable.",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "effectiveCount": {
                    "type": "integer",
                    "description": "Effective time-series points count."
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start time of a variable"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End time of a variable"
                  },
                  "errors": {
                    "type": "array",
                    "description": "Error message when parse variable",
                    "items": {
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "x-nullable": false,
                          "description": "The error Code"
                        },
                        "message": {
                          "type": "string",
                          "x-nullable": false,
                          "description": "A message explaining the error reported by the service."
                        }
                      },
                      "type": "object"
                    }
                  }
                },
                "type": "object"
              }
            }
          },
          "type": "object",
          "readOnly": true,
          "description": "Used for deep analysis model and variables"
        }
      },
      "type": "object"
    }
  },
  "type": "object",
  "description": "Response of get model."
}

Response 500

Internal Server Error.

Response 404

Possible Errors:

  • ModelNotExist
    The model does not exist.

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

Response 405

Method Not Allowed.

Response 403

The certificate you provided is not accepted by server.

Code samples

@ECHO OFF

curl -v -X GET "https://*.cognitiveservices.azure.com/anomalydetector/v1.1-preview/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/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/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/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/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/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/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/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/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