Quickstart: Use the Anomaly Detector client library

Get started with the Anomaly Detector client library for .NET. Follow these steps to install the package start using the algorithms provided by the service. The Anomaly Detector service enables you to find abnormalities in your time series data by automatically using the best-fitting models on it, regardless of industry, scenario, or data volume.

Use the Anomaly Detector client library for .NET to:

  • Detect anomalies throughout your time series data set, as a batch request
  • Detect the anomaly status of the latest data point in your time series
  • Detect trend change points in your data set.

Library reference documentation | Library source code | Package (NuGet) | Find the code on GitHub

Prerequisites

  • Azure subscription - Create one for free
  • The current version of .NET Core
  • Once you have your Azure subscription, create an Anomaly Detector resource in the Azure portal to get your key and endpoint. Wait for it to deploy and click the Go to resource button.
    • You will need the key and endpoint from the resource you create to connect your application to the Anomaly Detector API. You'll paste your key and endpoint into the code below later in the quickstart. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

Setting up

Create an environment variable

Note

The endpoints for non-trial resources created after July 1, 2019 use the custom subdomain format shown below. For more information and a complete list of regional endpoints, see Custom subdomain names for Cognitive Services.

Using your key and endpoint from the resource you created, create two environment variables for authentication:

  • ANOMALY_DETECTOR_KEY - The resource key for authenticating your requests.
  • ANOMALY_DETECTOR_ENDPOINT - The resource endpoint for sending API requests. It will look like this:
    • https://<your-custom-subdomain>.api.cognitive.microsoft.com

Use the instructions for your operating system.

setx ANOMALY_DETECTOR_KEY <replace-with-your-anomaly-detector-key>
setx ANOMALY_DETECTOR_ENDPOINT <replace-with-your-anomaly-detector-endpoint>

After you add the environment variable, restart the console window.

Create a new .NET Core application

In a console window (such as cmd, PowerShell, or Bash), use the dotnet new command to create a new console app with the name anomaly-detector-quickstart. This command creates a simple "Hello World" project with a single C# source file: Program.cs.

dotnet new console -n anomaly-detector-quickstart

Change your directory to the newly created app folder. You can build the application with:

dotnet build

The build output should contain no warnings or errors.

...
Build succeeded.
 0 Warning(s)
 0 Error(s)
...

Install the client library

Within the application directory, install the Anomaly Detector client library for .NET with the following command:

dotnet add package Microsoft.Azure.CognitiveServices.AnomalyDetector

From the project directory, open the program.cs file and add the following using directives:

using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.CognitiveServices.AnomalyDetector;
using Microsoft.Azure.CognitiveServices.AnomalyDetector.Models;

In the application's main() method, create variables for your resource's Azure location, and your key as an environment variable. If you created the environment variable after application is launched, the editor, IDE, or shell running it will need to be closed and reloaded to access the variable.

static void Main(string[] args){
    //This sample assumes you have created an environment variable for your key and endpoint
    string endpoint = Environment.GetEnvironmentVariable("ANOMALY_DETECTOR_ENDPOINT");
    string key = Environment.GetEnvironmentVariable("ANOMALY_DETECTOR_KEY");
    string datapath = "request-data.csv";

    IAnomalyDetectorClient client = createClient(endpoint, key); //Anomaly Detector client

    Request request = GetSeriesFromFile(datapath); // The request payload with points from the data file

    EntireDetectSampleAsync(client, request).Wait(); // Async method for batch anomaly detection
    LastDetectSampleAsync(client, request).Wait(); // Async method for analyzing the latest data point in the set
    DetectChangePoint(client, request).Wait(); // Async method for change point detection

    Console.WriteLine("\nPress ENTER to exit.");
    Console.ReadLine();
}

Object model

The Anomaly Detector client is a AnomalyDetectorClient object that authenticates to Azure using ApiKeyServiceClientCredentials, which contains your key. The client can do anomaly detection on an entire dataset using EntireDetectAsync(), or on the latest data point using LastDetectAsync(). The ChangePointDetectAsync method detects points that mark changes in a trend.

