An implementation of the AdaptiveInitialize algorithm for
matrix imputation for sparse matrices. At the moment the implementation
is only suitable for small matrices with on the order of thousands
of rows and columns at most.
Arguments
- X
A sparse matrix of
sparseMatrixclass. Explicit (observed) zeroes inXcan be dropped for- rank
Desired rank (integer) to use in the low rank approximation. Must be at least
2Land at most the rank ofX.- ...
Ignored.
- p_hat
The portion of
Xthat is observed. Defaults toNULL, in which casep_hatis set to the number of observed elements ofX. Primarily for internal use incitation_impute()or advanced users.- alpha_method
Either
"exact"or"approximate", defaulting to"exact"."exact"is computationally expensive and requires taking a complete SVD of matrix of sizenrow(X)xnrow(X), and matches theAdaptiveInitializealgorithm exactly."approximate"departs from theAdaptiveInitializationalgorithm to compute a truncated SVD of rankrank+additionalinstead of a complete SVD. This reduces computational burden, but the resulting estimates of singular-ish values will not be penalized as much as in theAdaptiveInitializealgorithm.- additional
Ignored except when
alpha_method = "approximate"in which case it controls the precise of the approximation toalpha. The approximate computation ofalphawill always understandalpha, but the approximation will be better for larger values ofadditional. We recommend makingadditionalas large as computationally tolerable.
Value
A low rank matrix factorization represented by an
adaptive_imputation() object.
Examples
mf <- adaptive_initialize(
ml100k,
rank = 3,
alpha_method = "approximate",
additional = 2
)
#> INFO [2025-05-02 19:14:27] Beginning AdaptiveInitialize.
#> INFO [2025-05-02 19:14:27] p_hat = 0.0630466936422453, non-zero entries = 100000, total entries = 1586126
#> INFO [2025-05-02 19:14:27] Calculating nuclear norm (slow step). Using approximate method.
#> INFO [2025-05-02 19:14:27] Approximating alpha using rank 5 approximation.
#> INFO [2025-05-02 19:14:27] Computation complete, alpha = 26.8743096027455
#> INFO [2025-05-02 19:14:27] lambda_hat = 10116.1988316315, 3785.64278402791, 3359.13438021896
mf
#>
#> Adaptively Imputed Low Rank Matrix Factorization
#> ------------------------------------------------
#>
#> Rank: 3
#>
#> Rows: 943
#> Cols: 1682
#>
#> d[rank]: 3359.134
#> alpha: 26.874
#>
#> Components
#>
#> u: 943 x 3 [matrix]
#> d: 3 [numeric]
#> v: 1682 x 3 [matrix]