validate_readout#

torchdyno.optim.ridge_regression.validate_readout(readout, eval_loader, score_fn, preprocess_fn=None, skip_first_n=0, device=None)[source]#

Evaluates the linear transformations on the validation data.

Parameters:
  • readout (Union[torch.Tensor, List[torch.Tensor]]) – list of readouts to validate.

  • eval_loader (DataLoader) – DataLoader of the validation data.

  • score_fn (Callable[[Tensor, Tensor], float]) – a Callable which, if applied to the predicted y_pred and the ground-truth y_true, returns the desired metric.

  • preprocess_fn (Optional[Callable], optional) – a transformation to be applied to X before the linear transformation. Useful whenever this function is called to learn a Readout of a ESN. Defaults to None.

  • skip_first_n (Optional[int], optional) – number of samples to skip in each batch of the train_loader. Defaults to None.

  • device (Optional[str], optional) – the device on which the function is executed. If None, the function is executed on a CUDA device if available, on CPU otherwise. Defaults to None.

Returns:

a list containing the metric values.

Return type:

List[float]