This function performs Logistic Non-negative Matrix Factorization (NMF) on a binary matrix.
Usage
nmfbin(
X,
k,
optimizer = "mur",
init = "nndsvd",
max_iter = 1000,
tol = 1e-06,
learning_rate = 0.001,
verbose = FALSE,
loss_fun = "logloss",
loss_normalize = TRUE,
epsilon = 1e-10
)
Arguments
- X
A binary matrix (m x n) to be factorized.
- k
The number of factors (components, topics).
- optimizer
Type of updating algorithm.
mur
for NMF multiplicative update rules,gradient
for gradient descent,sgd
for stochastic gradient descent.- init
Method for initializing the factorization. By default Nonnegative Double Singular Value Decomposition with average densification.
- max_iter
Maximum number of iterations for optimization.
- tol
Convergence tolerance. The optimization stops when the change in loss is less than this value.
- learning_rate
Learning rate (step size) for the gradient descent optimization.
- verbose
Print convergence if
TRUE
.- loss_fun
Choice of loss function:
logloss
(negative log-likelihood, also known as binary cross-entropy) ormse
(mean squared error).- loss_normalize
Normalize loss by matrix dimensions if
TRUE
.- epsilon
Constant to avoid log(0).
Value
A list containing:
W
: The basis matrix (m x k). The document-topic matrix in topic modelling.H
: The coefficient matrix (k x n). Contribution of features to factors (topics).c
: The global threshold. A constant.convergence
: Divergence (loss) fromX
at everyiter
untiltol
ormax_iter
is reached.