Anomaly Detector v1.1-preview.2

The Anomaly Detector service detects anomalies and trace root causes automatically 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 and establish a logic flow for root cause analysis.
  • 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.
  • Indicate root causes that contribute the most on an aggregated anomaly point. Accurate dimension can be drilled down for both one measure and multiple measures. Meaningful interpretation is also provided.

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

The Root Cause Analysis is currently available in:

  • West US 2 - westus2.api.cognitive.microsoft.com
  • Central US EUAP - ameuse2.api.cognitive.microsoft.com

Root Cause Analysis - Get Root Cause Analysis Training State

Query a training task state for root cause analysis

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

Open API testing console

Request URL

Request parameters

string

Instance unique id, should be a string of uuid.

string

Model unique id, should be a string of uuid.

Request headers

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

Request body

Response 200

Success

{
  "taskId": "11111111-1111-4444-4444-000000000000",
  "instanceId": "11111111-2222-3333-4444-000000000000",
  "modelId": "11223344-5555-6666-7777-000000000000",
  "displayName": "Sample Root Cause Analysis Model Name",
  "kind": "multidimensional",
  "status": "running",
  "createdDateTime": "2021-12-01T00:00:00.000Z",
  "lastModifiedDateTime": "2021-12-01T00:00:00.000Z",
  "error": {
    "message": "message",
    "code": "code"
  },
  "taskInfo": {
    "epoch": [
      20,
      40,
      60,
      80,
      100,
      120,
      140,
      160,
      180,
      200,
      220,
      240,
      260,
      280,
      300,
      320,
      340,
      360,
      380,
      400,
      420,
      440,
      460,
      480,
      500,
      520,
      540,
      560,
      580,
      600,
      620,
      640,
      660,
      680,
      700,
      720,
      740,
      760,
      780,
      800,
      820,
      840,
      860,
      880,
      900,
      920,
      940,
      960,
      980,
      1000
    ],
    "trainLoss": [
      0.8325032827466033,
      0.7073944557544797,
      0.6101156459298245,
      0.5659101830665455,
      0.5177869678929795,
      0.4654482311980669,
      0.40870095131009126,
      0.3514668279609015,
      0.2955649349578591,
      0.25747545704592106,
      0.23873877092156298,
      0.22432402209487073,
      0.21470268001390058,
      0.2062331327172213,
      0.2006967156085857,
      0.1954024662805158,
      0.19097534861675527,
      0.18560683761918267,
      0.1813279839102612,
      0.17815572785776715,
      0.17558324787505838,
      0.17261866705362186,
      0.17041692207025927,
      0.1683952596991561,
      0.16621614091618117,
      0.16426636850418047,
      0.16266696778840797,
      0.16078251756207887,
      0.15895445523566978,
      0.15715065243285756,
      0.15523631402919458,
      0.15330250275342963,
      0.15131563468034878,
      0.14978913815562114,
      0.14814715676529464,
      0.1467842848668265,
      0.14548044166592664,
      0.14425889593224192,
      0.14317956922012706,
      0.14206925008532612,
      0.14080655236923417,
      0.13971968783542169,
      0.1384463901956414,
      0.13731221048984416,
      0.1362589701663616,
      0.13498602400338927,
      0.133936385862356,
      0.1328846988116586,
      0.13182144646727761,
      0.13083573309488075
    ],
    "validationLoss": [
      0.8046117634386629,
      0.6824787629617227,
      0.590427951232807,
      0.5491459828776282,
      0.5033940866186812,
      0.4528899949950141,
      0.398870857986244,
      0.3440036507877144,
      0.29061700605057383,
      0.2525188785952491,
      0.2329737910547772,
      0.21707882389828964,
      0.2076707530666042,
      0.19886802781272578,
      0.19334230712942174,
      0.1887886540309803,
      0.18446499471728867,
      0.18088267501947042,
      0.17785984599912488,
      0.17490188334439252,
      0.17283097030343236,
      0.1701963564028611,
      0.1678417514304857,
      0.16603048467958295,
      0.16432733954610051,
      0.16222885089951591,
      0.16053574552407135,
      0.158960535719588,
      0.15682131052017212,
      0.15541817771421895,
      0.15379857050405965,
      0.15203679755732818,
      0.1504481068334064,
      0.14889185009775935,
      0.14756601283679138,
      0.14636472330705538,
      0.14524658749232422,
      0.14415936816383051,
      0.1431641717617576,
      0.1420247518532985,
      0.14099430071341024,
      0.13977679529705564,
      0.13865563434523506,
      0.1375677251332515,
      0.13632146510723475,
      0.13519782210524017,
      0.13408552553202654,
      0.13297473921163663,
      0.13181835614346168,
      0.13072216309405663
    ],
    "latencyInSecond": [
      2.9794609546661377,
      2.8904502391815186,
      2.889601707458496,
      2.891383647918701,
      2.990002155303955,
      2.8985159397125244,
      2.835184335708618,
      3.0599870681762695,
      2.887932538986206,
      2.892029285430908,
      2.961338996887207,
      2.9431045055389404,
      2.8739850521087646,
      2.841580867767334,
      3.1086373329162598,
      2.9573147296905518,
      2.8787951469421387,
      2.866332769393921,
      2.931384563446045,
      2.8280436992645264,
      2.8605258464813232,
      2.9251599311828613,
      2.85042405128479,
      2.802232503890991,
      2.868959903717041,
      2.9496920108795166,
      2.826801300048828,
      2.7866244316101074,
      2.966928482055664,
      2.8128082752227783,
      2.8418796062469482,
      2.9156594276428223,
      2.9037399291992188,
      2.8500704765319824,
      2.815321922302246,
      3.07879900932312,
      2.8846418857574463,
      2.7907776832580566,
      2.7885684967041016,
      2.91732120513916,
      2.8298709392547607,
      2.868971347808838,
      2.8566536903381348,
      2.912313222885132,
      2.8424553871154785,
      2.9499094486236572,
      2.9190526008605957,
      2.8731067180633545,
      2.840941905975342,
      2.95188570022583
    ],
    "bestEpoch": 1000,
    "bestValidationLoss": 0.13072216309405663,
    "nodeSize": [
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12,
      12
    ],
    "edgeSize": [
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17,
      17
    ]
  },
  "parameter": {
    "startDateTime": "2021-05-01T00:00:00.000Z",
    "endDateTime": "2021-09-01T00:00:00.000Z"
  }
}
{
  "required": [
    "createdDateTime",
    "displayName",
    "instanceId",
    "kind",
    "lastModifiedDateTime",
    "modelId",
    "status",
    "taskId"
  ],
  "type": "object",
  "properties": {
    "taskId": {
      "format": "uuid",
      "description": "Training task unique id for root cause analysis",
      "type": "string"
    },
    "instanceId": {
      "format": "uuid",
      "description": "Instance unique id for root cause analysis",
      "type": "string"
    },
    "modelId": {
      "format": "uuid",
      "description": "Model unique id for root cause analysis",
      "type": "string"
    },
    "displayName": {
      "description": "Model name for root cause analysis",
      "type": "string"
    },
    "kind": {
      "description": "kind of root cause analysis",
      "enum": [
        "multidimensional"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "RootCauseAnalysisType",
        "modelAsString": true
      }
    },
    "status": {
      "description": "Training task status for root cause analysis",
      "enum": [
        "scheduled",
        "running",
        "succeeded",
        "failed",
        "canceled"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "RootCauseAnalysisTrainingStatus",
        "modelAsString": true
      }
    },
    "createdDateTime": {
      "format": "date-time",
      "description": "Training task created date time (UTC)",
      "type": "string"
    },
    "lastModifiedDateTime": {
      "format": "date-time",
      "description": "Training task state modified date time (UTC)",
      "type": "string"
    },
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "description": "Human-readable error message",
          "type": "string"
        },
        "code": {
          "description": "Error code",
          "type": "string"
        }
      }
    },
    "taskInfo": {
      "description": "Training task information, if status is failed, this failed will not be shown"
    },
    "parameter": {
      "description": "Root cause analysis training parameter"
    }
  }
}

Response 400

Client error (4xx)

{
  "message": "string",
  "code": "string"
}
{
  "type": "object",
  "properties": {
    "message": {
      "description": "Human-readable error message",
      "type": "string"
    },
    "code": {
      "description": "Error code",
      "type": "string"
    }
  }
}

Response 500

Server error (5xx)

{
  "message": "string",
  "code": "string"
}
{
  "type": "object",
  "properties": {
    "message": {
      "description": "Human-readable error message",
      "type": "string"
    },
    "code": {
      "description": "Error code",
      "type": "string"
    }
  }
}

Code samples

@ECHO OFF

curl -v -X GET "https://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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('chinaeast2.api.cognitive.azure.cn')
    conn.request("GET", "/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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('chinaeast2.api.cognitive.azure.cn')
    conn.request("GET", "/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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://chinaeast2.api.cognitive.azure.cn/anomalydetector/v1.1-preview.2/rootCauseAnalysis/instances/{instanceId}/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