Serve /api/{version}/figures.json with normalized name/tags/location/url, load manifest in MetricsPanel, and render/search figures from manifest (name/tags/location) with fallback behavior. Add tests and generated v1/v2/v3 figure manifests under docs/figures.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Switch visualize metrics/figures to local-first with Hugging Face raw fallback, harden MetricsPanel hook usage/field handling, and refactor tests into feature-based folders with expanded API/router/data/model coverage. Add pytest config and dependency updates.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Root cause: v3 models trained with [FEATURE_COLS_SCALAR + capacity_retention,
cumulative_energy, dRe_dn, dRct_dn, soh_rolling_mean, voltage_slope] ordering,
NOT the CSV column order. soh_rolling_mean was a training feature (not excluded).
Changes:
- model_registry: add V3_FEATURE_COLS constant (18 features, correct order)
- model_registry: _load_feature_cols() returns V3_FEATURE_COLS for v3 (verified
against v3_features_standard.joblib scaler means)
- model_registry: _build_sequence_array() now TRUNCATES to n_feat when deep model
expects fewer features than registry feature_cols (v3 deep=12, registry=18)
- model_registry: predict() normalizes version to registry major (1.0.0/2.0.0/3.0.0)
- simulate: _build_feature_matrix builds 18-column X in registry.feature_cols order
- simulate: computes physics estimates for all 6 extra v3 features:
capacity_retention, cumulative_energy, dRe_dn, dRct_dn, soh_rolling_mean, voltage_slope
- All v3 models now predict correctly: RF R2=0.9814, X…
feat: v3 models - XGBoost R2=0.9866, GradientBoosting R2=0.9860 as default
Full source commit (clean history, no LFS):
- Models stored in HF Hub (NeerajCodz/aiBatteryLifeCycle), not in git
- Docker startup: download_models.py fetches from HF Hub before uvicorn
- simulate.py: vectorized ML prediction, batchable for all tree/ensemble models
- GraphPanel, MetricsPanel, RecommendationPanel: full dashboard rewrites
- lucide-react icons, recharts analytics, interactive controls
- BestEnsemble v2.6 (RF+XGB+LGB weighted), no v3 generation
- download_models.py: checks for 3 key component models (rf/xgb/lgb) not just sentinel