Design and Analysis of a Quantum Circuit to Cluster a Set of Data Points

Clustering is a powerful tool which has been used in several applications (such as, fraud detection, pattern matching etc.). It is known to all that quantum counterpart is more superior to classical one on some specific areas. Quantum computation can solve certain problems much faster than classical computation. This paper mainly proposes a quantum circuit to cluster a given set of points with respect to pre-defined points. It uses binary quantum logic and superpositions principle of quantum mechanics. This proposed approach is a collaboration of data mining techniques with quantum computation. Very few works have been done in this area. In this paper, some of the previous works are also analyzed on the idea of applying quantum concept to the classical approach of clustering algorithms.


Introduction
In modern world, power dissipation is one of the critical issues while measuring the performance of an integrated circuit. From Landauer's statement, each bit of information loses kTln2 joules of energy during logical computations (where k is the Boltzmann's constant and T is the operating temperature) [5]. It has a major impact on various technologies like VLSI, Embedded systems. However, the use of reversible/quantum logic circuit helps to reduce the temperature by evacuating the radiated heat. In reversible gate the number of inputs is equal to the number of outputs and no fan-out is permitted. In this paper we present a circuit to cluster a set of given points with respect to pre-defined points. We use quantum gates and circuitry such as qFT circuit, discrete phase gate, quantum comparator circuit. We also use quantum registers to store the qubits. Some important reversible logic (necessary for the proposed work) are described below.

The Qubit
The basic unit of information in quantum computing is called the qubit, which is short form quantum bit. Like a bit, a qubit can also be in one of two states. In the case of a qubit, we label these two states by |0>and |1>. In quantum theory an object enclosed using the notation | > can be called a state, a vector, or a ket. While a bit in an ordinary computer can be in the state 0 or in the state 1, a qubit can exist in the state |0> or the state |1>, but it can also exist in a superposition state i.e. a state that is a linear combination of the states |0> and |1>. If we label this state |ψ>, a superposition state is written as |ψ> = α|0> + β|1> Here α, β are complex numbers of the form z =x +iy [1].
The advantages of quantum computers over classical ones are: In digital computer circuit an n bit representation of bits can be one of 2 n states but only one at a time whereas in quantum computers n qubits can be in any superposition of up to 2 n states simultaneously. The main advantage of quantum computing is a logarithmic reduction in the number of separate quantum systems needed to span the quantum memory. Quantum algorithms are much faster when compared to digital ones for searching, calculations and storing. Quantum computers are much more secure than digital ones. Quantum technology is inherently reversible and one of the most potential technologies for future computing systems. Heat generation in quantum circuits is less than that in digital circuits [11][12].

Hadamard gate
The Hadamard gate acts on a single qubit. It maps the basis state |0> to (|0>+|1>)/ √ 2 and |1> to (|0>-|1>)/ √2 and represents a rotation of π about the axis (x+z)/ √2. Eventually, if the combination of two rotations, π/2 about the Y-axis followed by π about the X axis, it is represented by Hadamard Matrix. x · y = x 0 y 0 + x 1 y 1 + ·· ·+x n−1 y n−1 The quantum Fourier transforms maps the state |ψ> = |x n−1 x n−2 … x 0 > into the state Where, and so on, to represent a binary fraction. There are two important things to notice here-superposition states and the introduction of phases. We build a circuit with Hadamard gates to introduce superposition states and for the phases, we will use the discrete phase gate. The Quantum Fourier transform circuit applied to a three qubit state is given below [1]: Controlled gate will allow us to implement an if -else type of construct with a quantum gate. In a controlled classical gate, we include a control bit C. If C =0, then the gate does nothing, but if C =1, then the gate performs some specified action. Controlled quantum (or controlled unitary) gates work in a similar fashion, using a control qubit to determine whether or not a specified unitary action is applied to a target qubit. The specific gate we will use in our circuit is given below, If the control qubit is |0>, then nothing happens. If the control qubit is |1>, then whatever is in |a>, it is passed through the target bit.
The possible input states to the CNOT gate are |00>, |01>, |10> and |11> and the action of the Controlled gate on these states is as follows: In our case, we will encounter only the last two cases. circuit. The circuit takes a total of four qubits as inputs out of which the last two |0> are given as garbage bits. We can determine which one of |a> and |b> is greater than the other or which one is smaller than the other by monitoring third and fourth output line.

