TRMF_columns: Add a column regularization model to TRMF object

View source: R/TRMF.R

TRMF_columnsR Documentation

Add a column regularization model to TRMF object

Description

Adds a regularization model to TRMF object created by create_TRMF() to constrain the fitting process of the coefficient matrix.

Usage

TRMF_columns(obj,
    reg_type = c("l2", "nnls", "constrain", "interval", "none"), lambda = 0.0001,mu0=NULL)

Arguments

obj

TRMF object created by create_TRMF()

reg_type

regularization type to apply when fitting TRMF model. l2 regularizes using an L2 function (see details), nnls forces coefficients to be non-negative. constrain constrains coefficients to be non-negative and to sum to 1. interval constrains coefficients to the interval [0-1]

lambda

L2 regularization parameter used for all regularization types. Can be a single value, a vector, or a matrix. If not a scalar, the dimension must match the number of rows of Fm. In a Bayesian framework, this is the inverse prior covariance for matrix coefficients. Note this value is not squared in the code.

mu0

The prior value for matrix coefficient. Can be a single value or vector. If not a scalar, the dimension must match the number of rows of Fm. If NULL it is set to zero. If external regressors are used these are included in Fm, so if lambda and mu0 are not scalars, they need to be arranged as: [column_xreg_parameters,global_xreg_parameters,Fm_parameters].

Details

This function doesn't do any computations, it just sets up regularization parameters for the coefficient matrix. This function should only be called once on a TRMF object. If called twice, it will overwrite previous model with a warning. In addition to the possible constraints, a possible L2 regularization term is added to the fit. The regularization term for each column i is (Fm_i - \mu_0)^TP(Fm_i - \mu_0) where P = \lambda I or P = diag(\lambda) or P = \lambda depending on the size of provided lambda. A nonzero value for lambda is recommended to ensure stability of fit.

Value

Returns an updated object of class TRMF.

Author(s)

Chad Hammerquist

References

Yu, Hsiang-Fu, Nikhil Rao, and Inderjit S. Dhillon. "High-dimensional time series prediction with missing values." arXiv preprint arXiv:1509.08333 (2015).

See Also

train.TRMF, create_TRMF, TRMF_trend

Examples


# create test data
xm = poly(x = (-10:10)/10,degree=4)
fm = matrix(abs(rnorm(40)),4,10)
Am = xm%*%fm+rnorm(210,0,.2)

# create model
obj = create_TRMF(Am)
obj = TRMF_columns(obj,reg_type ="nnls")
out = train(obj)
plot(out)



TRMF documentation built on June 22, 2024, 10:41 a.m.