Quantum Classiﬁcation Algorithm Based on Competitive Learning Neural Network and Entanglement Measure

: In this paper, we develop a novel classiﬁcation algorithm that is based on the integration between competitive learning and the computational power of quantum computing. The proposed algorithm classiﬁes an input into one of two binary classes even if the input pattern is incomplete. We use the entanglement measure after applying unitary operators to conduct the competition between neurons in order to ﬁnd the winning class based on wining-take-all. The novelty of the proposed algorithm is shown in its application to the quantum computer. Our idea is validated via classifying the state of Reactor Coolant Pump of a Risky Nuclear Power Plant and compared with other quantum-based competitive neural networks model.


Introduction
Quantum neural networks (QNNs) is a research domain that proposes neural network models based on quantum computing postulates [1]. One of the main advantages of classical artificial neural networks (CANNs) is its ability to perform computations in parallel [2]. However implementing CANNs on traditional computers does not offer this advantage. Traditional computers allow computations based on the bit value that is either "0" or "1". R. Feynman suggested that performing that quantum computation is also perfectly possible at the quantum bit (qubit) level [3] on the grounds of the superposition phenomenon. In fact, quantum computations are based on quantum correlations [4][5][6][7], particularly, quantum entanglement [8]. Therefore, the learning phase is expected to be much faster than CANNs due to quantum parallelism.

Quantum Competitive Learning
A well-known learning technique in ANNs is competitive learning. The technique is useful for classification applications and has the potential to implement associative memory for a set of predefined patterns. Competitive learning is inspired in biological neural networks, and accommodates ANNs based on a neural configurations where only one neuron fires, winner-take-all, at a tine at a given iteration. In competitive learning, a neuron will be a winner if it has the largest weighted input compared with the other neurons in the competitive layer. Several neural network algorithms based on the competitive learning were proposed such as the Hamming neural network (HNN), self-organizing feature map (SOM) and learning vector quantization (LVQ) [2].
HNN is used to find the degree of similarity between an input vector and the weight vector of each neuron in the network. HNN consists of two layers L1 and L2. L1 is called the input matching layer, while L2 is called the competitive layer. The Hamming distance between an input pattern and prototype patterns is calculated via Layer, whereas the most matched storage pattern to the input pattern is obtained based on the rule of minimum distance, via L2 layer. Figure 1 shows the topology structure of the classical HNN. Four models of competitive learning based on quantum properties have been proposed to maximize the efficiency of classical competitive neural networks. The first model was developed in 1999 by Ventura [23], who proposed a competitive learning algorithm inspired by the properties of quantum computing to be implemented on traditional computers only. Moreover, the learning algorithm of this model requires to be adapted with threshold parameter depending on the application at hand. The second model, developed by Zhou [20,21] in 2007, established the quantum algorithm that stores a set of predefined patterns in the memory of n neurons. This model increases the storage capacity of the neurons exponentially in contrast to classical neurons. Then, in 2010, Zhou proposed a quantum version of competitive CANNs that comprised two phases. The first phase is the storing phase, and is used to store the patterns in the neurons of the competitive ANNs. In the second phase, the competitive phase, Zhou proposed a quantum algorithm that allows the competition between neurons when an input pattern is presented to the network [21]. The primary defect of Zhou's competitive model [21] that the wining pattern is decided with low probability, because this model recalls the wining pattern based on decreased probability of the undesired patterns. Therefore, the probability of the wining pattern is decreased as the number of the stored patterns increases in the storing phase [38]. Zhong and Yuan proposed the third model of quantum competitive learning using Grover's algorithm [41]. This is in order to perform the competition between the neurons to recall the wining pattern when an incomplete pattern is presented to their model [40]. They showed that recalling pseudo-patterns is inevitable on their competitive model [40]. The final model was developed in 2015 is called HQNN model [38]. In this model, competitive learning is conducted as a hybrid of quantum and classical computation so that the competitive phase is performed on two competitive layers. The first layer allows competitions between neurons using quantum gates, where the second layer uses nonlinear operation to find the winning neuron based on the winner-take-all technique. Unlike the Ventura model [23], HQNN model [38] does not have a threshold parameter, and unlike Zhou's model [21], it recalls the winning pattern only and discards the undesired patterns. Additionally, HQNN model does not recall pseudo patterns as Zhong's and Yuan's model does [38], however, it cannot be fully implemented in real quantum computers because the winning pattern is only retrievable using classical operation.

