SFI.inference.sparse.beam module

class SFI.inference.sparse.beam.BeamSearchStrategy(*, beam_width=20, aic_patience=2, report_time=False)[source]

Bases: SparsityStrategy

Bidirectional beam search over the support lattice.

Parameters:
  • beam_width (int, default 20) – Maximum number of candidate models retained per cardinality.

  • aic_patience (int, default 2) – Stop early when AIC has strictly declined for this many consecutive closed cardinality levels.

  • report_time (bool, default False) – If True, log elapsed time and number of explored supports.

name: str = 'beam'

Short identifier used in SparsityResult.method.

run(scorer, *, max_k, init_supports=None, **_kwargs)[source]

Execute the beam search.

Parameters:
  • scorer (SparseScorer)

  • max_k (int) – Maximum model size to consider.

  • init_supports (list of tuples of int, optional) – Seed supports to inject into the initial frontier. Each entry is a tuple of basis-function indices. Useful for seeding the search with a known good model (e.g. the true support) so that the Pareto front is guaranteed to include it.

Return type:

SparsityResult