Time series data is sent as a series of Points in a Request object. The Request object contains properties to describe the data (Granularity for example), and parameters for the anomaly detection.

The Anomaly Detector response is either an EntireDetectResponse, LastDetectResponse, or changePointDetectResponse object, depending on the method used.

Code examples

These code snippets show you how to do the following with the Anomaly Detector client library for .NET:

Authenticate the client

In a new method, instantiate a client with your endpoint and key. Create an ApiKeyServiceClientCredentials object with your key, and use it with your endpoint to create an AnomalyDetectorClient object.

static IAnomalyDetectorClient createClient(string endpoint, string key)
{
    IAnomalyDetectorClient client = new AnomalyDetectorClient(new ApiKeyServiceClientCredentials(key))
    {
        Endpoint = endpoint
    };
    return client;
}

Load time series data from a file

Download the example data for this quickstart from GitHub:

  1. In your browser, right-click Raw.
  2. Click Save link as.
  3. Save the file to your application directory, as a .csv file.

This time series data is formatted as a .csv file, and will be sent to the Anomaly Detector API.

Create a new method to read in the time series data and add it to a Request object. Call File.ReadAllLines() with the file path and create a list of Point objects, and strip any new line characters. Extract the values and separate the datestamp from its numerical value, and add them to a new Point object.

Make a Request object with the series of points, and Granularity.Daily for the Granularity (or periodicity) of the data points.

static Request GetSeriesFromFile(string path)
{
    List<Point> list = File.ReadAllLines(path, Encoding.UTF8)
        .Where(e => e.Trim().Length != 0)
        .Select(e => e.Split(','))
        .Where(e => e.Length == 2)
        .Select(e => new Point(DateTime.Parse(e[0]), Double.Parse(e[1]))).ToList();
    
    return new Request(list, Granularity.Daily); 
}

Detect anomalies in the entire data set

Create a method to call the client's EntireDetectAsync() method with the Request object and await the response as an EntireDetectResponse object. If the time series contains any anomalies, iterate through the response's IsAnomaly values and print any that are true. These values correspond to the index of anomalous data points, if any were found.

static async Task EntireDetectSampleAsync(IAnomalyDetectorClient client, Request request)
{
    Console.WriteLine("Detecting anomalies in the entire time series.");

    EntireDetectResponse result = await client.EntireDetectAsync(request).ConfigureAwait(false);

    if (result.IsAnomaly.Contains(true))
    {
        Console.WriteLine("An anomaly was detected at index:");
        for (int i = 0; i < request.Series.Count; ++i)
        {
            if (result.IsAnomaly[i])
            {
                Console.Write(i);
                Console.Write(" ");
            }
        }
        Console.WriteLine();
    }
    else
    {
        Console.WriteLine(" No anomalies detected in the series.");
    }
}

Detect the anomaly status of the latest data point

Create a method to call the client's LastDetectAsync() method with the Request object and await the response as a LastDetectResponse object. Check the response's IsAnomaly attribute to determine if the latest data point sent was an anomaly or not.

static async Task LastDetectSampleAsync(IAnomalyDetectorClient client, Request request)
{

    Console.WriteLine("Detecting the anomaly status of the latest point in the series.");
    LastDetectResponse result = await client.LastDetectAsync(request).ConfigureAwait(false);

    if (result.IsAnomaly)
    {
        Console.WriteLine("The latest point was detected as an anomaly.");
    }
    else
    {
        Console.WriteLine("The latest point was not detected as an anomaly.");
    }
}

Detect change points in the data set

Create a method to call the client's DetectChangePointAsync method with the Request object and await the response as a ChangePointDetectResponse object. Check the response's IsChangePoint values and print any that are true. These values correspond to trend change points, if any were found.

