Skip to main content

Advancements on non-negative matrix factorization in PyTorch, with crystallography as a primary use case.

Project description

https://img.shields.io/github/workflow/status/nsls-ii/constrained-matrix-factorization/Unit%20Tests https://img.shields.io/pypi/v/constrained-matrix-factorization.svg

Advancements on non-negative matrix factorization in PyTorch, with crystallography as a primary use case.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file constrained-matrix-factorization-0.1.2.tar.gz.

File metadata

  • Download URL: constrained-matrix-factorization-0.1.2.tar.gz
  • Upload date:
  • Size: 44.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for constrained-matrix-factorization-0.1.2.tar.gz
Algorithm Hash digest
SHA256 401ce34ed8d81a305cbcf8f2ded541df72c797aea4fbe85c32a0c9b5d4bef8fa
MD5 576052977bd8bbb1ef3cf72206067655
BLAKE2b-256 1f593035e6c7b94599d47cf9dcf2386941161c79332e11ea30b00c04ab4a9de1

See more details on using hashes here.

File details

Details for the file constrained_matrix_factorization-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: constrained_matrix_factorization-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for constrained_matrix_factorization-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ecc0f5e59baf661cea54b364255085a26d89591e7bdd89fc295e6a459e2d41f
MD5 eb8e2460eced9180f73f41ac5fbc161b
BLAKE2b-256 a2cae26bc4c4857c6e312a273912866a3321002a1f99bf523f2a946e669befdb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page