Quantum Gates
According to quantum mechanics postulates [1], the evolution of the quantum systems is allowed only through unitary operators. An arbitrary operator A is unitary if and only if AA † = A † A = I, where A † = (A * ) T . So, quantum gates are unitary operators. So far, quantum computations are performed practically through the quantum circuit model. The proposed competitive algorithm uses quantum negation gate X, CNOT gate and finally the Toffoli-gate. The quantum negation gate, X = |1 0| + |0 1|, negates the state of a qubit. CNOT gate, CNOT|u, v = |u, (u + v) mod 2 , is acting on two qubits together one of them is the control qubit, and the other is the target qubit. This gate negates the state of the target qubit only if the state of the control qubit is "1". On the other hand, Toffoli gate (T 2 ) acts up on three qubits, two of which are used as control qubits, and the third is the target qubit. The whole gate is described as follows [42]: In other words, Toffoli gate (T 2 ) negates the third qubit only if the first two qubits are in the state |11 . The general form of applying the Toffoli gate (T j ) on j + 1 qubits is defined as: where the superscript j represents the number of control qubits. Toffoli (T j ) gate negates the indexed qubit u j+1 only if the first j qubits are in the state |11...1 . These gates will be used to propose the quantum classification algorithm based on competitive neural network (see Section 5).

