als

systemds.operator.algorithm.als(X: Matrix, **kwargs: Dict[str, DAGNode | str | int | float | bool])

This script computes an approximate factorization of a low-rank matrix X into two matrices U and V using different implementations of the Alternating-Least-Squares (ALS) algorithm. Matrices U and V are computed by minimizing a loss function (with regularization).

Parameters:
  • X – Location to read the input matrix X to be factorized

  • rank – Rank of the factorization

  • regType – Regularization: “L2” = L2 regularization; f (U, V) = 0.5 * sum (W * (U %*% V - X) ^ 2) + 0.5 * reg * (sum (U ^ 2) + sum (V ^ 2)) “wL2” = weighted L2 regularization f (U, V) = 0.5 * sum (W * (U %*% V - X) ^ 2) + 0.5 * reg * (sum (U ^ 2 * row_nonzeros) + sum (V ^ 2 * col_nonzeros))

  • reg – Regularization parameter, no regularization if 0.0

  • maxi – Maximum number of iterations

  • check – Check for convergence after every iteration, i.e., updating U and V once

  • thr – Assuming check is set to TRUE, the algorithm stops and convergence is declared if the decrease in loss in any two consecutive iterations falls below this threshold; if check is FALSE thr is ignored

  • seed – The seed to random parts of the algorithm

  • verbose – If the algorithm should run verbosely

Returns:

An m x r matrix where r is the factorization rank

Returns:

An m x r matrix where r is the factorization rank