Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 9b930fd

Browse files
author
Ilia Lazarev
committed
Fix latex style and pictures
1 parent 4a5efd4 commit 9b930fd

File tree

3 files changed

+31
-28
lines changed

3 files changed

+31
-28
lines changed

convergence.png

17.9 KB
Loading

distance_matrix.png

-225 Bytes
Loading

manuscript.tex

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ \subsection{The classical algorithm}
175175
\end{enumerate*}
176176

177177

178-
On a step $t$ when the BMU $w_{c}$ is selected,
179-
the weights of the BMU and its neigbours on feature map are adjusted according to
178+
On a step $t$ when the BMU $\vec{w}_{c}$ for a input $\vec{x}(t)$ is selected,
179+
the weights $\vec{w}_{i}$ of the BMU and its neigbours on feature map are adjusted according to
180180
%
181181
\begin{equation}
182182
\label{eq:learning}
183-
\vec{w_{i}}(t + 1)
184-
= \vec{w_i}(t)
183+
\vec{w}_{i}(t + 1)
184+
= \vec{w}_{i}(t)
185185
+ \theta(c, i, t) \alpha(t)
186-
\left(\vec{x}(t) - \vec{w_i}(t)\right),
186+
\left(\vec{x}(t) - \vec{w}_{i}(t)\right) ,
187187
\end{equation}
188188
%
189189
where $\alpha(t)$ is the learning rate and $\theta(c, i, t)$ is the neighbor function,
@@ -193,7 +193,7 @@ \subsection{The classical algorithm}
193193

194194
Intuitively, this procedure can be geometrically interpreted as iteratively moving the cluster vectors in space one at a time in a way
195195
that ensures each move is following the current trends inferred from their distances to the input objects.
196-
A visualisation of this process is shown in Fig. \ref{fig:sofm_fitting}.
196+
A visualisation of this process is shown in Fig.~\ref{fig:sofm_fitting}.
197197

198198
In SOFM original version was designed to cluster real-valued data
199199
and the winning cluster vector is selected based on the Euclidean distance between an input vector and the cluster vectors.
@@ -263,19 +263,19 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
263263
The registers $\left| X \right\rangle$ and $\left| Y \right\rangle$ are initialized to store the input vectors and cluster vectors according to
264264
%
265265
\begin{align}
266+
\label{eq:encodnig}
266267
\left| X \right\rangle & = \frac{1}{\sqrt{k}} \sum\limits_{i=1}^{k} \left| x_i \right\rangle, \\
267268
\left| Y \right\rangle& = \frac{1}{\sqrt{l}} \sum\limits_{j=1}^{l} \left| y_j \right\rangle .
268-
\label{eq:encodnig}
269269
\end{align}
270270
%
271271
The two registers along with the auxiliary qubit comprise the initial state of the quantum computer according to
272272
%
273273
\begin{equation}
274-
\left| \psi_0 \right\rangle =
274+
\label{eq:initial_state}
275+
\left| \psi_0 \right\rangle =
275276
\left| X \right\rangle
276277
\left| Y \right\rangle
277-
\left| a \right\rangle
278-
\label{eq:initial_state}
278+
\left| a \right\rangle ,
279279
\end{equation}
280280
%
281281
where $\left| a \right\rangle$ is an auxiliary qubit in the state $\left| 0 \right\rangle$ initially.
@@ -287,7 +287,7 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
287287
\frac{1}{\sqrt{kl}} \sum_{i, j=1}^{k}
288288
| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \rangle
289289
| y^{(1)}_j, \dots, y^{(n)}_j \rangle
290-
| 0 \rangle
290+
| 0 \rangle ,
291291
\end{equation}
292292
%
293293
where $d^{(\alpha)}_{ij} = \mathrm{CNOT}(y^{(\alpha)}_i, x^{(\alpha)}_j)$, and $\alpha = 1 \dots n$ is the qubit index in the register.
@@ -306,11 +306,11 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
306306
0 & e^{-i \frac \phi 2} & 0 & 0 \\
307307
0 & 0 & 1 & 0 \\
308308
0 & 0 & 0 & e^{i \frac \phi 2}
309-
\end{pmatrix} .
310-
\quad \phi = \frac{\pi}{n}
309+
\end{pmatrix} ,
310+
\quad \phi = \frac{\pi}{n}.
311311
\end{equation}
312312
%
313-
Finally, another Hadamard gate is applied on the ancilla qubit (see Fig. \ref{fig:qcircuit}).
313+
Finally, another Hadamard gate is applied on the ancilla qubit (see Fig.~\ref{fig:qcircuit}).
314314