public async Task DetectChangePoint(IAnomalyDetectorClient client, Request request)
{
    Console.WriteLine("Detecting the change points in the series.");

    ChangePointDetectResponse result = await client.DetectChangePointAsync(request).ConfigureAwait(false);

    if (result.IsChangePoint.Contains(true))
    {
        Console.WriteLine("A change point was detected at index:");
        for (int i = 0; i < request.Series.Count; ++i)
        {
            if (result.IsChangePoint[i])
            {
                Console.Write(i);
                Console.Write(" ");
            }
        }
        Console.WriteLine();
    }
    else
    {
        Console.WriteLine("No change point detected in the series.");
    }
}

Run the application

Run the application with the dotnet run command from your application directory.

dotnet run

Clean up resources

If you want to clean up and remove a Cognitive Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with the resource group.

Next steps

Concepts:

Tutorials:

Get started with the Anomaly Detector client library for JavaScript. Follow these steps to install the package start using the algorithms provided by the service. The Anomaly Detector service enables you to find abnormalities in your time series data by automatically using the best-fitting models on it, regardless of industry, scenario, or data volume.

Use the Anomaly Detector client library for JavaScript to:

  • Detect anomalies throughout your time series data set, as a batch request
  • Detect the anomaly status of the latest data point in your time series
  • Detect trend change points in your data set.

Library reference documentation | Library source code | Package (npm) | Find the code on GitHub

Prerequisites

  • Azure subscription - Create one for free
  • The current version of Node.js
  • Once you have your Azure subscription, create an Anomaly Detector resource in the Azure portal to get your key and endpoint. Wait for it to deploy and click the Go to resource button.
    • You will need the key and endpoint from the resource you create to connect your application to the Anomaly Detector API. You'll paste your key and endpoint into the code below later in the quickstart. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

Setting up

Create an environment variable

Note

The endpoints for non-trial resources created after July 1, 2019 use the custom subdomain format shown below. For more information and a complete list of regional endpoints, see Custom subdomain names for Cognitive Services.

Using your key and endpoint from the resource you created, create two environment variables for authentication:

  • ANOMALY_DETECTOR_KEY - The resource key for authenticating your requests.
  • ANOMALY_DETECTOR_ENDPOINT - The resource endpoint for sending API requests. It will look like this:
    • https://<your-custom-subdomain>.api.cognitive.microsoft.com

Use the instructions for your operating system.

setx ANOMALY_DETECTOR_KEY <replace-with-your-anomaly-detector-key>
setx ANOMALY_DETECTOR_ENDPOINT <replace-with-your-anomaly-detector-endpoint>

After you add the environment variable, restart the console window.

Create a new Node.js application

In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app, and navigate to it.

mkdir myapp && cd myapp

Run the npm init command to create a node application with a package.json file.

npm init

Create a file named index.js and import the following libraries:

'use strict'

const fs = require('fs');
const parse = require("csv-parse/lib/sync");
const { AnomalyDetectorClient } = require('@azure/ai-anomaly-detector');
const { AzureKeyCredential } = require('@azure/core-auth');

Create variables your resource's Azure endpoint and key. If you created the environment variable after you launched the application, you will need to close and reopen the editor, IDE, or shell running it to access the variable. Create another variable for the example data file you will download in a later step, and an empty list for the data points. Then create a ApiKeyCredentials object to contain the key.

// Spreadsheet with 2 columns and n rows.
let CSV_FILE = './request-data.csv';

// Authentication variables
// Add your Anomaly Detector subscription key and endpoint to your environment variables.
let key = process.env['ANOMALY_DETECTOR_KEY'];
let endpoint = process.env['ANOMALY_DETECTOR_ENDPOINT'];

// Points array for the request body
let points = [];

Install the client library

Install the ms-rest-azure and azure-cognitiveservices-anomalydetector NPM packages. The csv-parse library is also used in this quickstart:

npm install @azure/ai-anomaly-detector @azure/ms-rest-js csv-parse

Your app's package.json file will be updated with the dependencies.

Object model

The Anomaly Detector client is an AnomalyDetectorClient object that authenticates to Azure using your key. The client can do anomaly detection on an entire dataset using entireDetect(), or on the latest data point using LastDetect(). The ChangePointDetectAsync method detects points that mark changes in a trend.

