flash_add_factors_from_data: Add factors to a flash object based on data

View source: R/add_from_data.R

flash_add_factors_from_dataR Documentation

Add factors to a flash object based on data

Description

Computes the current residuals from data and f_init and adds K new factors based on init_fn applied to these residuals. (If f_init is NULL then the residuals are the data.)

Usage

flash_add_factors_from_data(data, K, f_init = NULL, init_fn = "udv_si",
  backfit = TRUE, ...)

Arguments

data

An n by p matrix or a flash data object created using flash_set_data.

K

The number of factors to add.

f_init

The flash object or flash fit object to which new factors are to be added. If f_init = NULL, then a new flash object is created.

init_fn

The function used to initialize factors. Options include:

"udv_si"

Provides a simple wrapper to softImpute to provide a rank-one initialization. Uses option type = "als".

"udv_si_svd"

Uses softImpute with option type = "svd".

"udv_svd"

Provides a simple wrapper to svd.

"udv_random"

Provides a random initialization of factors.

A user-specified function can also be used. This function should take parameters (Y, K), where Y is an n by p matrix of data (or a flash data object) and K is the number of factors. It should output a list with elements (u, d, v), where u is a n by K matrix, v is a p by K matrix, and d is a K vector. (If the input data includes missing values, then the function must be able to deal with missing values in its input matrix.)

backfit

If TRUE, factors are refined via the backfitting algorithm.

...

Additional parameters to be passed to flash_backfit.


stephenslab/flashr documentation built on Jan. 31, 2024, 2:07 a.m.