sim_data: Simulation of supervised tensor decomposition models

View source: R/tensor_regress.R

sim_dataR Documentation

Simulation of supervised tensor decomposition models

Description

Generate tensor data with multiple side information matrices under different simulation models, specifically for tensors with 3 modes

Usage

sim_data(
  seed = NA,
  whole_shape = c(20, 20, 20),
  core_shape = c(3, 3, 3),
  p = c(3, 3, 0),
  dist,
  dup,
  signal,
  block = rep(FALSE, 3),
  ortho = FALSE
)

Arguments

seed

a random seed for generating data

whole_shape

a vector containing dimension of the tensor

core_shape

a vector containing Tucker rank of the tensor decomposition

p

a vector containing numbers of side information on each mode, see "details"

dist

distribution of response tensor, see "details"

dup

number of simulated tensors from the same linear predictor

signal

a scalar controlling the max norm of the linear predictor

block

a vector containing boolean variables, see "details"

ortho

if "TRUE", generate side information matrices with orthogonal columns; if "FLASE" (default), generate side information matrices with gaussian entries

Details

By default non-positive entry in p indicates no covariate on the corresponding mode of the tensor.

dist specifies three distributions of response tensor: binary, poisson or normal distribution.

block specifies whether the coefficient factor matrix is a membership matrix, set to TRUE when utilizing the stochastic block model

Value

a list containing the following:

tsr a list of simulated tensors, with the number of replicates specified by dup

X_covar1 a matrix, side information on first mode

X_covar2 a matrix, side information on second mode

X_covar3 a matrix, side information on third mode

W a list of orthogonal factor matrices - one for each mode, with the number of columns given by core_shape

G an array, core tensor with size specified by core_shape

C_ts an array, coefficient tensor, Tucker product of G,A,B,C

U an array, linear predictor,i.e. Tucker product of C_ts,X_covar1,X_covar2,X_covar3

Examples

seed = 34
dist = 'binary'
data=sim_data(seed, whole_shape = c(20,20,20), core_shape=c(3,3,3),
p=c(5,5,5),dist=dist, dup=5, signal=4)

tensorregress documentation built on July 9, 2023, 7:23 p.m.