r.search {eimpute}R Documentation

Search rank magnitude of the best approximating matrix

Description

Estimate a preferable matrix rank magnitude for fitting a low-rank matrix approximation to a matrix with missing values. The algorithm use GIC/CV to search the rank in a given range, and then fill the missing values with the estimated rank.

Usage

r.search(
  x,
  r.min = 1,
  r.max = "auto",
  svd.method = c("tsvd", "rsvd"),
  rule.type = c("gic", "cv"),
  noise.var = 0,
  init = FALSE,
  init.mat = 0,
  maxit.rank = 1,
  nfolds = 5,
  thresh = 1e-05,
  maxit = 100,
  override = FALSE,
  control = list(...),
  ...
)

Arguments

x

an m by n matrix with NAs.

r.min

the start rank for searching. Default r.min = 1.

r.max

the max rank for searching.

svd.method

a character string indicating the truncated SVD method. If svd.method = "rsvd", a randomized SVD is used, else if svd.method = "tsvd", standard truncated SVD is used. Any unambiguous substring can be given. Default svd.method = "tsvd".

rule.type

a character string indicating the information criterion rule. If rule.type = "gic", generalized information criterion rule is used, else if rule.type = "cv", cross validation is used. Any unambiguous substring can be given. Default rule.type = "gic".

noise.var

the variance of noise.

init

if init = FALSE(the default), the missing entries will initialize with mean.

init.mat

the initialization matrix.

maxit.rank

maximal number of iterations in searching rank. Default maxit.rank = 1.

nfolds

number of folds in cross validation. Default nfolds = 5.

thresh

convergence threshold, measured as the relative change in the Frobenius norm between two successive estimates.

maxit

maximal number of iterations.

override

logical value indicating whether the observed elements in x should be overwritten by its low-rank approximation.

control

a list of parameters that control details of standard procedure, See biscale.control.

...

arguments to be used to form the default control argument if it is not supplied directly.

Value

A list containing the following components

x.imp

the matrix after completion with the estimated rank.

r.est

the rank estimation.

rmse

the relative mean square error of matrix completion, i.e., training error.

iter.count

the number of iterations.

Examples

################# Quick Start #################
m <- 100
n <- 100
r <- 10
x_na <- incomplete.generator(m, n, r)
head(x_na[, 1:6])
x_impute <- r.search(x_na, 1, 15, "rsvd", "gic")
x_impute[["r.est"]]

[Package eimpute version 0.2.3 Index]