Anomaly Detection Quickstart.

Learn how to use the Brainrex anomaly detection API in Python

Welcome to the Anomaly Detection Quickstart Guide for the Brainrex API in Python! In this guide, you'll learn how to easily incorporate advanced time-series anomaly detection capabilities into your Python applications using the Brainrex API. With our API, you can quickly identify and resolve issues by analyzing time-series data of various types, utilizing the best anomaly detection algorithm customized to your particular dataset, ensuring unmatched precision. This guide will walk you through the steps of setting up your environment, making requests to the API, and visualizing the results. By the end of this guide, you'll have a solid understanding of how to use the Brainrex API for anomaly detection in Python and be ready to integrate it into your own applications. Let's get started!

from __future__ import print_function
import time
from pprint import pprint
import pandas as pd
import brainrex
from import ApiException
# Configure API key authorization: APIKeyHeader
configuration = brainrex.Configuration()
configuration.api_key['x-api-key'] = 'INSERT_API_KEY_HERE'
# create an instance of the API class
api_instance = brainrex.AnomalyApi(brainrex.ApiClient(configuration))

Download the examples Time Series data we provide. This dataset was extracted from the Coinbase PRO exchange using the Integrations API.

from brainrex.models import PointTimeSeries
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(brainrex.PointTimeSeries(timestamp=row[0], value=row[1]))
request = brainrex.TimeSeries() # TimeSeries | Time Series to be analyzed, with the following format. (optional)
    # Detects anomaly in historical data
    api_response = api_instance.anomaly_batch(request=series)
except ApiException as e:
    print("Exception when calling AnomalyApi->anomaly_batch: %s\n" % e)