https://github.com/michalovadek/nmfbin
Non-Negative Matrix Factorization for Binary Data
https://github.com/michalovadek/nmfbin
binary-data multiplicative-updates non-negative-matrix-factorization
Last synced: 8 months ago
JSON representation
Non-Negative Matrix Factorization for Binary Data
- Host: GitHub
- URL: https://github.com/michalovadek/nmfbin
- Owner: michalovadek
- License: other
- Created: 2023-08-17T11:00:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-10-09T10:44:51.000Z (8 months ago)
- Last Synced: 2025-10-22T03:51:57.123Z (8 months ago)
- Topics: binary-data, multiplicative-updates, non-negative-matrix-factorization
- Language: R
- Homepage: https://michalovadek.github.io/nmfbin/
- Size: 4.87 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
# nmfbin: Non-Negative Matrix Factorization for Binary Data
[](https://CRAN.R-project.org/package=nmfbin)
[](https://github.com/michalovadek/nmfbin/actions/workflows/R-CMD-check.yaml)
The `nmfbin` R package provides a simple Non-Negative Matrix Factorization (NMF) implementation tailored for binary data matrices. It offers a choice of initialization methods, loss functions and updating algorithms.
NMF is typically used for reducing high-dimensional matrices into lower (k-) rank ones where _k_ is chosen by the user. Given a non-negative matrix _X_ of size $m \times n$, NMF looks for two non-negative matrices _W_ ($m \times k$) and _H_ ($k \times n$), such that:
$$X \approx W \times H$$
In topic modelling, if _X_ is a word-document matrix then _W_ can be interpreted as the word-topic matrix and _H_ as the topic-document matrix.
Unlike most other NMF packages, `nmfbin` is focused on binary (Boolean) data, while keeping the number of dependencies to a minimum. For more information see the [website](https://michalovadek.github.io/nmfbin/).
## Installation
You can install the development version of `nmfbin` from [GitHub](https://github.com/michalovadek/nmfbin) with:
``` r
# install.packages("remotes")
remotes::install_github("michalovadek/nmfbin")
```
## Usage
The input matrix can only contain 0s and 1s.
``` r
# load
library(nmfbin)
# Create a binary matrix for demonstration
X <- matrix(sample(c(0, 1), 100, replace = TRUE), ncol = 10)
# Perform Logistic NMF
results <- nmfbin(X, k = 3, optimizer = "mur", init = "nndsvd", max_iter = 1000)
```
## Citation
```
@Manual{,
title = {nmfbin: Non-Negative Matrix Factorization for Binary Data},
author = {Michal Ovadek},
year = {2023},
note = {R package version 0.2.1},
url = {https://michalovadek.github.io/nmfbin/},
}
```
## Contributions
Contributions to the `nmfbin` package are more than welcome. Please submit pull requests or open an issue for discussion.