Skip to content

Commit 3b0b734

Browse files
committed
Update week14.do.txt
1 parent e59a10d commit 3b0b734

File tree

1 file changed

+132
-132
lines changed

1 file changed

+132
-132
lines changed

doc/src/week14/week14.do.txt

Lines changed: 132 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -207,137 +207,6 @@ Advantage: Efficient sampling in complex probability distributions.
207207

208208

209209

210-
!split
211-
===== Quantum SVMs =====
212-
213-
The idea of a classical SVM is that we have a set of points
214-
that are in either one group or another and we want to find a line that
215-
separates these two groups. This line can be linear, but it can also be
216-
much more complex, which can be achieved by the use of Kernels.
217-
218-
!split
219-
===== What will we need in the case of a quantum computer? =====
220-
221-
!bblock
222-
We will have to translate the classical data point \(\vec{x}\)
223-
into a quantum datapoint \(\vert \Phi{(\vec{x})} \rangle\). This can
224-
be achieved by a circuit $\mathcal{U}_{\Phi(\vec{x})} \vert 0\rangle$.
225-
226-
227-
Here $\Phi()$ could be any classical function applied
228-
on the classical data $\vec{x}$.
229-
!eblock
230-
!bblock
231-
We need a parameterized quantum circuit $W(\theta)$ that
232-
processes the data in a way that in the end we
233-
can apply a measurement that returns a classical value \(-1\) or
234-
\(1\) for each classical input \(\vec{x}\) that indentifies the label
235-
of the classical data.
236-
!eblock
237-
238-
239-
!split
240-
===== The most general ansatz =====
241-
242-
Following these steps we can define an ansatz for this kind of problem
243-
which is
244-
!bt
245-
\[
246-
W(\theta) \mathcal{U}_{\Phi}(\vec{x}) \vert 0 \rangle.
247-
\]
248-
!et
249-
250-
These kind of ansatzes are called quantum variational circuits.
251-
252-
!split
253-
===== Quantum SVM =====
254-
255-
In the case of a quantum SVM we will only use the quantum feature maps
256-
!bt
257-
\[
258-
\mathcal{U}_{\Phi(\vec{x})},
259-
\]
260-
!et
261-
to translate the classical data into
262-
quantum states and build the Kernel of the SVM out of these quantum
263-
states. After calculating the Kernel matrix on the quantum computer we
264-
can train the Quantum SVM the same way as the classical SVM.
265-
266-
267-
!split
268-
===== Defining the Quantum Kernel =====
269-
270-
The idea of the quantum kernel is exactly the same as in the classical
271-
case. We take the inner product
272-
!bt
273-
\[
274-
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,
275-
\]
276-
!et
277-
but now with the quantum feature maps
278-
!bt
279-
\[
280-
\mathcal{U}_{\Phi(\vec{x})}.
281-
\]
282-
!et
283-
284-
The idea is that if we choose a quantum feature maps that is not easy
285-
to simulate with a classical computer we might obtain a quantum
286-
advantage.
287-
288-
289-
!split
290-
===== Side note =====
291-
292-
There is no proof yet that the QSVM brings a quantum
293-
advantage, but the argument the authors of
294-
URL:"https://arxiv.org/pdf/1804.11326.pdf" make, is that there is
295-
for sure no advantage if we use feature maps that are easy to simulate
296-
classically, because then we would not need a quantum computer to
297-
construct the Kernel.
298-
299-
!split
300-
===== Feature map =====
301-
302-
For the feature maps we use the ansatz
303-
!bt
304-
\[
305-
\mathcal{U}_{\Phi(x)} = U_{\Phi(x)} \otimes H^{\otimes n},
306-
\]
307-
!et
308-
where
309-
!bt
310-
\[
311-
U_{\Phi(x)} = \exp \left( i \sum_{S \in n} \phi_S(x) \prod_{i \in S} Z_i \right),
312-
\]
313-
!et
314-
which simplifies a lot when we (like in URL:"https://arxiv.org/pdf/1804.11326.pdf") only consider
315-
$S \leq 2$ interactions, which means we only let two qubits interact
316-
at a time. For $S \leq 2$ the product $\prod_{i \in S}$ only leads
317-
to interactions $Z_i Z_j$ and non interacting terms $Z_i$. And the
318-
sum $\sum_{S \in n}$ over all these terms that are possible with $n$
319-
qubits.
320-
321-
!split
322-
===== Classical functions =====
323-
324-
Finally we define the classical functions $\phi_i(\vec{x}) = x_i$ and
325-
$\phi_{i,j}(\vec{x}) = (\pi - x_i)( \pi- x_j)$.
326-
327-
If we write this ansatz for 2 qubits and $S \leq 2$ we see how it
328-
simplifies:
329-
!bt
330-
\[
331-
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).
332-
\]
333-
!et
334-
We won't get into details to much here, why we would take this ansatz.
335-
It is simply an ansatz that is simple enough an leads to good results.
336-
337-
Finally we can define a depth of these circuits. Depth 2 means we repeat
338-
this ansatz two times. Which means our feature map becomes
339-
$U_{\Phi(x)} \otimes H^{\otimes n} \otimes U_{\Phi(x)} \otimes H^{\otimes n}$.
340-
341210

342211
!split
343212
===== Plans for next week =====
@@ -508,7 +377,7 @@ evaluate such kernels systematically .
508377
!split
509378
===== Quantum feature map =====
510379

