[Avg. reading time: 8 minutes]
Feature Engineering
Feature engineering is the process of transforming raw IoT sensor data into meaningful signals that machine learning models can understand.
Raw sensor data is:
- noisy
- incomplete
- difficult to interpret
Feature engineering converts it into:
- trends
- patterns
- changes over time
One-line takeaway
- Models don’t learn from raw data, they learn from engineered signals.
Why Feature Engineering is Critical in IoT
IoT data is fundamentally different from traditional datasets:
- continuous streams
- time-dependent
- affected by environment
Without feature engineering:
- models produce false alerts
- important patterns are missed
- predictions become unstable
Core Feature Types

1. Rolling / Window Features
Capture short-term behavior over a time window.
- rolling mean
- rolling standard deviation
- rolling min/max
Example
- average temperature over last 5 minutes
Purpose
- smooth noise
- identify stability vs fluctuation
| hr | temp |
|------|------|
| 1 | 20 |
| 2 | 21 |
| 3 | 35 |
| 4 | 22 |
Rolling Window (window = 2)
| hr | temp | rolling_mean_2 |
|----|------|----------------|
| 1 | 20 | 20 |
| 2 | 21 | 20.5 |
| 3 | 35 | 28 |
| 4 | 22 | 28.5 |
Rolling Window (window = 3)
| hr | temp | rolling_mean_3 |
|----|------|----------------|
| 1 | 20 | 20 |
| 2 | 21 | 20.5 |
| 3 | 35 | 25.3 |
| 4 | 22 | 26 |
window = 2 : current + previous value window = 3 : current + last 2 values
Small window shows spikes.
Large window smoothens the data.
2. Lag Features
Use past values of a signal.
- temp(t-1), temp(t-5), temp(t-10)
Purpose
- help models learn trends
- capture temporal dependencies
| hr | temp | lag_1 |
| -- | ---- | ----- |
| 1 | 20 | - |
| 2 | 21 | 20 |
| 3 | 35 | 21 |
| 4 | 22 | 35 |
3. Rate of Change (Delta)
Measure how fast a signal changes.
- temp(t) - temp(t-1)
- pressure change per second
Purpose
- detect sudden spikes
- highlight abnormal behavior
Raw Data
| hr | temp |
|------|------|
| 1 | 20 |
| 2 | 21 |
| 3 | 35 |
| 4 | 22 |
Feature Engineering
| hr | temp | rolling_mean | delta |
|------|------|--------------|-------|
| 1 | 20 | 20 | - |
| 2 | 21 | 20.5 | +1 |
| 3 | 35 | 25.3 | +14 |
| 4 | 22 | 26 | -13 |
Insight
- spike at hr=3
4. Aggregation Features
Summarize behavior over time.
- average over 10 minutes
- count of spikes
- max/min values
Purpose
- capture overall system behavior
5. Time-Based Features
Incorporate time context.
- hour of day
- day of week
Purpose
- capture seasonality patterns
6. Cross-Sensor Features
Combine multiple sensor readings.
- temperature + humidity
- pressure vs vibration
Purpose
- capture relationships between signals
- improve model accuracy
How Feature Engineering Connects to ML in IoT
Predictive Maintenance
- uses trends and long-term patterns
- detects gradual degradation
Anomaly Detection
- uses delta and rolling statistics
- identifies sudden spikes and instability
Classification
- uses patterns of behavior
- distinguishes device states (normal vs faulty)
Key Principle
Feature engineering bridges the gap between:
- raw sensor data
- intelligent ML decisions