Skip to content

Anomaly Detection Connector

The Anomaly Detection connector uses machine learning to detect anomalies in data streams.

Connector Type: MeddleAnomalyDetect

Algorithm: Isolation Forest

{
"type": "MeddleAnomalyDetect",
"config": {
"algorithm": "IsolationForest",
"parameterKeys": ["temperature", "pressure"],
"iforestConfig": {
"numTrees": 100,
"subsampleSize": 256,
"anomalyRatio": 0.05,
"retrainEvery": 50,
"windowSize": 1000
}
}
}
  • algorithm: IsolationForest (currently the only supported algorithm)
  • parameterKeys: Array of payload keys to analyze
  • iforestConfig: Isolation Forest specific configuration
  • numTrees: Number of trees in the forest (default: 100)
  • subsampleSize: Sample size for each tree (default: 256)
  • anomalyRatio: Expected ratio of anomalies (default: 0.05 = 5%)
  • retrainEvery: Retrain model every N samples (default: 50)
  • windowSize: Training window size (default: 1000)
  1. Training Phase: Collects initial data to build model
  2. Detection Phase: Scores new data points for anomalies
  3. Retraining: Periodically updates model with new data
  4. Output: Adds anomaly_score and is_anomaly to payload

Input:

{
"temperature": 25.5,
"pressure": 101.3
}

Output:

{
"temperature": 25.5,
"pressure": 101.3,
"anomaly_score": 0.42,
"is_anomaly": false
}

Anomaly detected:

{
"temperature": 95.0,
"pressure": 150.0,
"anomaly_score": 0.89,
"is_anomaly": true
}
  1. Predictive maintenance - Detect equipment anomalies before failure
  2. Quality control - Identify defective products
  3. Process monitoring - Detect unusual process behavior
  4. Security - Identify abnormal system behavior

Increase anomalyRatio and subsampleSize:

{
"anomalyRatio": 0.1,
"subsampleSize": 512
}

Decrease anomalyRatio and increase windowSize:

{
"anomalyRatio": 0.01,
"windowSize": 2000
}

Decrease retrainEvery:

{
"retrainEvery": 25
}
  1. Select relevant parameters - Only include meaningful metrics
  2. Allow training period - Model needs initial data to learn
  3. Tune anomaly ratio - Adjust based on your domain
  4. Monitor false positives - Adjust parameters if too many false alarms
  5. Combine with alerts - Use with Alert connector for notifications
OpcuaReader → AnomalyDetect → Trigger → Alert
InfluxDb2Writer
  1. Read sensor data
  2. Detect anomalies
  3. Trigger on is_anomaly == true
  4. Send alert and store in database