Views
No views yet
| Property | Value |
|---|---|
| Algorithm | Random Forest |
| Trees | 100 |
| Max Depth | 10 |
| Export Format | ONNX (opset 12) |
| Input Features | 3 (temperature, humidity, light) |
| Output Classes | 5 |
| Index | Label |
|---|---|
| 0 | Cloudy |
| 1 | Hot_Dry |
| 2 | Humid_Rainy |
| 3 | Night |
| 4 | Sunny |
1# Shape: [batch_size, 3] dtype: float32
2# Column order: [temperature_c, humidity_pct, light_lux_adc]
3import numpy as np
4sample = np.array([[35.0, 30.0, 900.0]], dtype=np.float32)1import onnxruntime as rt
2import numpy as np
3import joblib
4
5sess = rt.InferenceSession("weather_model.onnx")
6le = joblib.load("label_encoder.pkl")
7
8sample = np.array([[35.0, 30.0, 900.0]], dtype=np.float32)
9inp = {sess.get_inputs()[0].name: sample}
10pred = sess.run(None, inp)[0]
11label = le.inverse_transform(pred)[0]
12print(label) # → "Sunny"1# Replace sample values with live DHT-11 + LDR ADC readings
2sample = np.array([[temperature, humidity, light_adc]], dtype=np.float32)============================================================
WEATHER CLASSIFIER — TRAINING REPORT
============================================================
Model : RandomForestClassifier
Dataset : weather_dataset.csv
Features : ['temperature_c', 'humidity_pct', 'light_lux_adc']
Train samples : 4000
Test samples : 1000
Test Accuracy : 98.70%
CV Accuracy : 98.48% ± 0.17%
Classification Report:
precision recall f1-score support
Cloudy 1.00 1.00 1.00 200
Hot_Dry 0.97 0.97 0.97 200
Humid_Rainy 1.00 0.99 1.00 200
Night 1.00 1.00 1.00 200
Sunny 0.97 0.97 0.97 200
accuracy 0.99 1000
macro avg 0.99 0.99 0.99 1000
weighted avg 0.99 0.99 0.99 1000
Confusion Matrix:
[[200 0 0 0 0]
[ 0 194 0 0 6]
[ 0 0 199 1 0]
[ 0 0 0 200 0]
[ 0 6 0 0 194]]
Feature Importances:
temperature_c : 0.2821
humidity_pct : 0.4157
light_lux_adc : 0.3022
Hyperparameters:
n_estimators : 100
max_depth : 10
min_samples_leaf : 4
class_weight : balanced
random_state : 42
n_jobs : -1