IoT Anomaly Detection & Predictive Maintenance

Model Description

This repository contains a 4-layer IoT anomaly detection and predictive maintenance pipeline trained on real industrial sensor data collected via MQTT protocol.

The system predicts machine health degradation and detects anomalies from IoT sensor readings in real-time, designed for integration with Oracle AI Agents and MQTT brokers.

Models in This Repository

File Model Type Purpose
rf_forecast_model.joblib Random Forest Regressor (300 trees) Predicts future machine health score (0–100)
scaler.joblib StandardScaler Feature normalization (must be applied before prediction)

Pipeline Architecture

Layer 1: Isolation Forest        β†’ Anomaly Detection & Scoring
Layer 2: Random Forest Regressor β†’ Machine Health Score (0–100)  
Layer 3: Rule-based Engine       β†’ Root Cause Explanation
Layer 4: RF Forecasting Model    β†’ Future Health Prediction + Time-to-Critical

Input Features

The forecasting model (rf_forecast_model.joblib) requires these 8 features, in exact order:

# Feature Description Unit
1 temp_celsius Temperature reading Β°C
2 high_temp_duration Consecutive steps above 75Β°C steps
3 thermal_stress_code 0=NORMAL, 1=HIGH, 2=CRITICAL categorical
4 degradation_rate Rate of health degradation (1–8x) multiplier
5 health_score Current machine health 0–100
6 health_delta Change in health since last reading points
7 light_value Ambient light sensor reading lux
8 anomaly_score Isolation Forest anomaly score float

How to Use

import joblib
import numpy as np
from huggingface_hub import hf_hub_download

# Download and load models directly from Hugging Face
model_path = hf_hub_download("HarshaMuralidharan04/iot-anomaly-detection", "rf_forecast_model.joblib")
scaler_path = hf_hub_download("HarshaMuralidharan04/iot-anomaly-detection", "scaler.joblib")

model = joblib.load(model_path)
scaler = joblib.load(scaler_path)

# Example: One machine reading
features = np.array([[
    72.5,   # temp_celsius
    3,      # high_temp_duration
    0,      # thermal_stress_code (NORMAL)
    1.0,    # degradation_rate
    85.2,   # health_score
    -0.5,   # health_delta
    210.0,  # light_value
    0.12    # anomaly_score
]])

# IMPORTANT: Always scale before predicting
features_scaled = scaler.transform(features)
predicted_future_health = model.predict(features_scaled)
print(f"Predicted health in 5 steps: {predicted_future_health[0]:.1f}/100")

Training Data

  • Source: Real MQTT sensor data from industrial IoT devices
  • Size: ~3,500+ timestamped sensor readings
  • Sensors: Temperature, Accelerometer (3-axis), Gyroscope (3-axis), Magnetometer (3-axis), Pressure, Humidity, Light
  • Split: 80% training / 20% test (time-aware split β€” no future data leakage)

Performance

Metric Forecasting Model
MAE (Mean Absolute Error) < 3.0 health points
RΒ² Score > 0.95
Training samples ~2,800
Test samples ~700

Intended Use

βœ… Intended for:

  • Industrial equipment health monitoring
  • Predictive maintenance scheduling
  • Real-time anomaly alerting via MQTT / Oracle AI Agents

β›” Not intended for:

  • Medical devices or safety-critical systems without additional validation
  • Consumer electronics (trained on industrial sensor ranges)

Authors

HarshaMuralidharan04 β€” IoT Anomaly Detection Project
Developed as part of an Oracle AI Agent + MQTT integration pipeline for industrial predictive maintenance.

License

MIT License β€” Free to use, modify, and distribute with attribution.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support