SFI.inference.sparse.greedy module¶
SFI.inference.sparse.greedy — Stepwise greedy selection¶
Classic forward / backward / bidirectional stepwise search.
Forward: at each step, add the feature that maximises the information gain.
Backward: start from the full model and drop the least useful feature.
Bidirectional: alternate one forward step then one backward step, keeping whichever direction improves the score.
The algorithm naturally produces exactly one support per cardinality (forward path) or a monotonic path from full to empty (backward), yielding a clean Pareto front.
- class SFI.inference.sparse.greedy.GreedyStepwiseStrategy(*, direction='forward', report_time=False)[source]¶
Bases:
SparsityStrategyForward / backward / bidirectional stepwise selection.
- Parameters:
direction (
"forward"|"backward"|"both", default"forward") –Which direction(s) to search.
"forward": start empty, add one feature at a time."backward": start full, drop one feature at a time."both": run both directions and merge the Pareto fronts.
report_time (bool, default False) – Log elapsed wall-clock time when done.
- name: str = 'greedy'¶
Short identifier used in
SparsityResult.method.
- run(scorer, *, max_k, **_kwargs)[source]¶
Execute the search and return a
SparsityResult.- Parameters:
scorer (SparseScorer) – Provides
info_and_coeffs/vmap_infofor evaluating candidate supports.max_k (int) – Maximum model size to explore.
- Return type: