maxfuse.utils.robust_svd

maxfuse.utils.robust_svd(arr, n_components, randomized=False, n_runs=1)[source]

Do deterministic or randomized SVD on arr.

Parameters:
  • arr (np.array) – The array to do SVD on

  • n_components (int) – Number of SVD components

  • randomized (bool, default=False) – Whether to run randomized SVD

  • n_runs (int, default=1) – Run multiple times and take the realization with the lowest Frobenious reconstruction error

Returns:

u, s, vh (np.array) – u @ np.diag(s) @ vh is the reconstruction of the original arr