Shrinkage#

class ts2.models.single_session.Shrinkage(alpha=None)[source]#

Bases: ts2.models.single_session.stat_baseline.base.StatBaseline

Trial-local / global rate blend, held flat over the horizon.

Parameters:

alpha (Optional[float]) – blend weight on the local rate (0 = per-unit mean, 1 = pure local observed mean). None selects on val over ALPHA_GRID.

fit(train_dataset, val_dataset)[source]#

Fit on train, select hyperparameters on val, and record val_score.

Subclasses pull what they need via _windows() or off the dataset. The mean rate needs neither, so this is a no-op and the default val_score already covers it (see MeanRate).

predict(spikes, **_)[source]#

Log-rates (B, T, N).

At test the held-out entries are already zeroed, so the observed population / past is exactly the non-masked data.

Return type:

Tensor