]> Piment Noir Git Repositories - freqai-strategies.git/commit
refactor(quickadapter): migrate _*_set() lru_cache family to Final[frozenset] (#94)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 22 Jun 2026 01:21:28 +0000 (03:21 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2026 01:21:28 +0000 (03:21 +0200)
commitf888903a3669a66f5a20a3d354abd637ff45b3fd
tree35fe8fa1dae881aea3de47a74c61f60c8cea92cd
parent23334067d48b128b8304d8eb6174ba3b8a61b873
refactor(quickadapter): migrate _*_set() lru_cache family to Final[frozenset] (#94)

Each `@staticmethod @lru_cache(maxsize=None) _X_set()` family member
maps to a class-level `_X_SET: Final[frozenset[...]]` adjacent to its
backing tuple. Derived members express their content through set
algebra over the new `_*_SET` constants.

Pairs (deleted method -> added constant):

- `_extrema_selection_methods_set()` -> `_EXTREMA_SELECTION_METHODS_SET`
- `_custom_threshold_methods_set()` -> `_CUSTOM_THRESHOLD_METHODS_SET`
- `_skimage_threshold_methods_set()` -> `_SKIMAGE_THRESHOLD_METHODS_SET`
- `_threshold_methods_set()` -> `_THRESHOLD_METHODS_SET`
- `_optuna_namespaces_set()` -> `_OPTUNA_NAMESPACES_SET`
- `_optuna_hpo_samplers_set()` -> `_OPTUNA_HPO_SAMPLERS_SET`
- `_optuna_label_samplers_set()` -> `_OPTUNA_LABEL_SAMPLERS_SET`
- `_scaler_types_set()` -> `_SCALER_TYPES_SET`
- `_scipy_metrics_set()` -> `_SCIPY_METRICS_SET`
- `_unsupported_weights_metrics_set()` -> `_UNSUPPORTED_WEIGHTS_METRICS_SET`
- `_probability_distance_metrics_set()` -> `_PROBABILITY_DISTANCE_METRICS_SET`
- `_label_selection_distance_metrics_set()` -> `_LABEL_SELECTION_DISTANCE_METRICS_SET`
  (= `_DISTANCE_METRICS_SET - _PROBABILITY_DISTANCE_METRICS_SET`)
- `_distance_methods_set()` -> `_DISTANCE_METHODS_SET`
- `_selection_methods_set()` -> `_SELECTION_METHODS_SET`
- `_distance_metrics_set()` -> `_DISTANCE_METRICS_SET`
- `_density_aggregations_set()` -> `_DENSITY_AGGREGATIONS_SET`
- `_power_mean_metrics_set()` -> `_POWER_MEAN_METRICS_SET`
- `_aggregate_distance_metrics_set()` -> `_AGGREGATE_DISTANCE_METRICS_SET`
  (= `_DISTANCE_METRICS_SET - _SCIPY_METRICS_SET - _PROBABILITY_DISTANCE_METRICS_SET`)
- `_cluster_density_distance_metrics_set()` -> `_CLUSTER_DENSITY_DISTANCE_METRICS_SET`
  (= `_SCIPY_METRICS_SET - _PROBABILITY_DISTANCE_METRICS_SET`)

Call sites at `(cls|QuickAdapterRegressorV3)._X_set()` resolve to the
matching `_X_SET` reference. `optuna_samplers_by_namespace` returns
`tuple[frozenset[OptunaSampler], OptunaSampler]` to match the new
constant types. The surviving `@lru_cache(maxsize=8)` on
`optuna_samplers_by_namespace` falls outside the `_*_set` family and
stays in place.

Closes #89.
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py