Spaces:
Sleeping
Sleeping
Reem commited on
Commit ·
9ee9101
1
Parent(s): f59e2bf
A4-report
Browse files- A4/A4_Classification.ipynb +1 -1
- A4/A4_Regression.ipynb +1 -1
- A4/report.ipynb +77 -4
A4/A4_Classification.ipynb
CHANGED
|
@@ -1290,7 +1290,7 @@
|
|
| 1290 |
"name": "python",
|
| 1291 |
"nbconvert_exporter": "python",
|
| 1292 |
"pygments_lexer": "ipython3",
|
| 1293 |
-
"version": "3.
|
| 1294 |
}
|
| 1295 |
},
|
| 1296 |
"nbformat": 4,
|
|
|
|
| 1290 |
"name": "python",
|
| 1291 |
"nbconvert_exporter": "python",
|
| 1292 |
"pygments_lexer": "ipython3",
|
| 1293 |
+
"version": "3.12.8"
|
| 1294 |
}
|
| 1295 |
},
|
| 1296 |
"nbformat": 4,
|
A4/A4_Regression.ipynb
CHANGED
|
@@ -1414,7 +1414,7 @@
|
|
| 1414 |
"name": "python",
|
| 1415 |
"nbconvert_exporter": "python",
|
| 1416 |
"pygments_lexer": "ipython3",
|
| 1417 |
-
"version": "3.
|
| 1418 |
}
|
| 1419 |
},
|
| 1420 |
"nbformat": 4,
|
|
|
|
| 1414 |
"name": "python",
|
| 1415 |
"nbconvert_exporter": "python",
|
| 1416 |
"pygments_lexer": "ipython3",
|
| 1417 |
+
"version": "3.12.8"
|
| 1418 |
}
|
| 1419 |
},
|
| 1420 |
"nbformat": 4,
|
A4/report.ipynb
CHANGED
|
@@ -95,6 +95,16 @@
|
|
| 95 |
"- pytest integrated into CI\n",
|
| 96 |
"- Tests run before deployment\n",
|
| 97 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
"### Git LFS support\n",
|
| 99 |
"- Models tracked using Git LFS\n",
|
| 100 |
"- Ensures version-controlled model artifacts\n",
|
|
@@ -267,6 +277,56 @@
|
|
| 267 |
"The current pipeline provides the foundation for these improvements.\n"
|
| 268 |
]
|
| 269 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
{
|
| 271 |
"cell_type": "code",
|
| 272 |
"execution_count": null,
|
|
@@ -276,11 +336,24 @@
|
|
| 276 |
}
|
| 277 |
],
|
| 278 |
"metadata": {
|
| 279 |
-
"
|
| 280 |
-
"
|
|
|
|
|
|
|
| 281 |
},
|
| 282 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
},
|
| 284 |
"nbformat": 4,
|
| 285 |
-
"nbformat_minor":
|
| 286 |
}
|
|
|
|
| 95 |
"- pytest integrated into CI\n",
|
| 96 |
"- Tests run before deployment\n",
|
| 97 |
"\n",
|
| 98 |
+
"\n",
|
| 99 |
+
"The implemented tests validate the full ML pipeline, including:\n",
|
| 100 |
+
"- Regression model loading\n",
|
| 101 |
+
"- Regression prediction functionality\n",
|
| 102 |
+
"- Classification model loading\n",
|
| 103 |
+
"- Classification prediction functionality\n",
|
| 104 |
+
"- Model artifact structure validation\n",
|
| 105 |
+
"- Error handling for incorrect inputs and failures\n",
|
| 106 |
+
"\n",
|
| 107 |
+
"\n",
|
| 108 |
"### Git LFS support\n",
|
| 109 |
"- Models tracked using Git LFS\n",
|
| 110 |
"- Ensures version-controlled model artifacts\n",
|
|
|
|
| 277 |
"The current pipeline provides the foundation for these improvements.\n"
|
| 278 |
]
|
| 279 |
},
|
| 280 |
+
{
|
| 281 |
+
"cell_type": "markdown",
|
| 282 |
+
"metadata": {},
|
| 283 |
+
"source": [
|
| 284 |
+
"## A4 – Classification Task\n",
|
| 285 |
+
"\n",
|
| 286 |
+
"Two datasets were merged into a single dataset containing 41 features (including movement angles and weak-link indicators). For each data point, the weakest link was identified by selecting the column with the maximum score.\n",
|
| 287 |
+
"\n",
|
| 288 |
+
"Initially, a 14-class classifier was used. An alternative approach was then explored by separating features into upper-body and lower-body regions, following lab guidance and feedback. Models were trained separately for body regions and then combined to evaluate performance improvements.\n",
|
| 289 |
+
"\n",
|
| 290 |
+
"- 5-fold cross-validation was applied \n",
|
| 291 |
+
"- Weighted averages were used due to class imbalance \n",
|
| 292 |
+
"\n",
|
| 293 |
+
"Body-region classification models tested:\n",
|
| 294 |
+
"- Logistic Regression \n",
|
| 295 |
+
"- LDA \n",
|
| 296 |
+
"- QDA \n",
|
| 297 |
+
"- Naive Bayes \n",
|
| 298 |
+
"- KNN (best performer with k = 7)\n",
|
| 299 |
+
"\n",
|
| 300 |
+
"For the 14-class weak-link classification:\n",
|
| 301 |
+
"- LDA performed best initially (F1 = 0.57)\n",
|
| 302 |
+
"\n",
|
| 303 |
+
"Following feedback, a two-step approach was tested:\n",
|
| 304 |
+
"1. Predict body region using KNN \n",
|
| 305 |
+
"2. Apply LDA for upper/lower classification \n",
|
| 306 |
+
"\n",
|
| 307 |
+
"This did not improve performance (F1 ≈ 0.54). \n",
|
| 308 |
+
"Applying Random Forest improved results:\n",
|
| 309 |
+
"\n",
|
| 310 |
+
"- Baseline (LDA): F1 = 0.57 \n",
|
| 311 |
+
"- After feedback adjustments: F1 = 0.54 \n",
|
| 312 |
+
"- Random Forest: F1 = 0.61 (best performance)\n",
|
| 313 |
+
"\n",
|
| 314 |
+
"The A4_Classification notebook extends A3 with these improvements.\n",
|
| 315 |
+
"\n",
|
| 316 |
+
"---\n",
|
| 317 |
+
"\n",
|
| 318 |
+
"## A4 – Regression Task\n",
|
| 319 |
+
"\n",
|
| 320 |
+
"The regression setup remains consistent with A2, with Random Forest introduced to improve performance.\n",
|
| 321 |
+
"\n",
|
| 322 |
+
"- Baseline model R²: 0.54 \n",
|
| 323 |
+
"- Random Forest R²: 0.65 \n",
|
| 324 |
+
"\n",
|
| 325 |
+
"This represents a direct improvement over the earlier regression pipeline.\n",
|
| 326 |
+
"\n",
|
| 327 |
+
"The A4_Regression notebook is an enhanced version of A2_ModelBuilding.ipynb, while A4_Classification extends A3 based on feedback and model experimentation.\n"
|
| 328 |
+
]
|
| 329 |
+
},
|
| 330 |
{
|
| 331 |
"cell_type": "code",
|
| 332 |
"execution_count": null,
|
|
|
|
| 336 |
}
|
| 337 |
],
|
| 338 |
"metadata": {
|
| 339 |
+
"kernelspec": {
|
| 340 |
+
"display_name": "Python 3 (ipykernel)",
|
| 341 |
+
"language": "python",
|
| 342 |
+
"name": "python3"
|
| 343 |
},
|
| 344 |
+
"language_info": {
|
| 345 |
+
"codemirror_mode": {
|
| 346 |
+
"name": "ipython",
|
| 347 |
+
"version": 3
|
| 348 |
+
},
|
| 349 |
+
"file_extension": ".py",
|
| 350 |
+
"mimetype": "text/x-python",
|
| 351 |
+
"name": "python",
|
| 352 |
+
"nbconvert_exporter": "python",
|
| 353 |
+
"pygments_lexer": "ipython3",
|
| 354 |
+
"version": "3.12.8"
|
| 355 |
+
}
|
| 356 |
},
|
| 357 |
"nbformat": 4,
|
| 358 |
+
"nbformat_minor": 4
|
| 359 |
}
|