Neural NMF
This package is an implementation of Neural NMF, a method for detecting latent hierarchical structure in data based on non-negative matrix factorization, as presented in the paper "Neural Nonnegative Matrix Factorization for Hierarchical Multilayer Topic Modeling" by T. Will, R. Zhang, E. Sadovnik, M. Gao, J. Vendrow, J. Haddock, D. Molitor, and D. Needell (2020).
Neural NMF solve a hierarchical nonnegative matrix factorization problem by representing the problem with a neural network architecture and applying backpropagation methods. In the unsupervised case, Neural NMF applies backprogation directly to the given loss function (usually either Energy Loss or Reconstruction Loss). In the supervised case, Neural NMF adds a linear layer to the last S matrix to estimate the given labels.
Installation
To install Neural NMF, run this command in your terminal:
$ pip install NeuralNMF
This is the preferred method to install Neural NMF, as it will always install the most recent stable release.
If you don't have pip installed, these installation instructions can guide you through the process.
Usage
Quick Start
To use Neural NMF, we first initialize our neural network with the layer sizes, and if applicable, the number of classes. We give the layer sizes as a list, where the first element is the 2nd dimension of the input matrix and each following dimensions is the rank of the approximation at the following layer.
>>> import torch
>>> from NeuralNMF import Neural_NMF
>>> X = 10*torch.mm(torch.randn(100,5),torch.randn(5,20)) #produce random low rank data
>>> m, k1, k2, = X.shape[0], 10, 5
>>> net = Neural_NMF([m, k1, k2])
One we have initialized our network, we train it using the train function (See the documentation in train.py for specific details of every optional parameter).
>>> from NeuralNMF import train
>>> history = train(net, X, epoch=6, lr=500, supervised=False)
epoch = 1
tensor(485.2435, dtype=torch.float64)
epoch = 2
tensor(475.1584, dtype=torch.float64)
epoch = 3
tensor(461.2400, dtype=torch.float64)
epoch = 4
tensor(444.1705, dtype=torch.float64)
epoch = 5
tensor(430.4947, dtype=torch.float64)
epoch = 6
tensor(422.7317, dtype=torch.float64)
Citing
If you use our code in an academic setting, please consider citing our code by citing the following paper:
Will, T., Zhang, R., Sadovnik, E., Gao, M., Vendrow, J., Haddock, J., Molitor, D., & Needell, D. (2020). Neural nonnegative matrix factorization for hierarchical multilayer topic modeling.
Authors
- Joshua Vendrow
- Jamie Haddock
Metadata
Release files for NeuralNMF 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| NeuralNMF-1.0.0.tar.gz | 14.5 kB | Without provenance | Details for NeuralNMF-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| NeuralNMF-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for NeuralNMF-1.0.0-py3-none-any.whl |
Total release size: 29.9 kB
Release files / NeuralNMF-1.0.0.tar.gz
| Download URL | NeuralNMF-1.0.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09d793d080e496bc088ef0fc2bad7cd62e35fc6e15dbb44a21d99ae136d00941
|
|
BLAKE2b-256 checksum How to use checksums |
1f6bfa7b1cd289ab9ce00135f6ba5e5654f79687225f3a9f8fa5a09a1e1a9ec4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Release files / NeuralNMF-1.0.0-py3-none-any.whl
| Download URL | NeuralNMF-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff63d312ccb5332cfefb6f423dfb904f13a75916efb24881a8ad281ccb5f0839
|
|
BLAKE2b-256 checksum How to use checksums |
89d06b78cc719d7151de7f1ae5b6f9051294e908abca1b9828d08e3abf43f1c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Security for NeuralNMF 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.