511-
Aquantum feature map
380+
A quantum feature map
512381
$\bm{x}\mapsto\vert \phi(\bm{x})\rangle$ combined with the kernel
513382
$k(\bm{x},\bm{x}’)=\vert \langle\phi(\bm{x})\vert \phi(\bm{x}’)\rangle\vert ^2$
514383
defines a QSVM kernel. The intuition is that the quantum device is
@@ -1060,4 +929,135 @@ In summary, these examples show how to apply QSVM end-to-end. For each, the ste
1060929

1061930

1062931

932+
!split
933+
===== Quantum SVMs =====
934+
935+
The idea of a classical SVM is that we have a set of points
936+
that are in either one group or another and we want to find a line that
937+
separates these two groups. This line can be linear, but it can also be
938+
much more complex, which can be achieved by the use of Kernels.
939+
940+
!split
941+
===== What will we need in the case of a quantum computer? =====
942+
943+
!bblock
944+
We will have to translate the classical data point \(\vec{x}\)
945+
into a quantum datapoint \(\vert \Phi{(\vec{x})} \rangle\). This can
946+
be achieved by a circuit $\mathcal{U}_{\Phi(\vec{x})} \vert 0\rangle$.
947+
948+
949+
Here $\Phi()$ could be any classical function applied
950+
on the classical data $\vec{x}$.
951+
!eblock
952+
!bblock
953+
We need a parameterized quantum circuit $W(\theta)$ that
954+
processes the data in a way that in the end we
955+
can apply a measurement that returns a classical value \(-1\) or
956+
\(1\) for each classical input \(\vec{x}\) that indentifies the label
957+
of the classical data.
958+
!eblock
959+
960+
961+
!split
962+
===== The most general ansatz =====
963+
964+
Following these steps we can define an ansatz for this kind of problem
965+
which is
966+
!bt
967+
\[
968+
W(\theta) \mathcal{U}_{\Phi}(\vec{x}) \vert 0 \rangle.
969+
\]
970+
!et
971+
972+
These kind of ansatzes are called quantum variational circuits.
973+
974+
!split
975+
===== Quantum SVM =====
976+
977+
In the case of a quantum SVM we will only use the quantum feature maps
978+
!bt
979+
\[
980+
\mathcal{U}_{\Phi(\vec{x})},
981+
\]
982+
!et
983+
to translate the classical data into
984+
quantum states and build the Kernel of the SVM out of these quantum
985+
states. After calculating the Kernel matrix on the quantum computer we
986+
can train the Quantum SVM the same way as the classical SVM.
987+
988+
989+
!split
990+
===== Defining the Quantum Kernel =====
991+
992+
The idea of the quantum kernel is exactly the same as in the classical
993+
case. We take the inner product
994+
!bt
995+
\[
996+
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,
997+
\]
998+
!et
999+
but now with the quantum feature maps
1000+
!bt
1001+
\[
1002+
\mathcal{U}_{\Phi(\vec{x})}.
1003+
\]
1004+
!et
1005+
1006+
The idea is that if we choose a quantum feature maps that is not easy
1007+
to simulate with a classical computer we might obtain a quantum
1008+
advantage.
1009+
1010+
1011+
!split
1012+
===== Side note =====
1013+
1014+
There is no proof yet that the QSVM brings a quantum
1015+
advantage, but the argument the authors of
1016+
URL:"https://arxiv.org/pdf/1804.11326.pdf" make, is that there is
1017+
for sure no advantage if we use feature maps that are easy to simulate
1018+
classically, because then we would not need a quantum computer to
1019+
construct the Kernel.
1020+
1021+
!split
1022+
===== Feature map =====
1023+
1024+
For the feature maps we use the ansatz
1025+
!bt
1026+
\[
1027+
\mathcal{U}_{\Phi(x)} = U_{\Phi(x)} \otimes H^{\otimes n},
1028+
\]
1029+
!et
1030+
where
1031+
!bt
1032+
\[
1033+
U_{\Phi(x)} = \exp \left( i \sum_{S \in n} \phi_S(x) \prod_{i \in S} Z_i \right),
1034+
\]
1035+
!et
1036+
which simplifies a lot when we (like in URL:"https://arxiv.org/pdf/1804.11326.pdf") only consider
1037+
$S \leq 2$ interactions, which means we only let two qubits interact
1038+
at a time. For $S \leq 2$ the product $\prod_{i \in S}$ only leads
1039+
to interactions $Z_i Z_j$ and non interacting terms $Z_i$. And the
1040+
sum $\sum_{S \in n}$ over all these terms that are possible with $n$
1041+
qubits.
1042+
1043+
!split
1044+
===== Classical functions =====
1045+
1046+
Finally we define the classical functions $\phi_i(\vec{x}) = x_i$ and
1047+
$\phi_{i,j}(\vec{x}) = (\pi - x_i)( \pi- x_j)$.
1048+
1049+
If we write this ansatz for 2 qubits and $S \leq 2$ we see how it
1050+
simplifies:
1051+
!bt
1052+
\[
1053+
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).
1054+
\]
1055+
!et
1056+
We won't get into details to much here, why we would take this ansatz.
1057+
It is simply an ansatz that is simple enough an leads to good results.
1058+
1059+
Finally we can define a depth of these circuits. Depth 2 means we repeat
1060+
this ansatz two times. Which means our feature map becomes
1061+
$U_{\Phi(x)} \otimes H^{\otimes n} \otimes U_{\Phi(x)} \otimes H^{\otimes n}$.
1062+
10631063

0 commit comments

Comments
 (0)