Topics of Quantum Computing (IN2107, IN0014, IN218307)
This project implements part of the numerical experiments proposed by Huggins et al. in the paper Towards Quantum Machine Learning with Tensor Networks. The experiments implemented so far have been:
(a) Classification task with a quantum circuit doing the predictions
(b) Classification task with an equivalent tensor network doing the predictions.
The quantum circuits are implemented using Qiskit. The tensor networks are implemented using TensorNetwork.
You can get a taste of the tensor algorithms used in this project with zero setup pain by accessing the following Google Colab notebooks:
Install the dependencies from the requirements file by using pip
pip install -r requirements.txt
Unless you want to make a global install, we encourage first to create a virtual environment and install the dependencies only after activating it.
The project contains a set of notebooks that allow you to play with the implementation of the tensor network classification algorithm plus binary classification example on the MNIST dataset, and the necessary quantum circuit, tensor network, and data utility functions.
For executing the notebooks, simply go into the /notebooks
folder and launch jupyter lab.
cd notbooks
jupyter lab
If you wish to run the classification task with the tensor network prediction, pass the argument '-t' to the module.
python -m quantum.network -t
To run the example with quantum circuit predictions, pass no arguments to the module.
python -m quantum.network
- /notebooks: Holds the experiments used for the development of the tensor network code and an isolated example of its functioning.
- Functional.ipynb: Functional refactoring of the tensor network contraction and labeling.
- Monolith.ipynb: Monolith implementation of the tensor network contraction and labeling.
- AutoContraction.ipynb: Monolith implementation relying on the method tensornetwork.contractors.auto() - /quantum: Holds the codebase for the classification algorithms:
- network.py: Holds the QuantumNetwork class with its respective training and prediction methods.
- /utils: Holds the scripts supporting the functioning of the network.
- quantum_utils.py: Functions for unitary matrix and quantum circuit generation.
- tensor_utils.py: Functions for the embedding, generation of the network, contraction and labeling
- data_utils.py: Preprocessing functions for loading the classic data into the network.
The project is still under development. We aim to generalize the examples presented, and incorporate more lightweight networks like the MPS base one presented by Stavros et al. in TensorNetwork for Machine Learning. Next milestones are:
- Parametrize the naive tensor network contraction for v!=2
- Implement more resource efficient network contractions.
- Implement lighter tensor network architectures (MPS).
- Adapt the implementation for the non-binary classification task.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.