Time series data is sent as series of Points in a Request object. The Request object contains properties to describe the data (Granularity for example), and parameters for the anomaly detection.

The Anomaly Detector response is a LastDetectResponse, EntireDetectResponse, or ChangePointDetectResponse object depending on the method used.

Code examples

These code snippets show you how to do the following with the Anomaly Detector client library for Node.js:

Authenticate the client

Instantiate a AnomalyDetectorClient object with your endpoint and credentials.

let anomalyDetectorClient = new AnomalyDetectorClient(endpoint, new AzureKeyCredential(key));

Load time series data from a file

Download the example data for this quickstart from GitHub:

  1. In your browser, right-click Raw.
  2. Click Save link as.
  3. Save the file to your application directory, as a .csv file.

This time series data is formatted as a .csv file, and will be sent to the Anomaly Detector API.

Read your data file with the csv-parse library's readFileSync() method, and parse the file with parse(). For each line, push a Point object containing the timestamp, and the numeric value.

function readFile() {
    let input = fs.readFileSync(CSV_FILE).toString();
    let parsed = parse(input, { skip_empty_lines: true });
    parsed.forEach(function (e) {
        points.push({ timestamp: new Date(e[0]), value: parseFloat(e[1]) });
    });
}
readFile()

Detect anomalies in the entire data set

Call the API to detect anomalies through the entire time series as a batch with the client's entireDetect() method. Store the returned EntireDetectResponse object. Iterate through the response's isAnomaly list, and print the index of any true values. These values correspond to the index of anomalous data points, if any were found.

async function batchCall() {
    // Create request body for API call
    let body = { series: points, granularity: 'daily' }
    // Make the call to detect anomalies in whole series of points
    await anomalyDetectorClient.detectEntireSeries(body)
        .then((response) => {
            console.log("Batch (entire) anomaly detection):")
            for (let item = 0; item < response.isAnomaly.length; item++) {
                if (response.isAnomaly[item]) {
                    console.log("An anomaly was detected from the series, at row " + item)
                }
            }
        }).catch((error) => {
            console.log(error)
        })

}
batchCall()

Detect the anomaly status of the latest data point

Call the Anomaly Detector API to determine if your latest data point is an anomaly using the client's lastDetect() method, and store the returned LastDetectResponse object. The response's isAnomaly value is a boolean that specifies that point's anomaly status.

async function lastDetection() {

    let body = { series: points, granularity: 'daily' }
    // Make the call to detect anomalies in the latest point of a series
    await anomalyDetectorClient.detectLastPoint(body)
        .then((response) => {
            console.log("Latest point anomaly detection:")
            if (response.isAnomaly) {
                console.log("The latest point, in row " + points.length + ", is detected as an anomaly.")
            } else {
                console.log("The latest point, in row " + points.length + ", is not detected as an anomaly.")
            }
        }).catch((error) => {
            console.log(error)
        })
}
lastDetection()

Detect change points in the data set

Call the API to detect change points in the time series with the client's detectChangePoint() method. Store the returned ChangePointDetectResponse object. Iterate through the response's isChangePoint list, and print the index of any true values. These values correspond to the indices of trend change points, if any were found.

async function changePointDetection() {

    let body = { series: points, granularity: 'daily' }
    // get change point detect results
    await anomalyDetectorClient.detectChangePoint(body)
        .then((response) => {
            if (
                response.isChangePoint.some(function (changePoint) {
                    return changePoint === true;
                })
            ) {
                console.log("Change points were detected from the series at index:");
                response.isChangePoint.forEach(function (changePoint, index) {
                    if (changePoint === true) {
                        console.log(index);
                    }
                });
            } else {
                console.log("There is no change point detected from the series.");
            }
        }).catch((error) => {
            console.log(error)
        })
}

Run the application

Run the application with the node command on your quickstart file.

node index.js

Clean up resources

If you want to clean up and remove a Cognitive Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with the resource group.

Next steps

Concepts:

Tutorials:

