This repository contains implementations for computing the stability of non-negative matrix factorizations (staNMF).
- Clone the repository:
git clone https://github.com/fwebler/pst-NMF.git- Navigate to the cloned directory:
cd pst-NMF- Install the required dependencies:
pip install -r requirements.txtYou can execute the main.py code as a standard Python script using the MNIST example data or replace it with your own data:
python main.pyThis class provides methods for computing non-negative matrix factorization (NMF) and evaluating its stability. Key features include:
- Loading data from a file or directly as a numpy array.
- Generating initial guesses for factorization.
- Performing NMF.
- Calculating instability metrics.
- Plotting the instability results.
The second script uses the staNMF class to apply stability non-negative matrix factorization to the MNIST dataset. The steps include:
- Loading the MNIST dataset.
- Preprocessing the data using MinMax scaling.
- Applying staNMF.
- Plotting instability results for different values of K.
Parallel processing is utilized for different values of K, and results are aggregated for visualization.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.