Explore how the complexity of variational quantum circuits (ansatz) impacts the performance of quantum machine learning models on real-world datasets.
This project dives into the fascinating world of quantum machine learning (QML), using Google Cirq to experiment with simple and complex ansatz designs. Through this, we aim to understand the relationship between ansatz complexity and classification performance, while maintaining execution efficiency.
In this repository, you will:
- Train a quantum classifier on datasets with different ansatz configurations.
- Visualize and compare performance metrics like accuracy, precision, recall, and F1-score.
- Learn how to design and tweak ansatz circuits to optimize quantum models.
Whether you're a beginner in QML or exploring advanced concepts, this project is designed to educate, inspire, and simplify learning quantum computing concepts.
✨ Customizable Ansatz: Learn to design circuits that balance complexity and performance.
⚡ Quick Execution: Designed to provide fast results for easy experimentation.
📊 Performance Visualization: Compare simple vs complex ansatz using bar charts.
🛠️ Google Cirq Implementation: A clean, modular implementation for quantum enthusiasts.
🎓 Educational Insights: Teaching-focused explanations to help students and beginners.
We train the quantum model on real-world datasets:
- Statlog Heart Dataset
- Ionosphere Dataset
Both datasets are preprocessed, split into training, validation, and testing sets to evaluate performance systematically.
Clone the repository and install the required libraries:
git clone /~https://github.com/hamzaskhan/quantum-ansatz-exploration.git
cd quantum-ansatz-exploration
pip install -r requirements.txt
- Open the Google Colab Notebook included in the repository.
- Follow the step-by-step instructions provided in the notebook.
- Experiment with both simple and complex ansatz designs to observe the differences in performance.
- Visualize the circuits and performance metrics to deepen your understanding.
quantum_ansatz_simple.py
: Code for a simple ansatz.quantum_ansatz_complex.py
: Code for the complex ansatz with increased layers and parameters.visualize_performance.py
: Code for visualizing performance metrics.datasets/
: Directory containing the datasets used.
By the end of this project, you will:
- Understand the role of ansatz design in quantum machine learning.
- Learn how to optimize circuits for better classification accuracy.
- Gain hands-on experience with Google Cirq for quantum computing.
- Appreciate the balance between complexity and efficiency in quantum models.
Here’s a sneak peek of what you’ll learn to visualize:
Feel free to contribute by:
- Adding new ansatz designs.
- Improving performance with optimized circuits.
- Suggesting other real-world datasets for experimentation.
This project is licensed under the MIT License.
Special thanks to the open-source quantum computing community for their valuable resources and inspiration. 🙌