Get started with the Anomaly Detector client library for Python. Follow these steps to install the package start using the algorithms provided by the service. The Anomaly Detector service enables you to find abnormalities in your time series data by automatically using the best-fitting models on it, regardless of industry, scenario, or data volume.

Use the Anomaly Detector client library for Python to:

  • Detect anomalies throughout your time series data set, as a batch request
  • Detect the anomaly status of the latest data point in your time series
  • Detect trend change points in your data set.

Library reference documentation | Library source code | Package (PyPi) | Find the sample code on GitHub

Prerequisites

  • Python 3.x
  • The Pandas data analysis library
  • Azure subscription - Create one for free
  • Once you have your Azure subscription, create an Anomaly Detector resource in the Azure portal to get your key and endpoint. Wait for it to deploy and click the Go to resource button.
    • You will need the key and endpoint from the resource you create to connect your application to the Anomaly Detector API. You'll paste your key and endpoint into the code below later in the quickstart. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

Setting up

Create an environment variable

Note

The endpoints for non-trial resources created after July 1, 2019 use the custom subdomain format shown below. For more information and a complete list of regional endpoints, see Custom subdomain names for Cognitive Services.

Using your key and endpoint from the resource you created, create two environment variables for authentication:

  • ANOMALY_DETECTOR_KEY - The resource key for authenticating your requests.
  • ANOMALY_DETECTOR_ENDPOINT - The resource endpoint for sending API requests. It will look like this:
    • https://<your-custom-subdomain>.api.cognitive.microsoft.com

Use the instructions for your operating system.

setx ANOMALY_DETECTOR_KEY <replace-with-your-anomaly-detector-key>
setx ANOMALY_DETECTOR_ENDPOINT <replace-with-your-anomaly-detector-endpoint>

After you add the environment variable, restart the console window.

Create a new python application

Create a new Python file and import the following libraries.

import os
from azure.ai.anomalydetector import AnomalyDetectorClient
from azure.ai.anomalydetector.models import DetectRequest, TimeSeriesPoint, TimeGranularity, \
    AnomalyDetectorError
from azure.core.credentials import AzureKeyCredential
import pandas as pd

Create variables for your key as an environment variable, the path to a time series data file, and the Azure location of your subscription. For example, westus2.

SUBSCRIPTION_KEY = os.environ["ANOMALY_DETECTOR_KEY"]
ANOMALY_DETECTOR_ENDPOINT = os.environ["ANOMALY_DETECTOR_ENDPOINT"]
TIME_SERIES_DATA_PATH = os.path.join("./sample_data", "request-data.csv")

Install the client library

After installing Python, you can install the client library with:

pip install --upgrade azure-ai-anomalydetector

Object model

The Anomaly Detector client is a AnomalyDetectorClient object that authenticates to Azure using your key. The client can do anomaly detection an entire dataset using detect_entire_series, or on the latest data point using detect_last_point. The detect_change_point function detects points that mark changes in a trend.

Time series data is sent as a series of TimeSeriesPoints object. The DetectRequest object contains properties to describe the data TimeGranularity for example, and parameters for the anomaly detection.

The Anomaly Detector response is a LastDetectResponse, EntireDetectResponse, or ChangePointDetectResponse object depending on the method used.

Code examples

These code snippets show you how to do the following with the Anomaly Detector client library for Python:

Authenticate the client

Add your Azure location variable to the endpoint, and authenticate the client with your key.

client = AnomalyDetectorClient(AzureKeyCredential(SUBSCRIPTION_KEY), ANOMALY_DETECTOR_ENDPOINT)

Load time series data from a file

Download the example data for this quickstart from GitHub:

  1. In your browser, right-click Raw.
  2. Click Save link as.
  3. Save the file to your application directory, as a .csv file.

This time series data is formatted as a .csv file, and will be sent to the Anomaly Detector API.

Load your data file with the Pandas library's read_csv() method, and make an empty list variable to store your data series. Iterate through the file, and append the data as a TimeSeriesPoint object. This object will contain the timestamp and numerical value from the rows of your .csv data file.

