gromo.tools.compute_optimal_added_parameters#
- gromo.tools.compute_optimal_added_parameters(matrix_s: Tensor, matrix_n: Tensor, numerical_threshold: float = 1e-15, statistical_threshold: float = 0.001, maximum_added_neurons: int | None = None) tuple[Tensor, Tensor, Tensor] [source]#
Compute the optimal added parameters for a given layer.
- Parameters:
matrix_s (torch.Tensor in (s, s)) – square matrix S
matrix_n (torch.Tensor in (s, t)) – matrix N
numerical_threshold (float) – threshold to consider an eigenvalue as zero in the square root of the inverse of S
statistical_threshold (float) – threshold to consider an eigenvalue as zero in the SVD of S{-1/2} N
maximum_added_neurons (int | None) – maximum number of added neurons, if None all significant neurons are kept
- Returns:
optimal added weights alpha, omega and eigenvalues lambda
- Return type:
tuple[torch.Tensor, torch.Tensor, torch.Tensor] in (k, s) (t, k) (k,)