Description Usage Arguments Value References Examples
Dimensionality reduction for binary data by extending SVD to minimize binomial deviance.
1 2 3 | logisticSVD(x, k = 2, quiet = TRUE, max_iters = 1000,
conv_criteria = 1e-05, random_start = FALSE, start_A, start_B, start_mu,
partial_decomp = TRUE, main_effects = TRUE, use_irlba)
|
x |
matrix with all binary entries |
k |
rank of the SVD |
quiet |
logical; whether the calculation should give feedback |
max_iters |
number of maximum iterations |
conv_criteria |
convergence criteria. The difference between average deviance in successive iterations |
random_start |
logical; whether to randomly inititalize the parameters. If |
start_A |
starting value for the left singular vectors |
start_B |
starting value for the right singular vectors |
start_mu |
starting value for mu. Only used if |
partial_decomp |
logical; if |
main_effects |
logical; whether to include main effects in the model |
use_irlba |
depricated. Use |
An S3 object of class lsvd
which is a list with the
following components:
mu |
the main effects |
A |
a |
B |
a |
iters |
number of iterations required for convergence |
loss_trace |
the trace of the average negative log likelihood of the algorithm. Should be non-increasing |
prop_deviance_expl |
the proportion of deviance explained by this model.
If |
de Leeuw, Jan, 2006. Principal component analysis of binary data by iterated singular value decomposition. Computational Statistics & Data Analysis 50 (1), 21–39.
Collins, M., Dasgupta, S., & Schapire, R. E., 2001. A generalization of principal components analysis to the exponential family. In NIPS, 617–624.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # construct a low rank matrix in the logit scale
rows = 100
cols = 10
set.seed(1)
mat_logit = outer(rnorm(rows), rnorm(cols))
# generate a binary matrix
mat = (matrix(runif(rows * cols), rows, cols) <= inv.logit.mat(mat_logit)) * 1.0
# run logistic SVD on it
lsvd = logisticSVD(mat, k = 1, main_effects = FALSE, partial_decomp = FALSE)
# Logistic SVD likely does a better job finding latent features
# than standard SVD
plot(svd(mat_logit)$u[, 1], lsvd$A[, 1])
plot(svd(mat_logit)$u[, 1], svd(mat)$u[, 1])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.