Description Usage Arguments Value Examples
This is minimizing ||Y - HBW^T||_2^2 over B, with all other matrices assumed known.
1 | get_B(Y, H, W, B0, nu = 1e-05, n_iter = 100L)
|
Y |
An N x J real matrix, with censored values set to NA. The standard application we have in mind is the sample x OTU count matrix. |
H |
The spline basis matrix, from which the latent sources arise (as the linear mixture HB.) |
W |
The samples-to-latent-source coefficients matrix, assumed known. |
nu |
The learning rate for the coordinate descent. Arbitrarily defaults to 1e-3. |
n_iter |
The number of sweeps over all entries of B via coordinate descent. |
A list with the following elements,
$obj The RSS after each update to an entry of B.
$B The optimized value of B.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # generate data
N <- 150
P <- 20
K <- 5
L <- 6
library("splines")
H <- bs(1:N, df = L, degree = 1)
W <- matrix(rnorm(P * K), P, K)
B <- matrix(rnorm(L * K), L, K)
E <- matrix(.5 * rnorm(N * P), N, P)
Y <- H %*% B %*% t(W) + E
Y[sample(N * P, N * P * .4)] <- NA # 40% missing at random
# fit the model
B0 <- matrix(rnorm(L * K), L, K)
B_res <- get_B(Y, H, W, B0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.