Title: | Tensor Noise Reduction and Completion Methods |
---|---|
Description: | Efficient algorithms for tensor noise reduction and completion. This package includes a suite of parametric and nonparametric tools for estimating tensor signals from noisy, possibly incomplete observations. The methods allow a broad range of data types, including continuous, binary, and ordinal-valued tensor entries. The algorithms employ the alternating optimization. The detailed algorithm description can be found in the following three references. |
Authors: | Chanwoo Lee <[email protected]>, Miaoyan Wang <[email protected]> |
Maintainer: | Chanwoo Lee <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.0 |
Built: | 2024-12-09 06:35:09 UTC |
Source: | CRAN |
Optimize the weighted classification loss given a weight tensor, an observed data tensor, and a large margin loss. This function is used as a subroutine in the main function fit_nonparaT
.
Altopt(Ybar,W,r,type = c("logistic","hinge"),start = "linear")
Altopt(Ybar,W,r,type = c("logistic","hinge"),start = "linear")
Ybar |
A given (possibly noisy and incomplete) data tensor. |
W |
A weight tensor used in the weighted classification loss. |
r |
A rank to be fitted (CP rank). |
type |
A large margin loss to be used. Logistic or hinge loss is available. |
start |
Choice of initialization method. Use random initialization if |
The returned object is a list of components.
binary_obj
- Trajectory of binary loss values over iterations.
obj
- Trajectory of weighted classification loss values over iterations.
iter
- The number of iterations.
error
- Trajectory of errors over iterations.
fitted
- A tensor that optimizes the weighted classification loss.
C. Lee and M. Wang. Beyond the Signs: Nonparametric Tensor Completion via Sign Series. Neural Information Processing Systems 34 (NeurIPS), 2021.
library(tensorregress) indices = c(2,2,2) noise = rand_tensor(indices)@data Theta = array(runif(prod(indices),min=-3,max = 3),indices) # The signal plus noise model Y = Theta + noise # Optimize the weighted classification for given a sign tensor sign(Y) and a weight tensor abs(Y) result = Altopt(sign(Y),abs(Y),r = 3,type = "hinge",start = "linear") signTheta = sign(result$fitted)
library(tensorregress) indices = c(2,2,2) noise = rand_tensor(indices)@data Theta = array(runif(prod(indices),min=-3,max = 3),indices) # The signal plus noise model Y = Theta + noise # Optimize the weighted classification for given a sign tensor sign(Y) and a weight tensor abs(Y) result = Altopt(sign(Y),abs(Y),r = 3,type = "hinge",start = "linear") signTheta = sign(result$fitted)
Compute Bayesian Information Criterion (BIC) given a parameter tensor, an observed tensor, the dimension, and the rank based on cumulative logistic model. This BIC function is designed for selecting rank in the fit_ordinal
function.
bic(ttnsr,theta,omega,d,r)
bic(ttnsr,theta,omega,d,r)
ttnsr |
An observed tensor. |
theta |
A continuous-valued tensor (latent parameters). |
omega |
The cut-off points. |
d |
Dimension of the tensor. |
r |
Rank of the tensor. |
BIC value at given inputs based on cumulative logistic model.
Estimate a signal tensor from a noisy and incomplete data tensor using CP low rank tensor method.
fit_continuous_cp(data,r)
fit_continuous_cp(data,r)
data |
A given (possibly noisy and incomplete) data tensor. |
r |
A rank to be fitted (CP rank). |
The returned object is a list of components.
est
- An estimated signal tensor based on CP low rank tensor method.
U
- A list of factor matrices.
lambda
- A vector of tensor singular values.
library(tensorregress) indices = c(2,3,4) noise = rand_tensor(indices)@data Theta = array(runif(prod(indices),min=-3,max = 3),indices) # The signal plus noise model Y = Theta + noise # Estimate Theta from CP low rank tensor method hatTheta = fit_continuous_cp(Y,3) print(hatTheta$est)
library(tensorregress) indices = c(2,3,4) noise = rand_tensor(indices)@data Theta = array(runif(prod(indices),min=-3,max = 3),indices) # The signal plus noise model Y = Theta + noise # Estimate Theta from CP low rank tensor method hatTheta = fit_continuous_cp(Y,3) print(hatTheta$est)
Estimate a signal tensor from a noisy and incomplete data tensor using the Tucker model.
fit_continuous_tucker(ttnsr,r,alpha = TRUE)
fit_continuous_tucker(ttnsr,r,alpha = TRUE)
ttnsr |
A given (possibly noisy and incomplete) data 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.
# Latent parameters library(tensorregress) alpha = 10 A_1 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_2 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_3 = matrix(runif(10*2,min=-1,max=1),nrow = 10) 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_tucker(ttnsr,c(2,2,2),alpha = 10)
# Latent parameters library(tensorregress) alpha = 10 A_1 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_2 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_3 = matrix(runif(10*2,min=-1,max=1),nrow = 10) 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_tucker(ttnsr,c(2,2,2),alpha = 10)
Estimate a signal tensor from a noisy and incomplete data tensor using nonparametric tensor method via sign series.
fit_nonparaT(Y,truer,H,Lmin,Lmax,option = 2)
fit_nonparaT(Y,truer,H,Lmin,Lmax,option = 2)
Y |
A given (possibly noisy and incomplete) data tensor. The function allows both continuous- and binary-valued tensors. Missing value should be encoded as |
truer |
Sign rank of the signal tensor. |
H |
Resolution parameter. |
Lmin |
Minimum value of the signal tensor (or minimum value of the tensor Y). |
Lmax |
Maximum value of the signal tensor (or maximum value of the tensor Y). |
option |
A large margin loss to be used. Use logistic loss if |
The returned object is a list of components.
fitted
- A series of optimizers that minimize the weighted classification loss at each level.
est
- An estimated signal tensor based on nonparametic tensor method via sign series.
C. Lee and M. Wang. Beyond the Signs: Nonparametric Tensor Completion via Sign Series. Neural Information Processing Systems 34 (NeurIPS), 2021.
library(tensorregress) indices = c(2,2,2) noise = rand_tensor(indices)@data Theta = array(runif(prod(indices),min=-1,max = 1),indices) # The signal plus noise model Y = Theta + noise # Estimate Theta from nonparametic completion method via sign series hatTheta = fit_nonparaT(Y,truer = 1,H = 1,Lmin = -1,Lmax = 1, option =2) print(hatTheta$est)
library(tensorregress) indices = c(2,2,2) noise = rand_tensor(indices)@data Theta = array(runif(prod(indices),min=-1,max = 1),indices) # The signal plus noise model Y = Theta + noise # Estimate Theta from nonparametic completion method via sign series hatTheta = fit_nonparaT(Y,truer = 1,H = 1,Lmin = -1,Lmax = 1, option =2) print(hatTheta$est)
Estimate a signal tensor from a noisy and incomplete ordinal-valued tensor using the cumulative logistic model.
fit_ordinal(ttnsr,r,omega=TRUE,alpha = TRUE)
fit_ordinal(ttnsr,r,omega=TRUE,alpha = TRUE)
ttnsr |
A given (possibly noisy and incomplete) data tensor. The function allows binary- and ordinal-valued tensors. Missing value should be encoded as |
r |
A rank to be fitted (Tucker rank). |
omega |
The cut-off points if known,
|
alpha |
A signal level
|
A list containing the following:
C
- An estimated core tensor.
A
- Estimated factor matrices.
theta
- An estimated latent parameter tensor.
iteration
- The number of iterations.
cost
- Log-likelihood value at each iteration.
omega
- Estimated cut-off points.
C. Lee and M. Wang. Tensor denoising and completion based on ordinal observations. International Conference on Machine Learning (ICML), 2020.
# Latent parameters library(tensorregress) alpha = 10 A_1 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_2 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_3 = matrix(runif(10*2,min=-1,max=1),nrow = 10) 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 ordinal_est = fit_ordinal(ttnsr,c(2,2,2),omega = TRUE,alpha = 10)
# Latent parameters library(tensorregress) alpha = 10 A_1 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_2 = matrix(runif(10*2,min=-1,max=1),nrow = 10) A_3 = matrix(runif(10*2,min=-1,max=1),nrow = 10) 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 ordinal_est = fit_ordinal(ttnsr,c(2,2,2),omega = TRUE,alpha = 10)
Return log-likelihood function (cost function) value evaluated at a given parameter tensor, an observed tensor, and cut-off points.
likelihood(ttnsr,theta,omega,type = c("ordinal","Gaussian"))
likelihood(ttnsr,theta,omega,type = c("ordinal","Gaussian"))
ttnsr |
An observed tensor data. |
theta |
A continuous-valued tensor (latent parameters). |
omega |
The cut-off points. |
type |
Types of log-likelihood function.
|
Log-likelihood value at given inputs.
Predict ordinal-valued tensor entries given latent parameters and a type of estimations.
predict_ordinal(theta,omega,type = c("mode","mean","median"))
predict_ordinal(theta,omega,type = c("mode","mean","median"))
theta |
A continuous-valued tensor (latent parameters). |
omega |
The cut-off points. |
type |
Type of estimations:
|
A predicted ordinal-valued tensor given latent parameters and a type of estimations.
C. Lee and M. Wang. Tensor denoising and completion based on ordinal observations. International Conference on Machine Learning (ICML), 2020.
indices <- c(10,20,30) arr <- array(runif(prod(indices),-2,2),dim = indices) b <- c(-1.5,0,1.5) r_predict <- predict_ordinal(arr,b,type = "mode");r_predict
indices <- c(10,20,30) arr <- array(runif(prod(indices),-2,2),dim = indices) b <- c(-1.5,0,1.5) r_predict <- predict_ordinal(arr,b,type = "mode");r_predict
Simulate an ordinal-valued tensor from the cumulative logistic model with the parameter tensor and the cut-off points.
realization(theta,omega)
realization(theta,omega)
theta |
A continuous-valued tensor (latent parameters). |
omega |
The cut-off points. |
An ordinal-valued tensor randomly simulated from the cumulative logistic model.
C. Lee and M. Wang. Tensor denoising and completion based on ordinal observations. International Conference on Machine Learning (ICML), 2020.
indices <- c(10,20,30) arr <- array(runif(prod(indices)),dim = indices) b <- qnorm((1:3)/4) r_sample <- realization(arr,b);r_sample
indices <- c(10,20,30) arr <- array(runif(prod(indices)),dim = indices) b <- qnorm((1:3)/4) r_sample <- realization(arr,b);r_sample