315315
After the first Hadamard on the ancilla qubit the state is
316316
%
@@ -341,7 +341,7 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
341341
\right)
342342
\left| d_{ij} \right\rangle
343343
\left| y_j \right\rangle
344-
\left| 1 \right\rangle
344+
\left| 1 \right\rangle .
345345
\end{multline}
346346
%
347347
Applying another Hadamard on the ancilla qubit we obtain
@@ -406,8 +406,8 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
406406
From those amplitudes estimations we are able to plot the distance matrix between two data sets of binary vectors.
407407
The probability amplitude of the ancilla qubit outcomes captures the exact Hamming distance as the result of the preprocessing function.
408408
There are two possible outcomes of measurement of the ancilla qubit, each has own probability amplitude and own interpretation of that amplitude.
409-
For instance, for the \left| 0 \right\rangle outcome, the larger the amplitude the smaller the Hamming distance,
410-
and for the \left| 1 \right\rangle outcome it is the other way around, magnitude of the amplitude of that outcome is proportional to the Hamming distance.
409+
For instance, for the $\left| 0 \right\rangle$ outcome, the larger the amplitude the smaller the Hamming distance,
410+
and for the $\left| 1 \right\rangle$ outcome it is the other way around, magnitude of the amplitude of that outcome is proportional to the Hamming distance.
411411

412412
Measuring the Hamming distance of a particular pair of input vectors $\left| x_i \right\rangle$ and cluster vector $\left| y_j \right\rangle$ consists of extracting the relevant amplitude from the subspace that those states form,
413413
this can be done using the following projection operator
@@ -442,8 +442,8 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
442442
Currently available quantum platforms are still subject to substantial level of noise and extracting the exact distance from amplitude is still a difficult task.
443443
Fortunately, for most of algorithms, SOFM included, the information of nearest vectors is sufficient.
444444

445-
Because of that property, those algorithms fall into a special case category for which, as there is only one input vector considered, the ``Decoding'' stage (Fig.\ref{fig:qcircuit}) can be removed as measurement no longer needs to indicate for which input vector the distance has been measured.
446-
In this special case scenario the circuit depth complexity is matching with \cite{shuld2014}.
445+
Because of that property, those algorithms fall into a special case category for which, as there is only one input vector considered, the ``Decoding'' stage (Fig.~\ref{fig:qcircuit}) can be removed as measurement no longer needs to indicate for which input vector the distance has been measured.
446+
In this special case scenario the circuit depth complexity is matching with \cite{schuld2014}.
447447

448448
In the general case when multiple input vectors are present in the register, the ``Decoding'' stage still needs to be included leading to larger circuit depth and less attractive complexity in terms of number of controlled gate operations.
449449
The number of controlled gate operations in this general case of multiple input vectors is matching the number of controlled gate operations in \cite{trugenberger2001}.
@@ -506,28 +506,28 @@ \section{Experimental demonstration of QASOFM}
506506
where $N$ is number of samples,
507507
$M$ is number of randomly sampled cluster vectors,
508508
and $L$ is number of the shifts of cluster vectors.
509-
In the QASOFM described in the previous section, distance calculations are realized on a quantum device (i.e. the IBM Q Experience) with the use of circuit presented in Fig. \ref{fig:qcircuit}. This approach allows one to reduce the number of operations in a number of cluster states with an optimized number of gates
509+
In the QASOFM described in the previous section, distance calculations are realized on a quantum device (i.e. the IBM Q Experience) with the use of circuit presented in Fig.~\ref{fig:qcircuit}. This approach allows one to reduce the number of operations in a number of cluster states with an optimized number of gates
510510
that are possible to realize on quantum computing devices that are currently available.
511511
The circuit realized in such a manner
512512
that calculation of Hamming distance between the sample vector and all cluster vectors is realized in one operation.
513513
The complexity of the quantum assisted SOFM then scales as $O(LN)$.
514514

