Downloads · 30 days
0
HarshaMuralidharan04/iot-anomaly-detection
iot-anomaly-detection is a tabular regression model from HarshaMuralidharan04. Use it for the tabular regression task on the model card, and read the license before you ship it in a product. It is set up for sklearn. The card lists the license as mit.
This repository contains a 4-layer IoT anomaly detection and predictive maintenance pipeline trained on real industrial sensor data collected via MQTT protocol.
Downloads · 30 days
0
Access
Public
Updated Mar 9, 2026
Repo size
26 MB
Likes
1
Public
Click a slice to open those files.
.joblib26 MB · 100%
From the Hugging Face model README
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.
| 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) |
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
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 |
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")
| Metric | Forecasting Model |
|---|---|
| MAE (Mean Absolute Error) | < 3.0 health points |
| R² Score | > 0.95 |
| Training samples | ~2,800 |
| Test samples | ~700 |
✅ Intended for:
⛔ Not intended for:
HarshaMuralidharan04 — IoT Anomaly Detection Project
Developed as part of an Oracle AI Agent + MQTT integration pipeline for industrial predictive maintenance.
MIT License — Free to use, modify, and distribute with attribution.