Classical Concept of Clustering:
In classical concept, clustering can be done in various ways such as K-means method or K-medians method.
The procedure for performing K-means method is as follows: 1. Define the number of clusters k. 2. Initialize the k cluster centers (randomly, if necessary). 3. Decide the class memberships of the N objects by assigning them to the nearest cluster center. 4. Re-estimate the k cluster centers, by assuming the memberships found above are correct. 5. If none of the N objects changed membership in the last iteration, exit. Otherwise go to 3.
In the following diagram, there are three clusters based on three pre-defined fixed points. All the given input data points are grouped into these three clusters according to the above procedure. The outline of the paper is as follows. In Section 1 and 2, we review basics of quantum information processing and some existing quantum clustering approaches. In Section 3, we introduce our proposed work using the basic quantum subtractor, quantum fourier transforms and comparator logic circuits. In this section, the overall block diagram of our proposed approach is also explained. In section 4, a list of comparisons of our approach with other existing approaches is given. Finally, we conclude in Section 5 with a discussion of the issues that we have raised and also address some future works associated with it.

Literature Survey
In the paper named "Quantum Clustering Algorithms" by Esma Aïmeur, Gilles Brassard and Sébastien Gambs, they explained a way to implement K-medians algorithm using a black box implementation of the following three quantum algorithms: The quant_find_max algorithm, quant_cluster_median and an algorithm to find c smallest number. Unsupervised learning is the part of machine learning whose purpose is to give to machines the ability to find some structure hidden within data. Given a training data set, the goal of a clustering algorithm is to group similar datapoints in the same cluster while putting dissimilar datapoints in different clusters. Some possible applications of clustering algorithms include: discovering sociological groups existing within a population, grouping automatically molecules according to their structures, clustering stars according to their galaxies, and gathering news or papers according to their topic. In this part, it seeks to speed-up some classical clustering algorithms by drawing on QIP techniques. Here the concept of Grover's black box model (Oracle) is used for concerning the distance between points of the training dataset. In the classical black-box setting, a query corresponds to asking for the distance between two points x i and x j by providing indexes i and j to the black box. But here in quantum black box ("O"), it is possible to query the quantum black box in superposition of entries. For superposition of entries, Walsh-Hadamard gate is applied to all the input qubits initially set to |0>. In that case, the resulting output is a superposition of all the triples |i, j, Dist(x i , x j )>.The distance Oracle is illustrated below, In the above figure, Dist(x i , x j ) represents the distance between them. The addition |b + Dist(x i , x j )>is performed in an appropriate finite group between the ancillary register b and the distance Dist(x i , x j ). One classical clustering algorithm and its corresponding quantum oracle representation are given in table 3. The algorithm is used to find the pair of points that are farthest apart in the data set i.e. diameter of the dataset. The algorithm proposed by them is (n/k)^(.5) times faster than the classical approach. In their paper, they have shown how to speed up a selection of classical clustering algorithms by quantizing some of their parts [2] [12].
In the paper named "K-means v/s K-medoids: A Comparative Study" by Shalini S Singh and N C Chauhan, they gave a detailed discussion of two of the various partitioning based clustering methods namely K-means and K-medoids. They also cited various strengths and weaknesses of both the algorithms and came into a conclusion that the advantage of k-means is its low computation cost, while drawback is sensitivity to noisy data and outliers. On the other hand, k-medoid is not sensitive to noisy data and outliers, but it has high computation cost.
In the paper -Multi-Valued Logic Gates for Quantum Computation by Ashok Muthukrishnan and C. R. Stroud, Jr, he authors have developed a new approach for multi-level quantum system by decomposing any arbitrary unitary operations of d levels(d>2) into logic gates of two systems by which the number of ions required for computation is reduced by a factor log 2 d. In this paper, the authors have efficiently reduced the complexity of the multi valued simulation by a factor of log2d. But the use of non-logarithmic scaling brings inefficiency in the construction part. A lot of elementary gates are required which makes the circuit a little complex [9].
To enhance the clustering ability of self-organization network, a paper introduces a quantum inspired self-organization clustering algorithm. First, the clustering samples and the weight values in the competitive layer are mapped to the qubits on the Bloch sphere, and then, the winning node is obtained by computing the spherical distance between sample and weight value. Finally, the weight values of the winning nodes and its neighborhood are updated by rotating them to the sample on the Bloch sphere until the convergence [10].
One very new approach is introduced in the paper [7], which is referred to as 'Dynamic Quantum Clustering'. In this approach, a full-fledged dynamical scheme is introduced which uses a time-dependent Schrodinger equation. Moreover, Hamiltonian formalism is approximated by a truncated calculation within a set of Gaussian wave functions (coherent states) centered on the original points. This allows for analytic evaluation of the time evolution of all such states, opening up the possibility of exploration of relationships among data-points through observation of varying dynamical-distances among points and convergence of points into clusters.

