This repository contains a Python implementation of the paper "Quantum Clustering and Gaussian Mixtures" by Mahajabin Rahman and Davi Geiger. This project utilizes quantum wave functions and complex numbers to enhance Gaussian mixture clustering, outperforming traditional methods in terms of accuracy and robustness.
- Introduction
- Installation
- Usage
- Methodology
- Results
- Examples
- Contributing
- Reporting Issues and Mistakes
- License
- References
Clustering is a fundamental task in data analysis, commonly used in computer vision and other fields. Traditional Gaussian Mixture Models (GMM) combined with the Expectation-Maximization (EM) algorithm are widely used for this purpose. However, this repository implements a novel approach inspired by quantum interference phenomena, reformulating the classical model using wave functions. This quantum method provides more accurate estimations and is more robust to deviations from Gaussian assumptions.
To run the code, ensure you have Python installed. You can install the necessary dependencies using pip
:
pip install -r requirements.txt
To perform Quantum Gaussian mixture clustering on your image, you can use the following command:
python quantum_gmm.py --input <Path to the input Image File> --output <Path to the output Image File> --components <Number of Cluster> --iter <Number of Iteration>
In this approach, each class distribution is represented by a wave function whose magnitude square corresponds to the class Gaussian distribution. The mixture of class wave functions results in the mixture wave function, with the final probability distribution being the magnitude square of this mixture wave function. This introduces quantum interference effects that enhance clustering performance.
The Expectation-Maximization (EM) algorithm is adapted for the quantum clustering method:
Calculate the expected value of the latent variables given the current parameters.
Maximize the expected log-likelihood to update the parameters.
The quantum method outperforms classical Gaussian mixture methods by providing more accurate and stable parameter estimations, especially in cases with overlapping distributions. The following figures illustrate the improvements:
The Jupyter notebook file contains sample scripts demonstrating how to apply the quantum Gaussian mixture clustering to various images.
I welcome contributions to enhance this project. To contribute, follow these steps:
- Fork this repository.
- Create a new branch.
- Make your changes.
- Submit a pull request.
If you encounter any mistakes or issues in the code, i greatly appreciate your help in making this project better. Please follow the steps below to report any problems:
-
Check Existing Issues: Before submitting a new issue, please check the Issues tab to see if your problem has already been reported. This helps us avoid duplicate reports and consolidate efforts.
-
Create a New Issue:
- Go to the Issues tab in the repository.
- Click on the
New Issue
button. - Provide a descriptive title for your issue.
- In the issue description, please include:
- A detailed description of the problem.
- Steps to reproduce the issue, if applicable.
- Any relevant code snippets, screenshots, or logs.
- The environment and version details (e.g., operating system, Python version, etc.).
-
Use Labels: If possible, apply appropriate labels to your issue (e.g.,
bug
,enhancement
,question
). This helps us categorize and prioritize the issues more efficiently. -
Stay Updated: After submitting an issue, you can track its progress and participate in discussions by following the issue. I may request additional information or clarification to help resolve the problem.
-
Contribute Fixes: If you are able to fix the issue yourself, feel free to submit a pull request. Please follow the contribution guidelines provided in the repository.
I value your feedback and contributions, and i strive to address issues promptly. Thank you for helping improve this project!
This project is licensed under the MIT License. See the LICENSE
file for more details.
- Repo in Paper with code.
- Rahman, M., & Geiger, D. (2016). "Quantum Clustering and Gaussian Mixtures".