Spaces:
Running
Running
File size: 4,351 Bytes
f381be8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | # Project Versioning & Structure
## Current Active Version: v2.0
All active models, artifacts, and features use the **v2.0** versioning scheme.
### Directory Structure
```
artifacts/
βββ v1/ β Legacy models (cross-battery split)
β βββ models/
β β βββ classical/
β β βββ deep/
β β βββ ensemble/
β βββ scalers/
β βββ figures/
β βββ results/
β βββ logs/
β βββ features/
β
βββ v2/ β Current production (intra-battery split) β
β βββ models/
β β βββ classical/ β 14 classical ML models
β β βββ deep/ β 8 deep learning models
β β βββ ensemble/ β Weighted ensemble
β βββ scalers/ β Feature scalers for linear models
β βββ figures/ β All validation visualizations (PNG, HTML)
β βββ results/ β CSV/JSON results and feature matrices
β βββ logs/ β Training logs
β βββ features/ β Feature engineering artifacts
```
### V2 Key Changes from V1
| Aspect | V1 | V2 |
|--------|----|----|
| **Data Split** | Cross-battery (groups of batteries) | Intra-battery chronological (first 80% cycles per battery) |
| **Train/Test Contamination** | β οΈ YES (same batteries in both) | β NO (different time periods per battery) |
| **Generalization** | Poor (batteries see same time periods) | Better (true temporal split) |
| **Test Realism** | Interpolation (within-cycle prediction) | Extrapolation (future cycles) |
| **Classical Models** | 6 standard models | 14 models (added ExtraTrees, GradientBoosting, KNN Γ3) |
| **Deep Models** | 8 models | Retraining in progress |
| **Ensemble** | RF + XGB + LGB (v1 trained) | RF + XGB + LGB (v2 trained when available) |
### Model Statistics
#### Classical Models (V2)
- **Total:** 14 models
- **Target Metric:** Within-Β±5% SOH accuracy β₯ 95%
- **Current Pass Rate:** See `artifacts/v2/results/v2_validation_report.html`
#### Configuration
**Active version is set in** `src/utils/config.py`:
```python
ACTIVE_VERSION: str = "v2"
```
**API defaults to v2:**
```python
registry = registry_v2 # Default registry (v2.0.0 models)
```
### Migration Checklist β
- β Created versioned artifact directories under `artifacts/v2/`
- β Moved all v2 models to `artifacts/v2/models/classical/` etc.
- β Moved all results to `artifacts/v2/results/`
- β Moved all figures to `artifacts/v2/figures/`
- β Moved all scalers to `artifacts/v2/scalers/`
- β Updated notebooks (NB03-09) to use `get_version_paths('v2')`
- β Updated API to default to v2 registry
- β Organized scripts into `scripts/data/`, `scripts/models/`
- β Moved tests to `tests/` folder
- β Cleaned up legacy artifact directories
### File Locations
| Content | Path |
|---------|------|
| Models (classical) | `artifacts/v2/models/classical/*.joblib` |
| Models (deep) | `artifacts/v2/models/deep/*.pth` |
| Models (ensemble) | `artifacts/v2/models/ensemble/*.joblib` |
| Scalers | `artifacts/v2/scalers/*.joblib` |
| Results CSV | `artifacts/v2/results/*.csv` |
| Feature matrix | `artifacts/v2/results/battery_features.csv` |
| Visualizations | `artifacts/v2/figures/*.{png,html}` |
| Logs | `artifacts/v2/logs/*.log` |
### Running Scripts
```bash
# Run v2 model validation test
python tests/test_v2_models.py
# Run quick prediction test
python tests/test_predictions.py
# Retrain classical models (WARNING: takes ~30 min)
python scripts/models/retrain_classical.py
# Generate/patch notebooks (one-time utilities)
python scripts/data/write_nb03_v2.py
python scripts/data/patch_dl_notebooks_v2.py
```
### Next Steps
1. β Verify v2 model accuracy meets thresholds
2. β Update research paper with v2 results
3. β Complete research notes for all notebooks
4. β Test cycle recommendation engine
5. Deploy v2 to production
### Version History
| Version | Date | Status | Notes |
|---------|------|--------|-------|
| v1.0 | 2025-Q1 | β Complete | Classical + Deep models, cross-battery split |
| v2.0 | 2026-02-25 | β Active | Intra-battery split, improved generalization |
| v3.0 | TBD | -- | Physics-informed models, uncertainty quantification |
|