515-
In order to check that our algorithm gives the expected results we compare it to classical calculations of the distance matrix on two data sets of binary vectors, as shown in Fig. \ref{fig:distance_matrix}.
515+
In order to check that our algorithm gives the expected results we compare it to classical calculations of the distance matrix on two data sets of binary vectors, as shown in Fig.~\ref{fig:distance_matrix}.
516516
We see good agreement between the distance matrices calculated classically and on the IBM Q Experience.
517-
The theoretical calculations and classical simulations show perfect agreement with each other (Fig. \ref{fig:distance_matrix}(a)).
518-
The difference between Figs. \ref{fig:distance_matrix} (a) and (b) appears due to noise in the currently available non fault-tolerant quantum processors.
517+
The theoretical calculations and classical simulations show perfect agreement with each other (Fig.~\ref{fig:distance_matrix}(a)).
518+
The difference between Figs.~\ref{fig:distance_matrix} (a) and (b) appears due to noise in the currently available non fault-tolerant quantum processors.
519519

520520
An example of the QASOFM learning process is shown in Fig.~\ref{convergence}.
521521
Initially, the cluster vectors were randomly chosen (see Fig.~\ref{convergence})
522-
and the label of sample distribution is shown for the zeroth epoch in Fig.~\ref{convergence}(a). In order to prepare a superposition of cluster vectors needed for the calculation of the distance matrix we use the standard initialization of QISKIT library.
522+
and the label of sample distribution is shown for the zeroth epoch in Fig.~\ref{convergence}(a). In order to prepare a superposition of cluster vectors needed for the calculation of the distance matrix we use the standard initialization of QISKIT\cite{qiskit} library.
523523
Each epoch of the algorithm consists of distance calculation between all data and cluster vectors
524524
and requires 9 distance calculations in the quantum implementation ($N$ in general case)
525525
or 27 distance calculations for classical realization
526526
($MN$ in general case).
527527
After the distance calculation from each sample to all cluster vectors at each epoch we label each sample with the index of the closest cluster vector
528528
and shift the closest cluster vectors to the sample one.
529529
The shift is made by the change of the first binary element in the cluster vectors different from the sample one.
530-
The evolution of the labels presented on Fig. ~\ref{convergence}(c).
530+
The evolution of the labels presented on Fig.~\ref{convergence}(c).
531531
Good convergence is already observed in the fourth epoch.
532532

533533
This proof of concept example shows that developing of noisy intermediate scale quantum hardware will allow to solve some practical problems in unsupervised manner with very simple encoding of categorical data to quantum register.
@@ -566,7 +566,12 @@ \section{Discussions}
566566
where $N$ is number of samples, $M$ is number of randomly sampled cluster vectors,
567567
and $L$ is number of the shifts of cluster vectors.
568568
Due to wide use of classical SOFMs in different areas of modern research and technology,
569-
this can give opportunities for the use of QASOFM in practical applications in near term, outperforming classical algorithms. In addition, as our algorithm performs the Hamming distance calculation, it has potential to enhance any classical algorithm that relies on calculating distances between data entries of vector form. In machine learning, data science, statistics and optimization, distance is a common way of representing similarity, calculating it between large data sets is common procedure and our circuit could potentially enhance other distance-based algorithms as long as exact distance is not required, but when knowledge of nearest vectors is sufficient.
569+
this can give opportunities for the use of QASOFM in practical applications in near term, outperforming classical algorithms.
570+
In addition, as our algorithm performs the Hamming distance calculation,
571+
it has potential to enhance any classical algorithm that relies on calculating distances between data entries of vector form.
572+
In machine learning, data science, statistics and optimization, distance is a common way of representing similarity, calculating it between large data sets is common procedure
573+
and our circuit could potentially enhance other distance-based algorithms as long as exact distance is not required,
574+
but when knowledge of nearest vectors is sufficient.
570575

571576

572577

@@ -596,6 +601,4 @@ \section*{Keywords}
596601
\bibliographystyle{naturemag}
597602
\bibliography{bibliography}
598603

599-
%\begin{thebibliography}{99}
600-
%\end{thebibliography}
601604
\end{document}

0 commit comments

Comments
 (0)