braindecode.training.PostEpochTrainScoring#

class braindecode.training.PostEpochTrainScoring(scoring, lower_is_better=True, name=None, target_extractor=<function to_numpy>)[source]#

Epoch Scoring class that recomputes predictions after the epoch on the training in validation mode.

Note: For unknown reasons, this affects global random generator and therefore all results may change slightly if you add this scoring callback.

Parameters
  • scoring (None, str, or callable (default=None)) – If None, use the score method of the model. If str, it should be a valid sklearn scorer (e.g. “f1”, “accuracy”). If a callable, it should have the signature (model, X, y), and it should return a scalar. This works analogously to the scoring parameter in sklearn’s GridSearchCV et al.

  • lower_is_better (bool (default=True)) – Whether lower scores should be considered better or worse.

  • name (str or None (default=None)) – If not an explicit string, tries to infer the name from the scoring argument.

  • target_extractor (callable (default=to_numpy)) – This is called on y before it is passed to scoring.

Methods

on_epoch_end(net, dataset_train, dataset_valid, **kwargs)[source]#

Called at the end of each epoch.