Proposed Work
The circuit for subtracting two qubits is shown in Fig. 6. The overall circuit for the clustering algorithm is given in Fig.  5.
The various components used in the circuit in Fig. 5  A set of qubits is given. We need to cluster them with respect to some pre-defined points. Here for simplicity, the circuit diagram is shown for two pre-defined points. At a specific moment, the given stream of input qubits is denoted by |a>. K 1 and K 2 are the two pre-defined points. |a> is sent as one of the inputs in both of the Subtractor Circuitry. K 1 and K 2 are passed through the Quantum Fourier Circuitry first and the output of Quantum Fourier Circuitry is sent as the second input of the Subtractor Circuitry. The Subtractor Circuitry calculates the difference between input points and the pre-defined points with respect to which clusters are to be made. The differences from both the Subtractor Circuitry are sent to the Quantum Comparator. Quantum Comparator determines which pre-defined point, the input qubit is nearer to. According to the output of Comparator, the controlled Quantum gates determine in which Cluster, the input Qubit belongs. To explain how the Subtractor Circuit works, we show a general example below. Let us consider two integer numbers a and b stored in distinct registers, each constituted by n qubits; if the circuit for qFT is applied to the ket |a>=|a 1 a 2 a 3 …a n> the representative state of number a, its most significant qubit will be in a superposition of the form, At this point, the -ve phase shift gate is applied. For simplification, only the state of the most significant qubit during the calculation is shown [3], A specific example will greatly clarify the above mentioned procedure. Let us consider the integer 3 which, in a binary form is expressed by 11. So it can be coded in state |11>; we want to subtract integer 1 which is coded in state |01>.
Advances in Signal Processing 4(2): 7-12, 2016 11 1) Thus state |10> is obtained that represents integer 2. [3] Now an overall working of the proposed circuit is shown by taking a specific example.
Let the two pre-defined points be |011> and |110> and the set of given qubits are {|001>, |010>, |110> and |111>},   'Quantum Clustering Algorithms' approach is not necessarily realistic because it requires the availability of a quantum black box that can be used to query the distance between pairs of points in superposition [2].
In proposed approach, we are not using any black box or quantum oracle concept. However, we have built our proposed quantum model using some basic quantum circuits (like, qFT, quantum comparator, quantum subtractor etc.) Circuit complexity is more in exiting approaches [7,10]. Circuit complexity is less because it is a combination of small quantum circuits. Quantum self-organization network clustering algorithm is more powerful than our proposed approach but it is a costly approach in terms of computing efficiency for enhancing clustering ability.
This approach is less costly in terms of computing efficiency.

Comparisons
The proposed quantum approach has several benefits over the existing approaches to some certain extents. This approach is specially developed to cluster a set of data points which can be applied in various applications where clustering plays a major role. The comparisons details are given in the table 2.

Conclusion & Future Work
The proposed circuit in this paper only work for one iteration. There is a huge scope of improvement that can be made if the circuit is made to work for multiple iterations. That way we can refine the clusters to greater accuracy. The proposed circuit can be used in complex computational units in future research. In the beginning of 21 st century, we see a sudden outburst of noisy data which are very difficult to organize by finding correct patterns with the help of traditional data processing tools. Quantization of traditional clustering algorithms can greatly help us in organizing huge amount of data. Though the research done in this field is very limited but the results are promising and there is room for a lot of works to be done.