StatBaseline#

class ts2.models.single_session.StatBaseline[source]#

Bases: core.model.BaseModel

Shared skeleton for every statistical baseline.

Fits the per-unit mean rate and serves it as the default prediction, so a method that does not apply to the active task degenerates here instead of carrying its own fallback. MeanRate is that behaviour as a baseline in its own right; every other method overrides fit and predict. Outputs log-rates (B, T, N) for the Poisson NLL loss.

Not tested at any context_length other than the default (1.0); see Variable context.

input_fn(data)[source]#

Attached to the dataset transform pipeline by the trainer.

The target is built by IBLBrainWideBenchTS2._get_target, not here.

Return type:

dict

Build whatever the model sizes from the datasets.

Called before configure_readout(), so what is read here sizes the readout.

Parameters:
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, **model_inputs)[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

forward(spikes, **model_inputs)[source]#

Run the model on one collated batch.

Takes whatever input_fn() put under model_inputs, splatted in as keyword arguments, and returns what the trainer’s loss reads.

Return type:

Tensor