@@ -6,8 +6,334 @@ DATE: April 30
66===== Plans for the week of April 28-May 2 =====
77
88!bblock
9- O TBA
10- o "Video of lecture TBA":"https://youtu.be/"
9+ o Classical Support Vector Machines, reminder from last week
10+ o Quantum Support Vector Machines
11+ o And if we get time, we may start with Quantum Neural Networks
12+ # o "Video of lecture TBA":"https://youtu.be/"
1113# o "Whiteboard notes":"https://github.com/CompPhysics/QuantumComputingMachineLearning/blob/gh-pages/doc/HandWrittenNotes/2024/NotesApril24.pdf"
1214!eblock
1315
16+ !bblock Reading recommendations
17+ o For classical Support Vector Machines, see lecture notes by Morten Hjorth-Jensen at URL:"https://compphysics.github.io/MachineLearning/doc/LectureNotes/_build/html/chapter5.html"
18+ o Claudio Conti, Quantum Machine Learning (Springer), sections 1.5-1.12, see URL:"https://link.springer.com/book/10.1007/978-3-031-44226-1". With an IP-number from the university of Oslo, you can download this book for free. The material on quantum support vector machines will be discussed next week.
19+ !eblock
20+
21+ !split
22+ ===== What is Machine Learning? =====
23+
24+ Machine Learning (ML) is the study of algorithms that improve through data experience.
25+
26+ !bblock Types of Machine Learning:
27+ o \textbf{Supervised Learning:} Labeled data for classification or regression.
28+ o \textbf{Unsupervised Learning:} No labels; discover hidden patterns.
29+ o \textbf{Reinforcement Learning:} Learning through interaction with the environment.
30+ !eblock
31+
32+ !bblock
33+ \textbf{ML Workflow:}
34+ !bt
35+ \[
36+ \text{Data} \rightarrow \text{Model Training} \rightarrow \text{Prediction}
37+ \]
38+ !et
39+ !eblock
40+
41+
42+ !split
43+ ===== What is Quantum Machine Learning? =====
44+
45+ Quantum Machine Learning (QML) integrates quantum computing with machine learning algorithms to exploit quantum advantages.
46+
47+ !bblock Motivation:
48+ o High-dimensional Hilbert spaces for better feature representation.
49+ o Quantum parallelism for faster computation.
50+ o Quantum entanglement for richer data encoding.
51+ !eblock
52+
53+ !split
54+ ===== Quantum Speedups in ML =====
55+ \textbf{Why Quantum?}
56+ !bblock
57+ o \textbf{Quantum Parallelism:} Process multiple states simultaneously.
58+ o \textbf{Quantum Entanglement:} Correlated states for richer information.
59+ o \textbf{Quantum Interference:} Constructive and destructive interference to enhance solutions.
60+ !eblock
61+
62+ !bblock
63+ Example - Quantum Fourier transforms:
64+ !bt
65+ \begin{align*}
66+ \mathrm{Discrete Fourier Transform} & \sim O(N^2)\\
67+ \mathrm{Fast Fourier Transform} & \sim O(N^2)\\
68+ \mathrm{Qauntum Fourier Transform} & \sim O(N^2)\\
69+ \end{align*}
70+ !et
71+ !eblock
72+
73+ Advantage: Speedups in high-dimensional optimization and linear algebra problems.
74+
75+
76+ !split
77+ ===== Challenges in Quantum Machine Learning =====
78+
79+
80+ !bblock Quantum Hardware Limitations:
81+ o Noisy Intermediate-Scale Quantum (NISQ) devices.
82+ o Decoherence and limited qubit coherence times.
83+ !eblock
84+
85+ !bblock Data Encoding:
86+ o Efficient embedding of classical data into quantum states.
87+ !eblock
88+
89+ !bblock Scalability:
90+ o Difficult to scale circuits to large datasets.
91+ !eblock
92+
93+
94+ !split
95+ ===== Classical Support Vector Machines (SVMs) =====
96+
97+ Support Vector Machines (SVM) are supervised learning algorithms used
98+ for classification tasks, and regression tasks as well. The main goal
99+ of SVMs is to find the optimal separating hyperplane (in
100+ high-dimensional space) that provides a maximum margin between
101+ classes.
102+
103+ !split
104+ ===== First mathematical formulation of SVMs (formal details below) =====
105+
106+ For a dataset \((\mathbf{x}_i, y_i)\) where \(\mathbf{x}_i \in
107+ \mathbb{R}^n\) and \(y_i \in \{-1, 1\}\), the decision boundary is
108+ defined as:
109+ !bt
110+ \[
111+ f(\mathbf{x}) = \mathbf{w} \cdot \mathbf{x} + b = 0.
112+ \]
113+ !et
114+
115+ The goal is to optimize
116+ !bt
117+ \[
118+ \min_{\mathbf{w}, b} \frac{1}{2} ||\mathbf{w}||^2,
119+ \]
120+ !et
121+ subject to
122+ !bt
123+ \[
124+ y_i (\mathbf{w} \cdot \mathbf{x}_i + b) \geq 1, \quad \forall i
125+ \]
126+ !et
127+
128+ !split
129+ ===== Kernels and more =====
130+
131+ In classical SVMs, kernels help with non-linear data
132+ separations. Quantum computers can speed up the computation of complex
133+ kernel evaluations by efficiently simulating an inner product in an
134+ exponentially large Hilbert space.
135+
136+
137+
138+ !split
139+ ===== Quantum Support Vector Machines (QSVMs) =====
140+
141+ !bblock Quantum Kernel Estimation:
142+ o Maps classical data to a quantum Hilbert space.
143+ o Quantum kernel measures similarity in high-dimensional space.
144+ !eblock
145+
146+ !bblock Quantum-enhanced kernel:
147+ !bt
148+ \[
149+ K(\bm{x}, \bm{x}') = |\langle \psi(\bm{x}) \vert \psi(\bm{x}')\rangle|^2
150+ \]
151+ !et
152+ !eblock
153+
154+ Here, $\vert \phi(\bm{x})\rangle$ is the quantum state encoding of
155+ the classical data $\bm{x}$.
156+
157+ Advantage: Potentially exponential speedup over classical SVMs.
158+
159+
160+ !split
161+ ===== Quantum Neural Networks (QNNs) =====
162+
163+ Quantum Neural Networks replace classical neurons with parameterized quantum circuits.
164+ !bblock Key Concepts:
165+ o Quantum Gates as Activation Functions.
166+ o Variational Quantum Circuits (VQCs) for optimization.
167+ !eblock
168+ !bblock
169+ \textbf{Parameterized Quantum Circuit:}
170+ !bt
171+ \[
172+ U(\theta) = \prod_i R_y(\theta_i) \cdot CNOT \cdot R_x(\theta_i)
173+ \]
174+ !et
175+ !eblock
176+ Advantage:Quantum gradients enable exploration of non-convex landscapes.
177+
178+ !split
179+ ===== Quantum Boltzmann Machines (QBMs) =====
180+
181+ Quantum Boltzmann Machines leverage quantum mechanics to sample from a probability distribution.
182+
183+ !bblock
184+ o Quantum tunneling aids in escaping local minima.
185+ o Quantum annealing for optimization problems.
186+ !eblock
187+ !bblock Quantum Hamiltonian:
188+ !bt
189+ \[
190+ H = -\sum_i b_i \sigma_i^z - \sum_{ij} w_{ij} \sigma_i^z \sigma_j^z
191+ \]
192+ !et
193+ !eblock
194+ Advantage: Efficient sampling in complex probability distributions.
195+
196+
197+
198+
199+ !split
200+ ===== Quantum SVMs =====
201+
202+ The idea of a classical SVM is that we have a set of points
203+ that are in either one group or another and we want to find a line that
204+ separates these two groups. This line can be linear, but it can also be
205+ much more complex, which can be achieved by the use of Kernels.
206+
207+ !split
208+ ===== What will we need in the case of a quantum computer? =====
209+
210+ !bblock
211+ We will have to translate the classical data point \(\vec{x}\)
212+ into a quantum datapoint \(\vert \Phi{(\vec{x})} \rangle\). This can
213+ be achieved by a circuit $\mathcal{U}_{\Phi(\vec{x})} \vert 0\rangle$.
214+
215+
216+ Here $\Phi()$ could be any classical function applied
217+ on the classical data $\vec{x}$.
218+ !eblock
219+ !bblock
220+ We need a parameterized quantum circuit $W(\theta)$ that
221+ processes the data in a way that in the end we
222+ can apply a measurement that returns a classical value \(-1\) or
223+ \(1\) for each classical input \(\vec{x}\) that indentifies the label
224+ of the classical data.
225+ !eblock
226+
227+
228+ !split
229+ ===== The most general ansatz =====
230+
231+ Following these steps we can define an ansatz for this kind of problem
232+ which is
233+ !bt
234+ \[
235+ W(\theta) \mathcal{U}_{\Phi}(\vec{x}) \vert 0 \rangle.
236+ \]
237+ !et
238+
239+ These kind of ansatzes are called quantum variational circuits.
240+
241+ !split
242+ ===== Quantum SVM =====
243+
244+ In the case of a quantum SVM we will only use the quantum feature maps
245+ !bt
246+ \[
247+ \mathcal{U}_{\Phi(\vec{x})},
248+ \]
249+ !et
250+ to translate the classical data into
251+ quantum states and build the Kernel of the SVM out of these quantum
252+ states. After calculating the Kernel matrix on the quantum computer we
253+ can train the Quantum SVM the same way as the classical SVM.
254+
255+
256+ !split
257+ ===== Defining the Quantum Kernel =====
258+
259+ The idea of the quantum kernel is exactly the same as in the classical
260+ case. We take the inner product
261+ !bt
262+ \[
263+ K(\vec{x}, \vec{z}) = \vert \langle \Phi (\vec{x}) \vert \Phi(\vec{z}) \rangle \vert^2 = \langle 0^n \vert \mathcal{U}_{\Phi(\vec{x})}^{t} \mathcal{U}_{\Phi(\vec{z})} \vert 0^n \rangle,
264+ \]
265+ !et
266+ but now with the quantum feature maps
267+ !bt
268+ \[
269+ \mathcal{U}_{\Phi(\vec{x})}.
270+ \]
271+ !et
272+
273+ The idea is that if we choose a quantum feature maps that is not easy
274+ to simulate with a classical computer we might obtain a quantum
275+ advantage.
276+
277+
278+ !split
279+ ===== Side note =====
280+
281+ There is no proof yet that the QSVM brings a quantum
282+ advantage, but the argument the authors of
283+ URL:"https://arxiv.org/pdf/1804.11326.pdf" make, is that there is
284+ for sure no advantage if we use feature maps that are easy to simulate
285+ classically, because then we would not need a quantum computer to
286+ construct the Kernel.
287+
288+ !split
289+ ===== Feature map =====
290+
291+ For the feature maps we use the ansatz
292+ !bt
293+ \[
294+ \mathcal{U}_{\Phi(x)} = U_{\Phi(x)} \otimes H^{\otimes n},
295+ \]
296+ !et
297+ where
298+ !bt
299+ \[
300+ U_{\Phi(x)} = \exp \left( i \sum_{S \in n} \phi_S(x) \prod_{i \in S} Z_i \right),
301+ \]
302+ !et
303+ which simplifies a lot when we (like in URL:"https://arxiv.org/pdf/1804.11326.pdf") only consider
304+ \(S \leq 2\) interactions, which means we only let two qubits interact
305+ at a time. For \(S \leq 2\) the product \(\prod_{i \in S}\) only leads
306+ to interactions \(Z_i Z_j\) and non interacting terms \(Z_i\). And the
307+ sum \(\sum_{S \in n}\) over all these terms that are possible with \(n\)
308+ qubits.
309+
310+ !split
311+ ===== Classical functions =====
312+
313+ Finally we define the classical functions \(\phi_i(\vec{x}) = x_i\) and
314+ \(\phi_{i,j}(\vec{x}) = (\pi - x_i)( \pi- x_j)\).
315+
316+ If we write this ansatz for 2 qubits and \(S \leq 2\) we see how it
317+ simplifies:
318+ !bt
319+ \[
320+ U_{\Phi(x)} = \exp \left(i \left(x_1 Z_1 + x_2 Z_2 + (\pi - x_1)( \pi- x_2) Z_1 Z_2 \right) \right).
321+ \]
322+ !et
323+ We won't get into details to much here, why we would take this ansatz.
324+ It is simply an ansatz that is simple enough an leads to good results.
325+
326+ Finally we can define a depth of these circuits. Depth 2 means we repeat
327+ this ansatz two times. Which means our feature map becomes
328+ \(U_{\Phi(x)} \otimes H^{\otimes n} \otimes U_{\Phi(x)} \otimes H^{\otimes n}\)
329+
330+
331+ !split
332+ ===== Plans for next week =====
333+ o Introducing quantum neural networks
334+
335+
336+
337+
338+
339+
0 commit comments