]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(quickadapter): stabilize label optuna selection (#81)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 21 Jun 2026 21:45:02 +0000 (23:45 +0200)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2026 21:45:02 +0000 (23:45 +0200)
commitadd1fb785a308ea27ad862dd87165770a2d499f0
treeaed56067e00937f511224ce39c9e0cb9e90fae8c
parent6727bd127a7b6d3ae6faf78c134a46a5b4054559
fix(quickadapter): stabilize label optuna selection (#81)

Multi-objective `label` Pareto best-trial selection in the
QuickAdapter regressor.

- Probability-style metrics (`jensenshannon`, `hellinger`,
  `shellinger`) rejected for `label_distance_metric` /
  `label_cluster_metric` / `label_density_metric` — Pareto objective
  matrices are unbounded floats, not probability vectors. Invalid
  values fall back to `euclidean` with a warning.
- Constant objective dimensions dropped before trial-distance
  computation: a constant objective dimension is non-informative and
  would bias the geometry. Tolerance at
  `_NON_CONSTANT_OBJECTIVE_ATOL: Final[float] = 1e-8`.
- User-supplied `label_weights` matching the original objective count
  slice to align with the non-constant subset; mismatched sizes flow
  to `_validate_label_weights(mode="raise")`.
- Deterministic best-trial tie-break by `(distance, trial.number)`,
  independent of `study.best_trials` ordering.
- All-constant Pareto front falls back to the lowest `trial.number`.
- Persisted Optuna `label` study user-attr `selection_metadata` nests
  `schema_version`
  (`_OPTUNA_LABEL_SELECTION_SCHEMA_VERSION: Final[int] = 1`) and
  `method_config`. Studies without a recorded `schema_version` are
  tagged at the current version on next `optuna_create_study` (trials
  preserved); studies recording a different version are reset. The
  `selection_metadata` write is idempotent: skipped when unchanged,
  warned on diff.
- `OptunaNamespace` Literal and `_OPTUNA_NAMESPACES` (a `NamedTuple`
  of `hp` and `label` with per-field literal types) live in `Utils`,
  with `.hp` / `.label` accessors at all call sites
  (`QuickAdapterRegressorV3`, `QuickAdapterV3`). No per-class tuple
  alias, no inline `# "hp"` / `# "label"` annotations.

`config-template.json` sets `label_distance_metric: "euclidean"`.
README.md
quickadapter/user_data/config-template.json
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py