quantlab.model.torch_training.cs_zscore#
- quantlab.model.torch_training.cs_zscore(y)[source]#
Z-score of one bar’s
[S_t, L]labels, column by column.Subtracts the mean of the finite labels and divides by their sample standard deviation. NaN stays NaN; a column with fewer than two finite labels, or no spread, becomes NaN.
- Parameters:
- ytorch.Tensor
One bar’s labels,
[S_t, L].
- Returns:
- torch.Tensor
The standardised labels, same shape.
Examples
>>> cs_zscore(torch.tensor([[1.0], [3.0], [float("nan")]])) tensor([[-0.7071], [ 0.7071], [ nan]])