Skip to main content

Anomaly Detection

Soltix includes built-in anomaly detection applied as a post-processing step during queries. No separate service is required for statistical methods.

Available Detectors​

MethodDescriptionBest For
zscoreFlags points beyond N standard deviations from mean. Also detects flatlines.Normally distributed data
iqrFlags points outside [Q1 - k*IQR, Q3 + k*IQR]. Robust to outliers.Skewed distributions, data with many outliers
moving_avgCompares each point to a local windowed average.Trending or seasonal data
autoAnalyzes data characteristics and selects the best algorithm automatically.General use

Auto-Selection Logic​

The auto detector analyzes data characteristics:

ConditionSelected Algorithm
>5% outliersIQR
Strong trendMoving Average
Normal distributionZ-Score
Default fallbackIQR

Characteristics analyzed: IsNormalDistribution, HasTrend, TrendStrength, OutlierPercentage, Variability.

Anomaly Types​

TypeDescription
spikeSudden increase above threshold
dropSudden decrease below threshold
outlierValue outside expected range
flatlineNo variation for extended period

Usage in Queries​

Anomaly detection is configured directly in query parameters:

# Z-Score with threshold 2.5
curl "http://localhost:5555/v1/databases/mydb/collections/sensors/query?\
device_id=sensor-001&\
start_time=2026-01-01T00:00:00Z&\
end_time=2026-01-02T00:00:00Z&\
anomaly_detection=zscore&\
anomaly_threshold=2.5" \
-H "X-API-Key: your-api-key"

# Auto detection on a specific field
curl "http://localhost:5555/v1/databases/mydb/collections/sensors/query?\
device_id=sensor-001&\
start_time=2026-01-01T00:00:00Z&\
end_time=2026-01-02T00:00:00Z&\
anomaly_detection=auto&\
anomaly_field=temperature" \
-H "X-API-Key: your-api-key"

Parameters​

ParameterDefaultDescription
anomaly_detectionnonenone, zscore, iqr, moving_avg, auto
anomaly_threshold3.0Sensitivity (lower = more anomalies)
anomaly_field(all)Specific field to analyze (empty = all fields)

Configuration​

SettingDefaultDescription
Threshold3.0Number of std devs (zscore) or IQR multiplier
Window Size10Points in moving average window
Min Data Points10Minimum points required for detection

Response Format​

Anomalies are included in the query response:

{
"results": [...],
"anomalies": [
{
"timestamp": "2026-01-01T14:30:00Z",
"value": 95.2,
"type": "spike",
"field": "temperature",
"expected_range": { "min": 20.0, "max": 35.0 }
}
]
}

ML-Based Detection (soltix-ml)​

For advanced use cases, the optional soltix-ml Python service trains Random Forest and LSTM models per device×field combination. These models are exported as ONNX and uploaded to the Router for Go-side inference. See Forecasting for details on the ML service.