Description Usage Arguments Value Examples
View source: R/mainfunctions.R
Fit the Tucker model to a tensor with possibly missing values
1 | fit_continuous(ttnsr,r,alpha = TRUE)
|
ttnsr |
an observed tensor |
r |
a rank to be fitted (Tucker rank) |
alpha |
a signal level
|
a list containing the following:
C
- an estimated core tensor
A
- estimated factor matrices
iteration
- the number of iterations
cost
- log-likelihood value at each iteration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Latent parameters
library(rTensor)
alpha = 10
A_1 = matrix(runif(15*2,min=-1,max=1),nrow = 15)
A_2 = matrix(runif(15*2,min=-1,max=1),nrow = 15)
A_3 = matrix(runif(15*2,min=-1,max=1),nrow = 15)
C = as.tensor(array(runif(2^3,min=-1,max=1),dim = c(2,2,2)))
theta = ttm(ttm(ttm(C,A_1,1),A_2,2),A_3,3)@data
theta = alpha*theta/max(abs(theta))
adj = mean(theta)
theta = theta-adj
omega = c(-0.2,0.2)+adj
# Observed tensor
ttnsr <- realization(theta,omega)@data
# Estimation of parameters
continuous_est = fit_continuous(ttnsr,c(2,2,2),alpha = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.