acmtfr_gradient: Calculate gradient of ACMTF model.

View source: R/acmtfr_gradient.R

acmtfr_gradientR Documentation

Calculate gradient of ACMTF model.

Description

Calculate gradient of ACMTF model.

Usage

acmtfr_gradient(
  x,
  Z,
  Y,
  alpha = 1,
  beta = rep(0.001, length(Z$object)),
  epsilon = 1e-08,
  pi = 0.5,
  mu = 1e-06
)

Arguments

x

Vectorized parameters of the CMTF model.

Z

Z object as generated by setupCMTFdata().

Y

Dependent variable (regression part).

alpha

Alpha value of the loss function as specified by Acar et al., 2014

beta

Beta value of the loss function as specified by Acar et al., 2014

epsilon

Epsilon value of the loss function as specified by Acar et al., 2014

pi

Pi value of the loss function as specified by Van der Ploeg et al., 2025.

mu

Ridge term parameter for calculation of the regression coefficients rho (default = 1e-6).

Value

Vectorized gradient of the ACMTF regression model.

Examples

A = array(rnorm(108*2), c(108, 2))
B = array(rnorm(100*2), c(100, 2))
C = array(rnorm(10*2), c(10, 2))
D = array(rnorm(100*2), c(100,2))
E = array(rnorm(10*2), c(10,2))

df1 = reinflateTensor(A, B, C)
df2 = reinflateTensor(A, D, E)
datasets = list(df1, df2)
modes = list(c(1,2,3), c(1,4,5))
Z = setupCMTFdata(datasets, modes, normalize=FALSE)
Y = A[,1]

init = initializeACMTF(Z, 2, output="vect")
g = acmtfr_gradient(init, Z, Y)

CMTFtoolbox documentation built on Aug. 29, 2026, 1:07 a.m.