[FEAT] Feat Include Undamaged Node Classification #98

Merged
nuluh merged 15 commits from feat/53-feat-include-undamaged-node-classification into dev 2025-06-18 02:06:04 +00:00
nuluh commented 2025-06-18 02:03:58 +00:00 (Migrated from github.com)

This pull request introduces several changes across multiple files to enhance functionality, improve accuracy, and streamline data processing for machine learning tasks. The most significant updates include adjustments to file paths, improvements to data visualization, and enhancements to include undamaged case data.

Configuration Updates:

  • .vscode/settings.json: Updated python.analysis.extraPaths to include ${workspaceFolder}/code/src for better module resolution.

Data Processing Enhancements:

  • code/src/process_stft.py: Changed damage_base_path to point to a new dataset directory (raw_B) and added a header row (sep=,) to the CSV export in process_damage_case. Also updated the range for multiprocessing to include damage case 0. [1] [2]
  • code/src/ml/model_selection.py: Modified create_ready_data to skip the first row of CSV files and added a new train_and_evaluate_model function to train models, evaluate accuracy, and optionally export them. [1] [2]

Visualization Improvements:

  • code/notebooks/stft.ipynb: Enhanced data visualization by:
    • Adjusting plot aesthetics (e.g., colors, gridlines, axis limits) for raw vibration signals.
    • Adding a 3D spectrogram plot for better frequency-time analysis.
    • Standardizing subplots with shared labels and a single color bar for STFT magnitude plots.

Machine Learning Updates:

  • code/notebooks/stft.ipynb: Improved model training and evaluation by:
    • Introducing pipelines for preprocessing (e.g., StandardScaler, PCA) and training SVM models. [1] [2]
    • Validating models on new datasets and exporting trained models for reuse.

Miscellaneous Fixes:

This pull request introduces several changes across multiple files to enhance functionality, improve accuracy, and streamline data processing for machine learning tasks. The most significant updates include adjustments to file paths, improvements to data visualization, and enhancements to include undamaged case data. ### Configuration Updates: * [`.vscode/settings.json`](diffhunk://#diff-a5de3e5871ffcc383a2294845bd3df25d3eeff6c29ad46e3a396577c413bf357L2-R5): Updated `python.analysis.extraPaths` to include `${workspaceFolder}/code/src` for better module resolution. ### Data Processing Enhancements: * [`code/src/process_stft.py`](diffhunk://#diff-2a8239ceac3be70c1ade04400cb34245b6627a0d35ef91aba540c1de1e30a8e8L9-R9): Changed `damage_base_path` to point to a new dataset directory (`raw_B`) and added a header row (`sep=,`) to the CSV export in `process_damage_case`. Also updated the range for multiprocessing to include damage case `0`. [[1]](diffhunk://#diff-2a8239ceac3be70c1ade04400cb34245b6627a0d35ef91aba540c1de1e30a8e8L9-R9) [[2]](diffhunk://#diff-2a8239ceac3be70c1ade04400cb34245b6627a0d35ef91aba540c1de1e30a8e8R108-R117) * [`code/src/ml/model_selection.py`](diffhunk://#diff-5622cfab30f7f218ab04cb181a44783759617b38fcd1ac92abaa48464e14020dL28-R30): Modified `create_ready_data` to skip the first row of CSV files and added a new `train_and_evaluate_model` function to train models, evaluate accuracy, and optionally export them. [[1]](diffhunk://#diff-5622cfab30f7f218ab04cb181a44783759617b38fcd1ac92abaa48464e14020dL28-R30) [[2]](diffhunk://#diff-5622cfab30f7f218ab04cb181a44783759617b38fcd1ac92abaa48464e14020dR58-R155) ### Visualization Improvements: * `code/notebooks/stft.ipynb`: Enhanced data visualization by: - Adjusting plot aesthetics (e.g., colors, gridlines, axis limits) for raw vibration signals. - Adding a 3D spectrogram plot for better frequency-time analysis. - Standardizing subplots with shared labels and a single color bar for STFT magnitude plots. ### Machine Learning Updates: * `code/notebooks/stft.ipynb`: Improved model training and evaluation by: - Introducing pipelines for preprocessing (e.g., `StandardScaler`, `PCA`) and training SVM models. [[1]](diffhunk://#diff-8d79bb7b4277999923c858dfe6ed3ff4ff4e85c1781c3b8075d102dd5bf8c860L649-R716) [[2]](diffhunk://#diff-8d79bb7b4277999923c858dfe6ed3ff4ff4e85c1781c3b8075d102dd5bf8c860L672-R744) - Validating models on new datasets and exporting trained models for reuse. ### Miscellaneous Fixes: * [`code/notebooks/stft.ipynb`](diffhunk://#diff-8d79bb7b4277999923c858dfe6ed3ff4ff4e85c1781c3b8075d102dd5bf8c860L856-R949): Corrected labels and confusion matrix calculations for SVM predictions to ensure consistency with the test dataset. [[1]](diffhunk://#diff-8d79bb7b4277999923c858dfe6ed3ff4ff4e85c1781c3b8075d102dd5bf8c860L856-R949) [[2]](diffhunk://#diff-8d79bb7b4277999923c858dfe6ed3ff4ff4e85c1781c3b8075d102dd5bf8c860L874-R974)
Sign in to join this conversation.