Constrained Matrix Factorization
Advancements on non-negative matrix factorization in PyTorch, with crystallography as a primary use case.
Free software: 3-clause BSD license
Documentation: https://nsls-ii.github.io/constrained-matrix-factorization.
Features
Torch enabled non-negative matrix factorization
Optional input components and/or weights
Rigidly constrained specific components or weights
Plotting utilities
Utilities for “elbow method” and automatic iterative cmf
Wrappers for scientific use cases
scattering: XRD, PDF, TS, SAXS
Developer’s Instructions
Install from github:
$ python3 -m venv cmf_env $ source cmf_env/bin/activate $ git clone https://github.com/nsls-ii/constrained-matrix-factorization $ cd constrained-matrix-factorization $ python -m pip install --upgrade pip wheel $ python -m pip install -r requirements-dev.txt $ pre-commit install $ python -m pip install -e .
Original Publication
This work was originally published on the arXiv here of this paper. It has since been peer reviewd and published in Applied Physics Reviews.
Abstract
Non-negative Matrix Factorization (NMF) methods offer an appealing unsupervised learning method for real-time analysis of streaming spectral data in time-sensitive data collection, such as in situ characterization of materials. However, canonical NMF methods are optimized to reconstruct a full dataset as closely as possible, with no underlying requirement that the reconstruction produces components or weights representative of the true physical processes. In this work, we demonstrate how constraining NMF weights or components, provided as known or assumed priors, can provide significant improvement in revealing true underlying phenomena. We present a PyTorch based method for efficiently applying constrained NMF and demonstrate this on several synthetic examples. When applied to streaming experimentally measured spectral data, an expert researcher-in-the-loop can provide and dynamically adjust the constraints. This set of interactive priors to the NMF model can, for example, contain known or identified independent components, as well as functional expectations about the mixing of components. We demonstrate this application on measured X-ray diffraction and pair distribution function data from in situ beamline experiments. Details of the method are described, and general guidance provided to employ constrained NMF in extraction of critical information and insights during in situ and high-throughput experiments.
Metadata
Release files for constrained-matrix-factorization 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| constrained-matrix-factorization-0.1.2.tar.gz | 44.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| constrained_matrix_factorization-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.9 kB
Release files / constrained-matrix-factorization-0.1.2.tar.gz
| Download URL | constrained-matrix-factorization-0.1.2.tar.gz |
|---|---|
| Size | 44.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
401ce34ed8d81a305cbcf8f2ded541df72c797aea4fbe85c32a0c9b5d4bef8fa
|
|
BLAKE2b-256 checksum How to use checksums |
1f593035e6c7b94599d47cf9dcf2386941161c79332e11ea30b00c04ab4a9de1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Release files / constrained_matrix_factorization-0.1.2-py3-none-any.whl
| Download URL | constrained_matrix_factorization-0.1.2-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ecc0f5e59baf661cea54b364255085a26d89591e7bdd89fc295e6a459e2d41f
|
|
BLAKE2b-256 checksum How to use checksums |
a2cae26bc4c4857c6e312a273912866a3321002a1f99bf523f2a946e669befdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|