Tensor Regression with Stochastic Low-Rank Updates

Provides methods for low-rank tensor regression with tensor-valued predictors and scalar covariates. Model estimation is performed using stochastic optimization with random-walk updates for low-rank factor matrices. Computationally intensive components for coefficient estimation and prediction are implemented in C++ via 'Rcpp'. The package also includes tools for cross-validation and prediction error assessment.


TensorMCMC

TensorMCMC implements low-rank tensor regression for tensor predictors and scalar covariates using simple stochastic updates. It includes fast C++ routines for coefficient updates and prediction, and provides tools for cross-validation and error evaluation.

Installation

You can install the development version of TensorMCMC like so:

# FILL THIS IN! HOW CAN PEOPLE INSTALL YOUR DEV PACKAGE?

install.packages("devtools") 
devtools::install_github("Ritwick2012/TensorMCMC")

Example

This is a basic example which shows you how to solve a common problem:

library(TensorMCMC)
## basic example code

x.train <- array(rnorm(n*p*d), dim = c(n, p, d))
z.train <- matrix(rnorm(n*pgamma), n, pgamma)
y.train <- rnorm(n)

## Fit the tensor regression model
fit <- fit_tensor(x.train, z.train, y.train, rank = 2, nsweep = 50)

# Predict on training data
pred <- predict_tensor_reg(fit, x.train, z.train)

# Calculating RMSE
rmse_val <- rmse(pred, y.train)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("TensorMCMC")

0.1.0 by Ritwick Mondal, 9 months ago


Browse source code at https://github.com/cran/TensorMCMC


Authors: Ritwick Mondal [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, glmnet, stats

Suggests knitr, rmarkdown, testthat

Linking to Rcpp


See at CRAN