StatBaseline#
- class ts2.models.single_session.StatBaseline[source]#
Bases:
core.model.BaseModelShared 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.
MeanRateis that behaviour as a baseline in its own right; every other method overridesfitandpredict. Outputs log-rates(B, T, N)for the Poisson NLL loss.Not tested at any
context_lengthother 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:
- link_datasets(train_dataset, val_dataset, test_dataset=None)[source]#
Build whatever the model sizes from the datasets.
Called before
configure_readout(), so what is read here sizes the readout.- Parameters:
train_dataset (
IBLBrainWideBenchTS2) – Training split, the one to size from.val_dataset (
IBLBrainWideBenchTS2) – Validation split.test_dataset (
Optional[IBLBrainWideBenchTS2]) – Test split, or None when the run scores none.
- 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 defaultval_scorealready covers it (seeMeanRate).
- 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:
- forward(spikes, **model_inputs)[source]#
Run the model on one collated batch.
Takes whatever
input_fn()put undermodel_inputs, splatted in as keyword arguments, and returns what the trainer’s loss reads.- Return type: