Internal:Quantum Machine Learning: Difference between revisions

From crtc.cs.odu.edu
Jump to navigation Jump to search
Ebillias (talk | contribs)
No edit summary
Ebillias (talk | contribs)
Line 66: Line 66:


= Quantum Classifiers =
= Quantum Classifiers =
=== Scalable Quantum Neural Networks for Classification ===
== Scalable Quantum Neural Networks for Classification ==
Jindi Wu, Zeyi Tao, Qun Li
Jindi Wu, Zeyi Tao, Qun Li
https://arxiv.org/abs/2208.07719
https://arxiv.org/abs/2208.07719
Line 89: Line 89:




=== Quantum convolutional neural networks ===
== Quantum convolutional neural networks ==
Iris Cong et al., Nature Physics
Iris Cong et al., Nature Physics
https://doi.org/10.1038/s41567-019-0648-8
https://doi.org/10.1038/s41567-019-0648-8
Line 97: Line 97:




=== Quantum convolutional neural networks for high energy physics data analysis ===
== Quantum convolutional neural networks for high energy physics data analysis ==
Chen et al., Brookhaven National Labs
Chen et al., Brookhaven National Labs
https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.4.013231
https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.4.013231
Line 118: Line 118:




=== Quantum machine learning for particle physics using a variational quantum classifier ===
== Quantum machine learning for particle physics using a variational quantum classifier ==
Andrew Blancea and Michael Spannowsky
Andrew Blancea and Michael Spannowsky
https://link.springer.com/article/10.1007/JHEP02(2021)212
https://link.springer.com/article/10.1007/JHEP02(2021)212
Line 131: Line 131:




=== Challenges and opportunities in quantum machine learning for high-energy physics ===
== Challenges and opportunities in quantum machine learning for high-energy physics ==
Sau Lan Wu and Shinjae Yoo2
Sau Lan Wu and Shinjae Yoo2
https://www.nature.com/articles/s42254-022-00425-7
https://www.nature.com/articles/s42254-022-00425-7
Line 139: Line 139:
... advanced quantum computers with large numbers of qubits, reduced noise and improved running time may outperform classical machine learn- ing in both classification power and in speed. QML may well be a new computational paradigm for big data analyses in HEP. For this reason, the HEP community should stay aware of what is happening in quantum technologies — improvements in the hardware, software ecosystem and algorithms — to bring a quantum advan- tage to the HEP data challenge. Conversely, the develop- ment of solutions for unique HEP data challenges could also lead to contributions to the development of quantum technologies."
... advanced quantum computers with large numbers of qubits, reduced noise and improved running time may outperform classical machine learn- ing in both classification power and in speed. QML may well be a new computational paradigm for big data analyses in HEP. For this reason, the HEP community should stay aware of what is happening in quantum technologies — improvements in the hardware, software ecosystem and algorithms — to bring a quantum advan- tage to the HEP data challenge. Conversely, the develop- ment of solutions for unique HEP data challenges could also lead to contributions to the development of quantum technologies."


=== Quantum machine learning in high energy physics ===
== Quantum machine learning in high energy physics ==
Guan et al.
Guan et al.
https://iopscience.iop.org/article/10.1088/2632-2153/abc17d/pdf
https://iopscience.iop.org/article/10.1088/2632-2153/abc17d/pdf


Uses adiabatic quantum annealing as an optimizer. This methodology also uses angle encoding for particle track data, a general VQC, with different optimizers such as ADAM and COBYLA.
Uses adiabatic quantum annealing as an optimizer. This methodology also uses angle encoding for particle track data, a general VQC, with different optimizers such as ADAM and COBYLA.

Revision as of 15:58, 27 March 2023

Progress

March 21, 2023

Many of these models require a hybrid approach. Brookhaven, for example, uses a distributed series of VQC's which then feed data to a classical NN to attain results. Others use a method more in line with Cirq where the input parameters are fed into a classical NN which then produces the parameters required for the VQC. This seems almost redundant UNLESS the input data is so large that classification via classical CNN is so computationally expensive that a regular NN plus VQC is somehow "cheaper". I am not sure if our 4,032 pixel data constitutes. I am required to accomplish two distinct goals with this project:

1. Distinguish myself by using a Quantum particle data classifier which has not been seen before.

2. The product of 1. must have some utility

In regards to the Qiskit QCNN method of attaining results on the particle data we find two main problems:

  • The 36x112 feature particle data is too large to use any pauli mapping so we are reliant on a 12 qubit amplitude encoding circuit. This circuit trains extremely slow even with the use of GPU's. Optimizations need to be discovered in order to make progress with this area. With that being said, for small sample sizes we achieve good results (+90%).
  • The 6 feature data encoded with the same Pauli methods attain very poor results as shown below.

There exists a few solutions to the 36x112 feature problem number:

  • We can interpolate the data to smaller amplitude encoded circuits such as 8 qubits. Doing so achieves respectable results (+80% accuracy) for smaller datasets (under 1000 samples). For larger datasets training time is drastically increased and progress towards a minimum is slowed and we are back to the first problem again.
  • We find ways of optimizing the circuits for training. Qiskit allegedly has several "fast" sampling methods. Learning the modules and applying a few test runs should determine if the full 12 qubits can be encoded correctly.


I propose a series of problems to solve where, if solved, any one of them will be both distinguishable and possess utility:

  • We can optimize training the Qiskit circuits. There are other ways to produce the required results.
    • Seen here[1] a 50 qubit EPR state is sampled in 0.1 seconds. There are fast sampling methods built in. If these can be sent to the optimizer as a Quantum_Instance (in the same way we use the GPU) then I can simulate a wide variety of large circuits very quickly. This will allow for a more "pure" QCNN than those seen in other papers as well as having the utility of being run on real hardware (in the near future maybe!).
  • The dissertation written by Jonas Landman from University of Paris proposes intersting QNN architectures such as the NISQ algorithm for Orthogonal Neural Networks. This uses a connected series of quantum VQC's which replicate a classical neural network. Using this architecture could very well provide real results on the 6 feature data (or interpolated 36x112 feature).
  • Much like a combination of Jonas Landman and the Brookhaven paper, I could construct my own series of Quantum circuits which act as a distributed Neural network. A layer of circuits produce an output which are then fed into the next layer of circuits. In this case, the circuits act as both the Nodes and carry the weights in a classical sense. This gives far more parameters to work with using "less" qubits per circuit. This means, with a sufficient distribution, every datapoint will be encoded into it's own qubit even for the 36x112 feature data. +4,000 qubits won't be an issue if they're broken up into sufficiently small circuits with distributed calculations.


March 27, 2023

From last week, two major problems are solved:

1. The 6 feature data will not produce reasonable results (possibly due to the loss of locality?). However, the 4032 feature data can be resized using:

  cv2.resize(samples, dsize=(n, len(samples)), interpolation=cv2.INTER_AREA)

This allows for resizing of the image to fit some n number of pixels without loosing any of the data points to full degredation (all 0 pixel values). This resizing will allow for the training of networks using pauli feature mapping (because cv2.INTER_AREA preserves some of the locality?). This, in turn, not only greatly decreasing training times and quickens convergence, but also increases the accuracy of result.


2. The GPU implementation only requires a few lines of code to be optimized:

   try:
       simulator_gpu = Aer.get_backend('aer_simulator')
       simulator_gpu.set_options(device='GPU', precision='single')
   except AerError as e:
       print('GPU Err:\n',e)

Take note that for certain feature mapping and ansatz implementations the GPU may be slower than a CPU if an insufficient number of qubits is used.


Using the following we are able to produce a very rudimentary VQC with two parts; a feature mapping and ansatz. Using everything we learned we can achieve an accuracy of +98% for previously unseen testing data in 30 iterations, training time under 2 minutes, 0.01% of the data used for training. This is done with n number of qubits/features to be 6 or 8.

So far, there is no need for a complex distributed network, hybridization, or complex QCNN classification models. The following goal is to either discover or create a more "complete" ansatz which can cover as much of the hilbert space as possible. Doing so should bump us up to +99% with a mere few minutes of training time




Quantum Classifiers

Scalable Quantum Neural Networks for Classification

Jindi Wu, Zeyi Tao, Qun Li https://arxiv.org/abs/2208.07719

Relies on a hybrid classical-quantum architecture. Each subdomain has the following:

1. Encoding Unit

  • Authors utilize angle encoding (N qubits for N features) because it can support gradient calculations
  • Amplitude encoding not used due to error rate and difficulty in computing gradients


2. VQC


3. Measurement

  • Calculation of the expectation value, seemingly Pauli-Z operator giving [-1, 1]

4. The measurement of the sub domain is then encoded into a qubit in the next layer.

Seemingly, this process combines both convolutional and pooling layers in the same way that Iris Cong et al. performs calculations. Advantageous over the qiskit implementation in that the "pooling layers" are not parameterized since the pooling is the measurement itself. Additionally, we can run circuits in parallel.


Quantum convolutional neural networks

Iris Cong et al., Nature Physics https://doi.org/10.1038/s41567-019-0648-8

N qubit input requires O(log(N)) variational parameters. "This corresponds to a double exponential reduction compared with a generic quantum circuit-based classifier..." hopefully leading to faster training times?


Quantum convolutional neural networks for high energy physics data analysis

Chen et al., Brookhaven National Labs https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.4.013231

The (SIMULATED) QCNN follows the following protocol:

1. Feature mapped (Amplitude encoded?) particle images of size 30x30 are implemented in the encoding layer.

2. A VQC acts as a convolutional layer. Convolutional outputs are calculated via the expectation value of the Pauli-Z operator acting on the first qubit.

3. Pooling is done classically with nonlinear activation functions in between convolutional layers (look deeper into this).

4. Categorical Cross Entropy Loss Function is applied to the final output.

5. Back Prop to adjust the parameters in the VQC's (convolutional layers).


We can implement this "by hand" in qiskit using their approximate expectation function on a Wahab GPU node using simulator.set_options(device='GPU'). This is considerable because it may be a faster process (also for larger circuits) than available public access QML methods.


Quantum machine learning for particle physics using a variational quantum classifier

Andrew Blancea and Michael Spannowsky https://link.springer.com/article/10.1007/JHEP02(2021)212

This method follows the same methodology as many others.

1. Angle Encoding the data 2. Generic VQC using universal single qubit gates and CNOTs producing layers of two entangled qubits 3. Measurement is performed by experimental repetitions to determine the expectation value of the Pauli-Z operator, not calculated deterministically

Rudimentary introduction to QNN classification.


Challenges and opportunities in quantum machine learning for high-energy physics

Sau Lan Wu and Shinjae Yoo2 https://www.nature.com/articles/s42254-022-00425-7

"Overall, the greatest challenge in using quantum computer hardware for machine learning at present... is the size of the event samples and the effective use of large num- bers of qubits... analyses will need to manage large event sample size and large data dimensionality...

... advanced quantum computers with large numbers of qubits, reduced noise and improved running time may outperform classical machine learn- ing in both classification power and in speed. QML may well be a new computational paradigm for big data analyses in HEP. For this reason, the HEP community should stay aware of what is happening in quantum technologies — improvements in the hardware, software ecosystem and algorithms — to bring a quantum advan- tage to the HEP data challenge. Conversely, the develop- ment of solutions for unique HEP data challenges could also lead to contributions to the development of quantum technologies."

Quantum machine learning in high energy physics

Guan et al. https://iopscience.iop.org/article/10.1088/2632-2153/abc17d/pdf

Uses adiabatic quantum annealing as an optimizer. This methodology also uses angle encoding for particle track data, a general VQC, with different optimizers such as ADAM and COBYLA.