Problem
A reload (intentional or accidental) wipes every trained model. Re-training a Random Forest on a 5 MB CSV takes 30-60 s — frustrating when it happens by mistake.
Proposal
After a successful train, serialise the `trainedModels` state (model ID, hyperparams, metrics, optionally the joblib bytes) to `localStorage` keyed by `(dataset_id, feature_set_hash)`. On page load, restore the metrics and let the user re-render charts without re-training.
Scope decisions
- Metrics + config are cheap to persist (a few KB) — do this in v1.
- Trained model bytes (joblib) can be large (MB-scale). Either skip them in v1 (re-train on demand) or persist behind a feature flag.
- Cap localStorage usage at ~5 MB; evict oldest entries when over.
Implementation notes
- New helpers `saveState()` / `loadState()` in `frontend/js/app.js`.
- A small "restored from previous session" toast on load when state is rehydrated.
- A "Clear cached models" button in settings.
Acceptance criteria
Problem
A reload (intentional or accidental) wipes every trained model. Re-training a Random Forest on a 5 MB CSV takes 30-60 s — frustrating when it happens by mistake.
Proposal
After a successful train, serialise the `trainedModels` state (model ID, hyperparams, metrics, optionally the joblib bytes) to `localStorage` keyed by `(dataset_id, feature_set_hash)`. On page load, restore the metrics and let the user re-render charts without re-training.
Scope decisions
Implementation notes
Acceptance criteria