Add Confidence Levels
Configure confidence levels to control anomaly detection sensitivity.
Overview
Configure the confidence levels for historical anomaly detection. By default, any values that lie outside the 99% confidence interval are labeled as anomalies.
Adjusting the confidence level using the level parameter allows you to modify how many anomalies the system detects.
β’ Increasing the level(closer to 100) decreases the number of anomalies.
β’ Decreasing the level(closer to 0) increases the number of anomalies.
You can set any numeric value between 0 and 100 (including decimals) for the level parameter.
Key Concepts
Confidence Interval
The range of values within which a certain percentage of anomalies are expected to fall. A 99% interval (the default) means there is only a 1% chance of data lying outside this range.
API Key
An authentication token (often stored in your environment) that grants secure access to Nixtlaβs services.
Azure AI Models
If using Azure AI endpoints, you can specify different models (e.g., azureai
) for anomaly detection.
Step-by-Step Instructions
Install and Import
Make sure Nixtla is installed along with any required libraries such as pandas
.
Initialize the Client
Provide your Nixtla API key here if not already set in your environment variables.
(Optional) Use an Azure AI Endpoint
Configuration for Azure AI
Configuration for Azure AI
If you have an Azure AI endpoint, configure it by specifying the base_url
and api_key
:
Read Your Data
Load the time series data you want to analyze for anomalies.
Detect Anomalies
Adjust the level
to your desired confidence interval (0β100).
Visualize Results
Generate a plot showing which time points were flagged as anomalies.
Below is an example of the console logs you might see during anomaly detection:
Console Log Output
Console Log Output
Example Output
Anomalies detected with a 70% confidence interval
Available Models
Azure AI
Azure AI
If using Azure AI, set model="azureai"
when calling detect_anomalies
:
The public API supports two models: timegpt-1
(default) and timegpt-1-long-horizon
. For details on the latter, see the long horizon forecasting tutorial.
Learn More
To explore more in-depth tutorials and examples, see the Anomaly Detection Tutorial in the Nixtla documentation.