ridge_regression
- torchhd.ridge_regression(samples: Tensor, labels: Tensor, alpha: float | None = 1)[source]
Compute weights (readout matrix) with ridge regression.
It is a common way to form classifiers within randomized neural networks see, e.g., Randomness in Neural Networks: An Overview.
- Parameters:
samples (Tensor) – The feature vectors.
labels (Tensor) – The target vectors, typically one-hot vectors for classification problems.
alpha (float, optional) – Scalar for the variance of the samples. Default is 1.
- Shapes:
Samples: \((n, d)\)
Labels: \((n, c)\)
Output: \((c, d)\)