muhammadumar15 commited on
Commit
7bdf8ea
·
verified ·
1 Parent(s): 8abb20b

Add model_metadata.json

Browse files
Files changed (1) hide show
  1. model_metadata.json +342 -0
model_metadata.json ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "project": "BijliCast",
3
+ "task": "next-hour household electricity consumption regression",
4
+ "target": "next_hour_energy_kwh",
5
+ "selected_model": "Random Forest",
6
+ "selection_rule": "lowest validation MAE among tuned learned models",
7
+ "trained_at": "2026-11-21T16:52:54",
8
+ "hyperparameters": {
9
+ "n_estimators": 120,
10
+ "min_samples_leaf": 10,
11
+ "max_features": 0.7,
12
+ "max_depth": null
13
+ },
14
+ "n_train_rows": 336053,
15
+ "metrics": {
16
+ "train": {
17
+ "model": "Random Forest",
18
+ "split": "train",
19
+ "n": 336053,
20
+ "mae": 0.15364643635633426,
21
+ "rmse": 0.30384897327426746,
22
+ "r2": 0.8669788928223576,
23
+ "median_ae": 0.059860008045969186
24
+ },
25
+ "val": {
26
+ "model": "Random Forest",
27
+ "split": "val",
28
+ "n": 71995,
29
+ "mae": 0.32158659755369257,
30
+ "rmse": 0.5145050840674695,
31
+ "r2": 0.7604979504988251,
32
+ "median_ae": 0.1746636325615627
33
+ },
34
+ "test": {
35
+ "model": "Random Forest",
36
+ "split": "test",
37
+ "n": 72059,
38
+ "mae": 0.25345424527367144,
39
+ "rmse": 0.43221609172602676,
40
+ "r2": 0.7229038434080362,
41
+ "median_ae": 0.12908994329614198
42
+ }
43
+ },
44
+ "test_metrics_all_models": [
45
+ {
46
+ "model": "HistGradientBoosting",
47
+ "split": "test",
48
+ "n": 72059,
49
+ "mae": 0.24991966771469995,
50
+ "rmse": 0.42732973408172925,
51
+ "r2": 0.7291337699318039,
52
+ "median_ae": 0.12804274770489182,
53
+ "kind": "model"
54
+ },
55
+ {
56
+ "model": "Random Forest",
57
+ "split": "test",
58
+ "n": 72059,
59
+ "mae": 0.25345424527367144,
60
+ "rmse": 0.43221609172602676,
61
+ "r2": 0.7229038434080362,
62
+ "median_ae": 0.12908994329614198,
63
+ "kind": "model"
64
+ },
65
+ {
66
+ "model": "Linear Regression",
67
+ "split": "test",
68
+ "n": 72059,
69
+ "mae": 0.26014582567625566,
70
+ "rmse": 0.45945043218917586,
71
+ "r2": 0.6868834905728283,
72
+ "median_ae": 0.1254031668107266,
73
+ "kind": "model"
74
+ },
75
+ {
76
+ "model": "persistence_lag_1h",
77
+ "split": "test",
78
+ "n": 72059,
79
+ "mae": 0.27601666774176825,
80
+ "rmse": 0.5470484348300277,
81
+ "r2": 0.5561050566925392,
82
+ "median_ae": 0.09983638896666669,
83
+ "kind": "baseline"
84
+ },
85
+ {
86
+ "model": "KNN",
87
+ "split": "test",
88
+ "n": 72059,
89
+ "mae": 0.3177905452389684,
90
+ "rmse": 0.5195643307530298,
91
+ "r2": 0.5995878064090714,
92
+ "median_ae": 0.17409664101197514,
93
+ "kind": "model"
94
+ },
95
+ {
96
+ "model": "seasonal_naive_lag_24h",
97
+ "split": "test",
98
+ "n": 72059,
99
+ "mae": 0.3521703255305375,
100
+ "rmse": 0.641462706785323,
101
+ "r2": 0.38966052022609077,
102
+ "median_ae": 0.14296194443333332,
103
+ "kind": "baseline"
104
+ },
105
+ {
106
+ "model": "train_mean",
107
+ "split": "test",
108
+ "n": 72059,
109
+ "mae": 0.5458419025731248,
110
+ "rmse": 0.8476997620374911,
111
+ "r2": -0.06589091510286393,
112
+ "median_ae": 0.3508012736345758,
113
+ "kind": "baseline"
114
+ }
115
+ ],
116
+ "prediction_interval": {
117
+ "method": "validation residual 5th/95th percentile",
118
+ "train": {
119
+ "n": 336053,
120
+ "coverage": 0.9687460013747832,
121
+ "mean_width": 1.2845271515166554,
122
+ "low_offset": -0.7635695256844515,
123
+ "high_offset": 0.8648577771041299
124
+ },
125
+ "val": {
126
+ "n": 71995,
127
+ "coverage": 0.899993055073269,
128
+ "mean_width": 1.4840343242404106,
129
+ "low_offset": -0.7635695256844515,
130
+ "high_offset": 0.8648577771041299
131
+ },
132
+ "test": {
133
+ "n": 72059,
134
+ "coverage": 0.9350670977948625,
135
+ "mean_width": 1.4339672089949427,
136
+ "low_offset": -0.7635695256844515,
137
+ "high_offset": 0.8648577771041299
138
+ }
139
+ },
140
+ "features": [
141
+ "temperature",
142
+ "humidity",
143
+ "dew",
144
+ "precipitation",
145
+ "wind_speed",
146
+ "wind_direction",
147
+ "pressure",
148
+ "solar_radiation",
149
+ "wind_dir_sin",
150
+ "wind_dir_cos",
151
+ "lag_1h",
152
+ "lag_2h",
153
+ "lag_3h",
154
+ "lag_24h",
155
+ "lag_168h",
156
+ "rolling_mean_3h",
157
+ "rolling_mean_24h",
158
+ "rolling_std_24h",
159
+ "hour",
160
+ "day_of_week",
161
+ "month",
162
+ "is_weekend",
163
+ "No. of people (Temp+Perm)",
164
+ "No. of Adults (14-60)",
165
+ "No. of Children (0-13)",
166
+ "Property Area (Marla)",
167
+ "Covered Area",
168
+ "No of Floors",
169
+ "No. of rooms",
170
+ "Air Conditioners",
171
+ "Air Coolers",
172
+ "Refrigerators",
173
+ "Washing Machines",
174
+ "Celling Fans",
175
+ "Wall Fans",
176
+ "Water Pumps",
177
+ "Geysers",
178
+ "Electric heaters",
179
+ "UPS",
180
+ "Build year of house",
181
+ "city",
182
+ "Owner/Rented"
183
+ ],
184
+ "input_columns": [
185
+ "datetime",
186
+ "temperature",
187
+ "humidity",
188
+ "dew",
189
+ "precipitation",
190
+ "wind_speed",
191
+ "wind_direction",
192
+ "pressure",
193
+ "solar_radiation",
194
+ "lag_1h",
195
+ "lag_2h",
196
+ "lag_3h",
197
+ "lag_24h",
198
+ "lag_168h",
199
+ "rolling_mean_3h",
200
+ "rolling_mean_24h",
201
+ "rolling_std_24h",
202
+ "No. of people (Temp+Perm)",
203
+ "No. of Adults (14-60)",
204
+ "No. of Children (0-13)",
205
+ "Property Area (Marla)",
206
+ "Covered Area",
207
+ "No of Floors",
208
+ "No. of rooms",
209
+ "Air Conditioners",
210
+ "Air Coolers",
211
+ "Refrigerators",
212
+ "Washing Machines",
213
+ "Celling Fans",
214
+ "Wall Fans",
215
+ "Water Pumps",
216
+ "Geysers",
217
+ "Electric heaters",
218
+ "UPS",
219
+ "Build year of house",
220
+ "city",
221
+ "Owner/Rented"
222
+ ],
223
+ "n_features_after_transform": 49,
224
+ "splits": {
225
+ "ratios": [
226
+ 0.7,
227
+ 0.15,
228
+ 0.15
229
+ ],
230
+ "boundary_rule": "rows",
231
+ "boundaries": {
232
+ "val_start": "2024-06-30T01:00:00",
233
+ "test_start": "2024-08-28T11:00:00"
234
+ },
235
+ "rows_total_input": 480209,
236
+ "rows_purged_at_boundaries": 102,
237
+ "splits": {
238
+ "train": {
239
+ "rows": 336053,
240
+ "pct_of_total": 69.98,
241
+ "houses": 59,
242
+ "start": "2023-07-22T23:00:00",
243
+ "end": "2024-06-29T23:00:00",
244
+ "target_mean": 0.6255,
245
+ "target_std": 0.8331,
246
+ "target_min": 0.0,
247
+ "target_p25": 0.132,
248
+ "target_median": 0.3509,
249
+ "target_p75": 0.7446,
250
+ "target_max": 12.6618
251
+ },
252
+ "val": {
253
+ "rows": 71995,
254
+ "pct_of_total": 14.99,
255
+ "houses": 57,
256
+ "start": "2024-06-30T01:00:00",
257
+ "end": "2024-08-28T09:00:00",
258
+ "target_mean": 1.1206,
259
+ "target_std": 1.0513,
260
+ "target_min": 0.0,
261
+ "target_p25": 0.398,
262
+ "target_median": 0.7926,
263
+ "target_p75": 1.5544,
264
+ "target_max": 10.5553
265
+ },
266
+ "test": {
267
+ "rows": 72059,
268
+ "pct_of_total": 15.01,
269
+ "houses": 48,
270
+ "start": "2024-08-28T11:00:00",
271
+ "end": "2024-11-27T22:00:00",
272
+ "target_mean": 0.8363,
273
+ "target_std": 0.8211,
274
+ "target_min": 0.0,
275
+ "target_p25": 0.3216,
276
+ "target_median": 0.5889,
277
+ "target_p75": 1.081,
278
+ "target_max": 8.8678
279
+ }
280
+ }
281
+ },
282
+ "artifacts": {
283
+ "best_model": "models/best_model.joblib",
284
+ "deployment_model": "models/deployment_model.joblib",
285
+ "house_profiles": "models/house_profiles.csv",
286
+ "test_predictions": "models/best_test_predictions.parquet",
287
+ "best_model_note": "models/best_model.joblib is the validation-selected Random Forest, kept locally for report/metric alignment and git-ignored because it exceeds GitHub's 100 MB file limit."
288
+ },
289
+ "notes": "Random Forest won the validation MAE and is saved as best_model.joblib (train-fit). The deployed artifact is HistGradientBoosting: tied on validation within CV noise, best one-shot test MAE, ~2 MB, so it can be committed to GitHub and served by Streamlit Community Cloud. Test was evaluated once, after selection.",
290
+ "library_versions": {
291
+ "scikit-learn": "1.9.1",
292
+ "pandas": "3.0.3",
293
+ "numpy": "2.4.6",
294
+ "joblib": "1.6.0"
295
+ },
296
+ "deployment_model": {
297
+ "name": "HistGradientBoosting",
298
+ "artifact": "models/deployment_model.joblib",
299
+ "hyperparameters": {
300
+ "min_samples_leaf": 50,
301
+ "max_leaf_nodes": 31,
302
+ "max_iter": 400,
303
+ "learning_rate": 0.06,
304
+ "l2_regularization": 5.0
305
+ },
306
+ "n_train_rows": 408048,
307
+ "fit_data": "train + validation (test never used for fitting)",
308
+ "metrics_source": "Metrics come from the train-fit HGB evaluated on the validation and test splits. The served artifact is refit on train+val, so these are honest out-of-sample estimates for the same configuration, not a second test evaluation of the deployed artifact.",
309
+ "metrics": {
310
+ "test": {
311
+ "n": 72059,
312
+ "mae": 0.2499196677146999,
313
+ "rmse": 0.4273297340817292,
314
+ "r2": 0.7291337699318039,
315
+ "median_ae": 0.1280427477048918
316
+ },
317
+ "train": {
318
+ "n": 336053,
319
+ "mae": 0.1966049169393,
320
+ "rmse": 0.3666088509026793,
321
+ "r2": 0.806352941933694,
322
+ "median_ae": 0.0826135965610428
323
+ },
324
+ "val": {
325
+ "n": 71995,
326
+ "mae": 0.3272733923372525,
327
+ "rmse": 0.5156588687683774,
328
+ "r2": 0.7594225728192479,
329
+ "median_ae": 0.1847874257234266
330
+ }
331
+ },
332
+ "prediction_interval": {
333
+ "method": "train-fit HGB validation residual 5th/95th percentile",
334
+ "low_offset": -0.7815400353662822,
335
+ "high_offset": 0.8457557691512295,
336
+ "val_coverage": 0.899993055073269,
337
+ "test_coverage": 0.9379674988551049
338
+ },
339
+ "selection_rationale": "Random Forest had the best validation MAE by a statistically insignificant margin (0.3216 vs 0.3273, CV fold std ~0.067). HistGradientBoosting was chosen for deployment because it is tied on accuracy, has the best one-shot test MAE, and its artifact is ~2 MB instead of ~270 MB (GitHub rejects files >100 MB, and Streamlit Community Cloud deploys from GitHub).",
340
+ "size_mb": 1.429
341
+ }
342
+ }