flash_add_fixed_loadings: Add a set of fixed loadings to a flash fit object

View source: R/add_fixed.R

flash_add_fixed_loadingsR Documentation

Add a set of fixed loadings to a flash fit object

Description

Add a set of fixed loadings to a flash fit object

Usage

flash_add_fixed_loadings(data, LL, f_init = NULL, fixl = NULL,
  init_fn = "udv_si", backfit = TRUE, ...)

Arguments

data

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

LL

The loadings, an n by K matrix. Missing values will be initialized by the mean of the relevant column (but will generally be re-estimated when refitting the model).

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.

fixl

An n by K matrix of TRUE/FALSE values indicating which elements of LL should be considered fixed and not changed during updates. The default is to fix all non-missing values, so missing values will be updated when the flash object is updated.

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. Note that nullcheck defaults to FALSE here.

Value

A flash object, with loadings initialized from LL, and corresponding factors initialized to zero.


stephenslab/flashr2 documentation built on Feb. 6, 2024, 5:21 a.m.