Learn R Programming

BaTFLED3D

Bayesian Tensor Factorization Linked to External Data in three dimensions

BaTFLED is a machine learning algorithm designed to make predictions and determine interactions in data that varies along three independent modes. For example BaTFLED was developed to predict the growth of cell lines when treated with drugs at different doses. The first mode corresponds to cell lines and incorporates predictors such as cell line genomics and growth conditions. The second mode corresponds to drugs and incorporates predictors indicating known targets and structural features. The third mode corresponds to dose and there are no dose-specific predictors (although the algorithm is capable of including predictors for the third mode if present).

BaTFLED assumes a generative model where matrices of predictors are multiplied through projection matrices to form latent representations of the input data. These latent representations vectors are analogous to principal component vectors. Matrices containing the latent vectors are combined to form the response tensor which, in this case, are measures of the growth of cell lines after treatment with different drugs at different doses.

The algorithm learns distributions on values in the projection matrices and latent matrices using a Bayesian framework. Prior distributions on the projection matrices can encourge a sparse representation of the input data. Values in the model are learned through variational approximation which maximizes a lower bound on the posterior likelihood by iteratively updating values in the model. This process is deterministic given a random initialization and update ordering.

Model diagram

Running BaTFLED on a simulated dataset

Please see the Rmarkdown vignette 'vignettes/BaTFLED3D_vignette.html'.

Installation

install.packages('BaTFLED3D_0.1.13.tar.gz', repos = NULL, type="source")
library(BaTFLED3D)

Copy Link

Version

Install

install.packages('BaTFLED3D')

Monthly Downloads

13

Version

0.2.11

License

MIT + file LICENSE

Maintainer

Nathan Lazar

Last Published

October 6th, 2017

Functions in BaTFLED3D (0.2.11)

get_model_params

Get parameters to build a BaTFLED model
im_2_mat

Plot heatmaps of two matrices in red and blue
im_mat

Plot a heatmap of a matrix in red and blue
input_data

Object storing input data for BaTFLED algorithm with 3-D response tensor.
CP_model

BaTFLED model object for 3-D response tensor with CP decomposition.
Tucker_model

Factorization object for 3D Tucker models.
get_data_params

Get parameters for building a model with known relationships
get_influence

Given a model object, rank the input predictors (and combinations thereof) by thier influence on the output
diagonal

Version of diag that has more consistent behavior
exp_var

Get the explained variance for a set of predictions
lower_bnd_Tucker

Calculate the lower bound of the log likelihood for a trained Tucker model
mk_model

Make a new model object
rmse

Updates the root mean squared error for training data. Predicting both from data and from just the latent (H) matrices.
rot

Rotate a matrix for printing
mk_toy

Make a toy dataset to test the 3d BaTFLED model.
mult_3d

Multiply three matrices (or vectors) through a given core tensor to form a three dimensional tensor.
test_CP

Perform 'cold start' prediction using BaTFLED algorthm for CP models
test_Tucker

Perform 'cold start' prediction for Tucker models
train_CP

Train a CP model.
train_Tucker

Train a Tucker model using BaTFLED algorthm
plot_roc

Plot reciever operating characteristic (ROC) curves for two projection (A) matrices
plot_test_RMSE

Plot RMSE results from test data
show_mat

Plot matrices from a model object with im_mat
test

Get test predictions for a 3D BaTFLED model.
update_mode1_Tucker

Update the first mode in a Tucker model.
update_mode2_CP

Update the second mode in a CP model.
kernelize

Transform a matrix of input data into a matrix of kernel simmilarities values
lower_bnd_CP

Calculate the lower bound of the log likelihood for a trained CP model
plot_test_cor

Plot correlation results from test data
nrmse

Computes the normalized root mean squared error
plot_preds

Make a scatterplot of observed vs. predicted values
safe_log

Take logarithm avoiding underflow
update_mode2_Tucker

Update the second mode in a Tucker model.
test_results

Get RMSE & explained variance for warm and cold test results
train

Train model using BaTFLED algorthm
plot_test_exp_var

Plot explained variance results from test data
update_core_Tucker

Update values in the core tensor for a Tucker model.
update_mode1_CP

Update the first mode in a CP model.
safe_prod

Takes the product of two matrices adding a column of constants if necessary to the first matrix.
update_mode3_CP

Update the third mode in a CP model.
update_mode3_Tucker

Update the third mode in a Tucker model.