LinearProbe#

class ts3.probes.LinearProbe(balanced=True, C=1.0, max_iter=1000)[source]#

Bases: ts3.probes.base.Probe

Multinomial logistic regression on standardized embeddings.

Parameters:
  • balanced (bool) – weight classes by inverse frequency.

  • C (float) – inverse regularization strength.

  • max_iter (int) – solver iteration cap.

fit_predict(train_embs, train_md, eval_embs, spec)[source]#

Fit on the pretrain units, return eval probabilities and what the fit learned.

The probabilities have shape (units, classes); the dict is whatever the fit is worth reporting about itself, empty for a probe with nothing to say.

Probabilities, not logits, and that is load-bearing: the multi-unit readout means neighbouring units together (ibl_bwb_eval.multi_unit.multi_unit_prediction()), and that rule is defined on probabilities. Columns follow spec.label_names; train_md is the TS3 unit table, so a probe that needs more than the region label (subject id, for a grouped split) reads it from there.

Return type:

tuple[ndarray, dict[str, Any]]