series = []
data_file = pd.read_csv(TIME_SERIES_DATA_PATH, header=None, encoding='utf-8', parse_dates=[0])
for index, row in data_file.iterrows():
    series.append(TimeSeriesPoint(timestamp=row[0], value=row[1]))

Create a DetectRequest object with your time series, and the TimeGranularity (or periodicity) of its data points. For example, TimeGranularity.daily.

request = DetectRequest(series=series, granularity=TimeGranularity.daily)

Detect anomalies in the entire data set

Call the API to detect anomalies through the entire time series data using the client's detect_entire_series method. Store the returned EntireDetectResponse object. Iterate through the response's is_anomaly list, and print the index of any true values. These values correspond to the index of anomalous data points, if any were found.

print('Detecting anomalies in the entire time series.')

try:
    response = client.detect_entire_series(request)
except AnomalyDetectorError as e:
    print('Error code: {}'.format(e.error.code), 'Error message: {}'.format(e.error.message))
except Exception as e:
    print(e)

if any(response.is_anomaly):
    print('An anomaly was detected at index:')
    for i, value in enumerate(response.is_anomaly):
        if value:
            print(i)
else:
    print('No anomalies were detected in the time series.')

Detect the anomaly status of the latest data point

Call the Anomaly Detector API to determine if your latest data point is an anomaly using the client's detect_last_point method, and store the returned LastDetectResponse object. The response's is_anomaly value is a boolean that specifies that point's anomaly status.

print('Detecting the anomaly status of the latest data point.')

try:
    response = client.detect_last_point(request)
except AnomalyDetectorError as e:
    print('Error code: {}'.format(e.error.code), 'Error message: {}'.format(e.error.message))
except Exception as e:
    print(e)

if response.is_anomaly:
    print('The latest point is detected as anomaly.')
else:
    print('The latest point is not detected as anomaly.')

Detect change points in the data set

Call the API to detect change points in the time series data using the client's detect_change_point method. Store the returned ChangePointDetectResponse object. Iterate through the response's is_change_point list, and print the index of any true values. These values correspond to the indices of trend change points, if any were found.

print('Detecting change points in the entire time series.')

try:
    response = client.detect_change_point(request)
except AnomalyDetectorError as e:
    print('Error code: {}'.format(e.error.code), 'Error message: {}'.format(e.error.message))
except Exception as e:
    print(e)

if any(response.is_change_point):
    print('An change point was detected at index:')
    for i, value in enumerate(response.is_change_point):
        if value:
            print(i)
else:
    print('No change point were detected in the time series.')

Run the application

Run the application with the python command and your file name.

Clean up resources

If you want to clean up and remove a Cognitive Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with the resource group.

Next steps

Concepts:

Tutorials:

In this quickstart, you learn how to detect anomalies in a batch of time series data using the Anomaly Detector service and cURL.

For a high-level look at Anomaly Detector concepts, see the overview article.

Prerequisites

  • Azure subscription - Create one for free
  • Once you have your Azure subscription, create an Anomaly Detector resource in the Azure portal to get your key and endpoint. Wait for it to deploy and select the Go to resource button.
    • You will need the key and endpoint address from the resource you create to use the REST API. You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

Detect anomalies for an entire series

At a command prompt, run the following command. You will need to insert the following values into the command.

  • Your Anomaly detector service subscription key.
  • Your Anomaly detector endpoint address.
  • A valid JSON file of time series data to test for anomalies. If you don't have your own file, you can create a sample.json file from the Request body sample.
curl -v -X POST "https://{endpointresourcename.cognitive.microsoft.com}/anomalydetector/v1.0/timeseries/entire/detect"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
-d "@{path_to_file.json}" 

For an example with all values populated:

curl -v -X POST "https://my-resource-name.cognitiveservices.azure.com/anomalydetector/v1.0/timeseries/entire/detect" -H  "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key:1111112222222ed333333ab333333333" -d "@test.json"

If you used the sample data from the pre-requisites, you should receive a response 200 with the following results:

{
  "expectedValues": [
    827.7940908243968,
    798.9133774671927,
    888.6058431807189,
    900.5606407986661,
    962.8389426378304,
    933.2591606306954,
    891.0784104799666,
    856.1781601363697,
    809.8987227908941,
    807.375129007505,
    764.3196682448518,
    803.933498594564,
    823.5900620883058,
    794.0905641334288,
    883.164245249282,
    894.8419000690953,
    956.8430591101258,
    927.6285055190114,
    885.812983784303,
    851.6424797402517,
    806.0927886943216,
    804.6826815312029,
    762.74070738882,
    804.0251702513732,
    825.3523662579559,
    798.0404188724976,
    889.3016505577698,
    902.4226124345937,
    965.867078532635,
    937.3200495736695,
    896.1720524711102,
    862.0087368413656,
    816.4662342097423,
    814.4297745524709,
    771.8614479159354,
    811.859271346729,
    831.8998279215521,
    802.947544797165,
    892.5684407435083,
    904.5488214533809,
    966.8527063844707,
    937.3168391003043,
    895.180003672544,
    860.3649596356635,
    814.1707285969043,
    811.9054862686213,
    769.1083769610742,
    809.2328084659704
  ],
  "upperMargins": [
    41.389704541219835,
    39.94566887335964,
    44.43029215903594,
    45.02803203993331,
    48.14194713189152,
    46.66295803153477,
    44.55392052399833,
    42.808908006818484,
    40.494936139544706,
    40.36875645037525,
    38.215983412242586,
    40.196674929728196,
    41.17950310441529,
    39.70452820667144,
    44.1582122624641,
    44.74209500345477,
    47.84215295550629,
    46.38142527595057,
    44.290649189215145,
    42.58212398701258,
    40.30463943471608,
    40.234134076560146,
    38.137035369441,
    40.201258512568664,
    41.267618312897795,
    39.90202094362488,
    44.46508252788849,
    45.121130621729684,
    48.29335392663175,
    46.86600247868348,
    44.80860262355551,
    43.100436842068284,
    40.82331171048711,
    40.721488727623544,
    38.593072395796774,
    40.59296356733645,
    41.5949913960776,
    40.14737723985825,
    44.62842203717541,
    45.227441072669045,
    48.34263531922354,
    46.86584195501521,
    44.759000183627194,
    43.01824798178317,
    40.70853642984521,
    40.59527431343106,
    38.45541884805371,
    40.46164042329852
  ],
  "lowerMargins": [
    41.389704541219835,
    39.94566887335964,
    44.43029215903594,
    45.02803203993331,
    48.14194713189152,
    46.66295803153477,
    44.55392052399833,
    42.808908006818484,
    40.494936139544706,
    40.36875645037525,
    38.215983412242586,
    40.196674929728196,
    41.17950310441529,
    39.70452820667144,
    44.1582122624641,
    44.74209500345477,
    47.84215295550629,
    46.38142527595057,
    44.290649189215145,
    42.58212398701258,
    40.30463943471608,
    40.234134076560146,
    38.137035369441,
    40.201258512568664,
    41.267618312897795,
    39.90202094362488,
    44.46508252788849,
    45.121130621729684,
    48.29335392663175,
    46.86600247868348,
    44.80860262355551,
    43.100436842068284,
    40.82331171048711,
    40.721488727623544,
    38.593072395796774,
    40.59296356733645,
    41.5949913960776,
    40.14737723985825,
    44.62842203717541,
    45.227441072669045,
    48.34263531922354,
    46.86584195501521,
    44.759000183627194,
    43.01824798178317,
    40.70853642984521,
    40.59527431343106,
    38.45541884805371,
    40.46164042329852
  ],
  "isAnomaly": [
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    true,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false
  ],
  "isPositiveAnomaly": [
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    true,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false
  ],
  "isNegativeAnomaly": [
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false
  ],
  "period": 12
}

For more information, see the Anomaly Detection REST reference.

Clean up resources

If you want to clean up and remove a Cognitive Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with the resource group.

Next steps

Concepts:

Tutorials: