Description Usage Arguments Value References Examples
Supervised matrix factorization for exponential family data
1 2 3 4 5 |
x |
covariate matrix |
y |
response vector |
k |
dimension |
alpha |
balance between dimensionality reduction of |
family_x |
exponential family distribution of covariates |
family_y |
exponential family distribution of response |
quiet |
logical; whether the calculation should give feedback |
max_iters |
maximum number of iterations |
conv_criteria |
convergence criteria |
random_start |
whether to randomly initialize |
start_A |
initial value for |
start_B |
initial value for |
start_beta |
initial value for |
mu |
specific value for |
update_A |
logical; whether to update the scores |
update_beta |
logical; whether to update the coefficients |
lambda |
an L2 penalty on the parameters to prevent numerical issues. This was reportedly used in Rish's implementation |
An S3 object of class gsmf
which is a list with the
following components:
mu |
the main effects for dimensionality reduction |
A |
the |
B |
the |
beta |
the |
family_x |
the exponential family of covariates |
family_y |
the exponential family of response |
iters |
number of iterations required for convergence |
loss_trace |
the trace of the average negative log likelihood of the algorithm. Should be non-increasing |
Rish, Irina, et al. "Closed-form supervised dimensionality reduction with generalized linear models." Proceedings of the 25th international conference on Machine learning. ACM, 2008.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | rows = 100
cols = 10
set.seed(1)
mat_np = outer(rnorm(rows), rnorm(cols))
# generate a count matrix and binary response
mat = matrix(rpois(rows * cols, c(exp(mat_np))), rows, cols)
response = rbinom(rows, 1, rowSums(mat) / max(rowSums(mat)))
mod = genSupMF(mat, response, k = 1, alpha = 1, family_x = "poisson", family_y = "binomial",
quiet = FALSE)
plot(inv.logit.mat(cbind(1, mod$A) %*% mod$beta), response)
plot(rowSums(mat), response)
## Not run:
ggplot(data.frame(PC = mod$PCs[, 1], y = response), aes(PC, y)) + stat_summary_bin(bins = 10)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.