Methodology
Entanglement is a type of the quantum correlations [6,[43][44][45][46][47][48] that distinguishes the behavior of quantum mechanics. A two-qubit system becomes an entangled states if the state of one qubit cannot be separated from the state of the other. Entanglement cannot be detected directly, so entanglement measures [49][50][51] were proposed to determine the degree of entanglement in a quantum system. Various measurements are proposed to measure the strength of the entanglement between two-qubit systems such as concurrence, witness, and negativity among others [50,52,53]. However, the strength of entanglement in a two-qubit system is often measured using concurrence measure [50,51]. An arbitrary, pure two-qubit state has the form its concurrence measure is defined theoretically as follows [54]: where 0 ≤ C ≤ 1. It is obvious that if the state of the two-qubit system is defined by the state α|00 + β|11 , the concurrence value becomes 2|αβ| [55]. Concurrence measure operator, denoted M z , was proposed to solve some quantum computation problems [56]. For example, some researchers used this operator to increase the computational speed for testing junta variables [57] and measuring the Hamming distance between boolean functions [58] quantum mechanically. The circuit model of M z operator was proposed as shown in Figure 2 when applied on arbitrary two qubits |u and |v . The state of the qubit |v is initialized in the vacuum state |0 and the state of the qubit |u is arbitrary. The M z is a unitary operator that applies the CNOT gate between the qubits |u and |v followed by measuring the degree of entanglement in between through the operator D. The M z operator creates the entangled state |uv = α|00 + δ|11 , then it measures the concurrence between the qubits |u and |v as C > 0 through the operator D only if the input qubit |u is in the state |u = α|0 + δ|1 , while it leaves them disentangled in the state |uv = |00 , then it measures the concurrence value in between as C = 0 through the operator D only if the input qubit |u is in the state |u = |0 . Some suggestions to implement the operator D using experimental setups are depicted in [51,55,59]. However, concretely in this paper, we propose to implement the operator D in the operator M z using Romero et al. protocol [54]. This protocol implements Equation (3) quantum mechanically, and the circuit model of this protocol is depicted in Figure 3. This protocol requires two copies of the two-qubit pure state given by Equation (2). This protocol is summarized in the following steps:

1.
Prepare two copies of the two-qubit state given by Equation (2) as follows:

2.
CNOT gate is applied between the second and the forth qubits, respectively, followed by the rotation R gate as follows: where the subscripts in the CNOT η 0 2 η 0 4 gate represent the control and the target gate, respectively. However, the unitary R gate rotate the state of the qubit as follows: Therefore, the state of the system is as follows: Comparing Equation (3) and Equation (4), we obtain where P 0000 and P 1010 are the success probability for obtaining the state |0000 and |1010 , respectively. end.
So, taking this into account, our proposal to implement the operator D using Romero et al. circuit [54], transforms the circuit model of the M z operator from Figures 2-4. It is obvious that M z operator applies two main operations. In the first operation, the CNOT gate is applied on each replica of the two-qubit systems |u and |v as the control qubit and as a target qubit, respectively. Accordingly, there are two cases: (i) The state of each replica of the two-qubit |uv system will be entangled, |uv = α|00 + δ|11 , only if |u = α|0 + δ|1 . Consequently, when the second operation of the operator M z operator is applying the operator D on the state |uv ⊗ |uv as shown in Figure 4. Therefore, the state of the system is as follows: Comparing Equation (3) and Equation (6), we obtain C = 2 2P 0000 , C = 2 2P 0100 , C = 2 2P 1010 or C = 2 2P 1110 .
Then the concurrence can be estimated using one of the formulas shown in Equation (7).
(ii) On the other hand, the state of the system will be separable in the state |uv = |00 if the state of the qubit |u is |0 . Again, when the second operation of the operator M z operator is applying the operator D on the state |uv ⊗ |uv as shown in Figure 4. Therefore, the state of the system is as follows: So, in this case the concurrence value is C = 0. Eventually, the operator D in M z operator measures the concurrence value between the two qubits |u and |v , by estimating the probability of obtaining the probability of the state |0000 , |0100 , |1010 , or |1110 , therefore the concurrence value is given by Equation (7). M z will be used in the last step int the proposed algorithm (see Section 5). Figure 3. The circuit model of Romero et al. [54] protocol to measure the entanglement between two qubits defined by the state given by Equation (2). By feeding two copies of the state given by Equation (2) to this circuit model. The protocol applies a controlled-not (CNOT) gate between the qubits indexed by 2 and 4, respectively. The σ y gate is applied on the third and fourth qubits and followed by the rotation gate R, therefore the measurement process is performed on the four qubits.

The proposed Quantum Classification Algorithm Based on Competitive Learning and Entanglement Measure: Case Study
Quantum competitive neural networks consists of two layers namely quantum-storing layer and quantum-competitive layer [21,38]. Quantum-storing layer stores M defined prototype patterns in advance with equal probabilities via n neurons using the Zhou's storage model (for more details see Section 5.1). Here, we propose the quantum classification algorithm based on competitive neural network. As for the quantum-competitive layer, the QCPNN algorithm classifies the input pattern into one of two classes "0" or "1". In this layer, the steps of the QCPNN algorithm conduct a competition between the prototype patterns to mark, by entanglement, the class of the closest prototype pattern to the input pattern. Eventually, to determine the winning class based on winner-take-all property, M z operator output only the winning class based on the value of the concurrence. The steps of the QCPNN algorithm are shown in Algorithm 1. According to step 1, the quantum system is initialized by three quantum registers, arranged as |inp, qn, uv . In step 2, when an input pattern is presented to QCPNN algorithm via register |inp , the competition process is performed by detecting the overlapping qubits between the register |inp and the register |qn , by applying the CNOT gate followed by the negation quantum gate X. Hence, the winning class, which is entangled with the matched pattern, is marked by entanglement via applying the Toffoli-gate T j+1 in step 3. This gate flips the state of the qubit |u to state |1 if the winning class is "1", therefore, the state of the qubit |u = M−1 M |0 + 1 M |1 . On the other hand, the gate T j+1 leaves the state of the qubit |u with no effect if the winning class is "0", therefore, the state of the qubit |u = |0 .

Algorithm 1 The proposed Quantum Classification Algorithm based on Competitive Learning and Entanglement Measure (QCPNN).
For an input pattern inp do{ 1. Initialization Step: |ψ 0 = |inp, qn, uv . Here, the quantum system is initialized by three quantum registers |inp , |qn and |uv of size n, n + 1 and 2 qubits, respectively. The register |qn represents the memory register that holds the prototype patterns, while |u and |v are the states of the other qubits. The first n qubits of the register |qn store the M prototype patterns, and the last qubit stores the class of the associated pattern. The input pattern that has a set h of j elements, where (j≤n) is presented to the network via the register |inp . The set h contains the indices of the qubits that have well known values. Finally, |uv is a two-qubit control register which are initialized by state |00 . 2. Apply the competitive detection operator between the input register |inp and the prototype register |qn as follows: In this step, the CNOT gate is applied between each qubit i ∈ h, of the resiter inp as a control qubit and the corresponding qubit i in the register qn as a target qubit. Then the negation gate X is applied on each qubit i ∈ h in the register qn. 3. Apply the Toffoli gate between j + 1 qubits of the register |qn as control qubits and the qubit |u as target qubit as follows: |ψ 2 = T j+1 (∏ i∈h qn i qn n+1 u) |ψ 1 .
In this step, the Toffoli gate (T j+1 ) is applied on j + 2 qubits, where the superscript j + 1 represents the number of control qubits. Toffoli gate (T j+1 ) negates the qubit u if the state of each qubit i belongs to the h and the state of the qubit qn n+1 are in the state |1 . 4. Repeat the steps 1, 2 and 3 to get another copy of |uv because M z operator needs two copies to quantify the degree of concurrence in between (see Section 4).
Remark: this step does not violate the non-cloning theorem [60] because when steps 1, 2 and 3 are repeated, a new different system is initialized in the first step and when the second and third steps are applied then a new copy of |uv is created, independently, without cloning the original state. 5. Apply the operator M z , shown in Figure 4, on the two copies of the state |uv and quantify the probability of the state |0000 , |0100 , |1010 or |1110 and use Equation (7) to quantify the concurrence value C. if C = 0 then inp ∈ class label "0". Else if C > 0 then inp ∈ 1 class label "1". } End.
In step 4, steps 1, 2 and 3 are repeated to generate a duplicate of the two-qubit system |uv that does not violate the non-cloning theorem [60], because M z operator requires two copies to quantify the degree of concurrence between the qubits |u and |v as explained in Section 4. Finally, in step 5, the M z operator is applied on the two copies of |uv to test the presence of entanglement between |u and |v by estimating the probability of the state |0000 , |0100 , |1010 or |1110 and use Equation (7) to quantify the concurrence value C. If the concurrence is C = 0, then the winning class is "0". On the other hand, if the value of the concurrence is C > 0, then the label of the winning class is "1".

Case Study
To explain the proposed algorithm in more detail, we will explain the proposed algorithm on the following synthesis data set. Suppose that we have a data set from two classes that are labeled "0" and "1". The prototype patterns of the class that is labelled by class "1" are three patterns in four attributes given as 1110, 1100 and 1011, while the prototype patterns of the class label "0", also, are three patterns in four attributes given as 0100, 0010 and 0001. So, the set of the prototype patterns can be written as follows: Pt = 11101, 11001, 10111, 01000, 00100, 00010 , (9) where in each pattern in the set Pt the first four values represent the attributes of the pattern, while the last value represents the class label. Assume that we have an incomplete input pattern that has missing attributes, e.g. inp = 1?0?, the sign "?" means that this pattern is incomplete in the second and the fourth qubits. To store M, where M = 6, predefined prototype patterns which are given by Equation (9) with equal probabilities in the quantum-storing layer, we use Zhou's storage model.

Quantum-Storing Layer Using Zhou's Storage Model
Zhou's storage model is initialized by three disentangled registers as follows: |p , |qn , and |c , the first and the second registers are composed of n qubit, while the third register is called the quantum control register that is a two-qubit system is initialized with the state |01 . The register |p is called the input register that stores the the classical prototype pattern p ∈ Pt into the quantum register |qn . Now lets processed to summarize the "quantum-sorting" in the following eight steps [20,38]:

•
Step 1: The quantum system is initialized by the three registers |p , |qn and |c as |ψ 0 = |p, qn, c .
Assuming that the input state is given by p = 11101, where the first pattern in Equation (9) is considered, so the initial state can be described as |ψ 0 = |11101, 00000, 01 .
So, it is clear that the pattern |11101 is stored in the first term of the quantum system (|ψ 7 ). Since, the value of |c register is |01 in the second term of the quantum system |ψ 7 , consequently the second pattern |11001 will be stored in the second term of the quantum system |ψ 7 when the quantum-storing algorithm is repeated again. The same procedure will be performed for the remaining prototype patterns. At the end of this storing phase, we will find both of the registers |p and |c are separable with the register memory |qn . That means the output of the quantum-storing layer using Zhou's storage model is the register |qn that stores the prototype patterns of the set Pt in a uniform superposition as follows:

Classification an Input Using the Proposed Algorithm
Here, we processed to classify the incomplete pattern inp = 1?0? using the proposed algorithm in Section 5 according to the following steps 1. Initialization Step: |ψ 0 = |inp, qn, uv .

3.
Apply the Toffoli-gate between j + 1 qubits of the register |qn and the qubit |u as control qubits and target qubit, respectively.

4.
Repeat the steps 1, 2 and 3 to get another decoupled copy of the state |uv .

5.
Apply the operator M z on the state |uv ⊗ |uv yields the state: Here, it is obvious that the probability of the state |0000 , |0100 ,|1010 or |1110 is non-zero, so according to Equation (7) the concurrence value C > 0. Then, the test pattern inp = 1?0? belongs to the class label "1".

Application
To evaluate the efficiency of the proposed algorithm, we conducted a fair comparison with some of other reported state-of-the-art classification algorithms to classify the state of Reactor Coolant Pump (RCP) in a risky Nuclear Power Plant (NPP). In the case of plant transients, the process of optimizing the outage gets more complex based on the neutronic parameters inside the reactor's core, and the thermal-hydraulic processes of primary and secondary coolant loops that are governing all the reactor's processes. These processes produce a massive stream of data that is processed simultaneously in a short time. Three Mile Island (TMI) accident is a typical example to illustrate the interference among the massive number of signals [61]. In TMI accident, the Loss Of Coolant Accident (LOCA) caused 500 alarms to appear in the first minute and 800 in the second-minute [61]. Instantly, the large number of alarms affects the psychological control of the human operator, and consequently his/her ability to reach the correct decision will be impaired. This leads to the operator's inability to determine the source of the failure precisely. To minimize the interference caused by these alarms, attention has been given to provide an intelligent support system [62]. This has been applied in a crucial part of the reactor's operation, i.e Reactor Coolant system (RCS) which is the primary cooling system in NPPs. RCS consists of four major components: a reactor vessel, the steam generator (SG), RCP and pressurizer. Here, the efficiency of the proposed QCPNN algorithm is validated via classifying the state of RCP in a risky NPP.
The state of RCP is characterized via 12 sensors that are reported in Table 1. According to the history that was recorded in real time during the accident of the Kori-2 PWR, these sensors transmitted fault signals that were recorded via 41 patterns of different faults. In this experiment, these patterns are used as prototypes to classify various faults into two type of classes: the high risk and low-risk mode. The current application requires 26 qubits of a real quantum computer which it is not available for research so far. So, the experiments are simulated using Java tool on a PC with a configuration 3.1 GHz Intel(R) Xeon(R) E5-2687 v3, and 64.00 GB RAM on 64-bit OS operating system. We have considered testing the classification accuracy when the patterns of alarms may appear incomplete assuming that there is sensors failure. Thermal barrier flow low s 3 No.1 seal differential pressure low s 4 Standpipe level low s 5 Charging pump flow low s 6 No.1 seal leak off flow low s 7 Bearing temperature high s 8 Seal injection flow low s 9 No.1 Seal leak off flow high s 10 Seal injection filter differential pressure high s 11 Standpipe level high s 12 Thermal barrier temperature high The classification rate of QCPNN is compared with Zhou's quantum competitive neural network (QCNN) approach [21], where both techniques are tested under unified experimental conditions. Since the outcome of both models is stochastic, so we conducted the experiments for 30 runs, each run consisted of one batch of simulations, and yielded one value for the classification rate. The classification rate is defined as follows: where t p , f p , t n , and f n indicate the true positive, false positive, true negative and false negative, respectively. The mean and standard deviation of the classification rate for the proposed model (QCPNN), and Zhou's model (QCNN) are reported in Figure 5. In this figure, red bars indicate mean values averaged over N = 30 runs, error bars indicate the corresponding standard deviations. It is clear from Figure 5 that the classification rate of the QCPNN algorithm based on entanglement measure outmatches the QCNN algorithm. Where, QCNN achieved a classification rate of 3.1% with standard deviation 2.3%. Conversely, QCPNN achieved 51.0% with standard deviation 2.4% in the classification rate. Then, we performed t-test between the results of the two models, we got p-value = 3.1753 × 10 −34 , which is < 0.001, so the difference is highly significant. In this regard, it is lucid from the results of the classification rate reported in Figure 5, and according to the t-test that the proposed QCPNN model is highly significantly better and more reliable compared with the competitor model QCNN [21] to perform pattern classification based on competitive learning quantum mechanically. Consequently, in this context, four essential remarks may be inferred. The first remark is that the proposed QCPNN model does not demand the designer to optimize any parameters values to accomplish the learning process efficiently. In contrast, this is the case in Ventura's [23] and Zhou's [21] competitive learning models, where the threshold parameter α and the number of control qubits, respectively, must be optimized in advance. The optimal values of these parameters depend on both the presented data set and the input patterns. In this regard, this remark assures the generalization of the proposed QCPNN learning model compared Ventura's [23] and Zhou's [21] competitive learning models. The proposed QCPNN model performs better than that of QCNN [21] in the classification rate. This better performance of the QCPNN compared to QCNN [21] is because the QCPNN algorithm finds the winning class by quantifying the degree of entanglement between the two qubits |u and |v which is an accurate measurement regardless of the value of the coefficients of the basis |00 and |11 . On the other hand, QCNN finds the wining pattern, which is stored with the probability amplitude 1 M , by minimizing the probabilities of the other patterns. So, as the number of stored patterns M increases, the probability of the wining pattern decreases. The third remark is that the HQNN model [38] cannot be implemented completely on real quantum computer in contrast with QCPNN that can be fully implemented on real quantum computers. The final remark is that the QCPNN model does not recall pseudo state(s), which is the main defect of Zhong's and Yuan's model [40]. As a result, the superiority of QCPNN is remarkable compared to other Quantum competitive algorithms [21,23,38,40].  [21], for classifying the state of RCP in a risky NPP. Red bars indicate mean values averaged over N = 30 runs, error bars indicate the corresponding standard deviations. The difference is highly significant (p = 3.1753 × 10 −34 < 0.001). For both models the number of neurons was set to 13.

Conclusions
We have proposed a novel algorithm to perform competitive learning which can be implemented in quantum computer. The proposed algorithm classifies the state of the incomplete pattern presented to the network using unitary operations and measuring the degree of the entanglement. Based on the entanglement measure, the proposed algorithm implements winner-take-all property to classify the state of the input pattern to one of two classes "0" and "1". The proposed QCPNN algorithm avoids the defects of other quantum competitive learning algorithms reported in the literature and applicable to quantum computers. The efficiency of the proposed QHNN algorithm has been tested via fair evaluation of a classification application. We found that QCPNN is a reliable quantum model of competitive learning compared to other quantum competitive algorithms [21,23,38,40].