3.1 The XOR representation problem

The XOR Boolean function representation problem is such that we want an output neuron to fire when the input neurons' firing patterns are reversed and to remain nonfiring when the input neurons' firing patterns are aligned. This means that the neural network's output follows the XOR truth table with the output neuron firing when the XOR function evaluates to "True" and not firing otherwise.

In this case, as shown in [4], the XOR function representation problem can be solved by a standard quantum feedforward neural network with no hidden layer, by taking advantage of quantum entanglement dynamics.

Formally, the quantum circuit, in the forward direction, can be represented by the following chain:

$$
\hat{C} = \hat{U}\_3 \hat{U}\_2 \hat{U}\_1 \tag{21}
$$

with the gates, respectively, given by:

$$
\hat{U}\_1 = \hat{U}\_{WH} \otimes \hat{U}\_{WH} \otimes \hat{1} \tag{22}
$$

$$
\hat{U}\_2 = |\mathbf{0}\rangle\langle\mathbf{0}| \otimes \hat{\mathbf{1}} \otimes \hat{\mathbf{1}} + |\mathbf{1}\rangle\langle\mathbf{1}| \otimes \hat{\mathbf{1}} \otimes \hat{\sigma}\_1 \tag{23}
$$

$$
\hat{U}\_3 = \hat{\mathbf{1}} \otimes |\mathbf{0}\rangle\langle\mathbf{0}| \otimes \hat{\mathbf{1}} + \hat{\mathbf{1}} \otimes |\mathbf{1}\rangle\langle\mathbf{1}| \otimes \hat{\sigma}\_1 \tag{24}
$$

We begin with all three neurons in a nonfiring dynamics; then, the propagation from input to output (in the forward direction of the computational circuit) yields:

$$
\left< s\_1 s\_2 s\_3 \middle| \hat{C} \middle| 000 \right> = \left< s\_1 s\_2 s\_3 \middle| \hat{U}\_3 \hat{U}\_2 \hat{U}\_1 |000 \right> = $$
 
$$
= \left< s\_1 s\_2 s\_3 \middle| \hat{U}\_3 \hat{U}\_2 \left( \frac{|000\rangle + |010\rangle + |100\rangle + |110\rangle}{2} \right) = 
$$
 
$$
= \left< s\_1 s\_2 s\_3 \middle| \hat{U}\_3 \left( \frac{|000\rangle + |010\rangle + |101\rangle + |111\rangle}{2} \right) = 
$$
 
$$
= \left< s\_1 s\_2 s\_3 \middle| \left( \frac{|000\rangle + |011\rangle + |101\rangle + |110\rangle}{2} \right) = 
$$
 
$$
= \frac{\delta\_{\flat\_{1\_1}} 0 \delta\_{\flat\_{2\_1}} 0 \delta\_{\flat\_{3\_1}} 0}{2} + \frac{\delta\_{\flat\_{1\_1}} 0 \delta\_{\flat\_{2\_1}} 0 \delta\_{\flat\_{3\_1}} 1}{2} + \frac{\delta\_{\flat\_{1\_1}} 1 \delta\_{\flat\_{2\_1}} 1 \delta\_{\flat\_{3\_1}} 0}{2} \tag{25}
$$

The result in Eq. (25) means that the only probed final alternatives are those where the XOR rule s<sup>3</sup> ¼ s<sup>1</sup> ⊕ s<sup>2</sup> holds; that is, these are the only alternatives where there is a nonzero amplitude.

Likewise, back propagation from the output to the input yields the same result, that is, the only responses come from outputs where the XOR rule s<sup>3</sup> ¼ s<sup>1</sup> ⊕ s<sup>2</sup> holds, as the following derivation shows:

In the case of experiments, the XOR rule is predominant, that is, the dominant frequencies are those consistent with the circuit; there are, however, also a few residual cases that deviate from the XOR rule, all with low relative frequencies. These deviations are to be expected on the actual physical devices. For the Tenerife device, the relative frequency of cases that follow the XOR rule is 0.857; for the

Theoretical and experimental implementation of the XOR representation problem on the QASM simulator,

One of the main problems in physical implementation of quantum computation is the presence of errors. Indeed, the equations are derived for an isolated circuit so that the only echoes are those matching the quantum circuit; therefore, in an isolated QUANN, the stochastic results from repeated trials tend, in a frequentist approach, to the actual probabilities with zero frequencies associated with the alternatives for which no echo is produced. This is a basic property of quantum mechanics as predicted by the theory, and explains that the QASM simulator gets a zero measure

Of course, if Bohm's conjecture regarding the subquantum dynamics [9, 10] is right, then, even for a sufficiently isolated circuit, small deviations coming from the subquantum level may be present and lead to echoes that do not correspond to those of the main computing circuit. In any other interpretation that does not assume a subquantum dynamics and that takes the formalism to be exact, then, such devia-

While we cannot rule out Bohm's subquantum hypothesis, we cannot also confirm it for now, since one never has a completely isolated circuit, and both conjectural lines (Bohmian and others) agree that some deviations on physical devices will

The differences between the two conjectural lines, for quantum computer science, are worth considering regarding quantum error correction; however, for now, in regard to the technological issue of quantum error correction, we cannot yet make use of Bohm's conjecture that the quantum probabilities are average quantities and that subquantum fluctuations may introduce small deviations that average out at the quantum level to lead to the main experimental agreement with the theory. Having provided, through the XOR problem, an example of how quantum neural computation can be run experimentally on IBM's quantum devices, we now address artificial intelligence (AI) applications; we are interested in the theoretical

tions, for an isolated system, are considered physically impossible.

Melbourne device, this relative frequency is 0.835.

Quantum Neural Machine Learning: Theory and Experiments

DOI: http://dx.doi.org/10.5772/intechopen.84149

Tenerife and Melbourne devices, with 8192 shots.

Figure 3.

107

for those alternatives for which there is no echo.

always be present due to the environment.

<sup>000</sup> <sup>C</sup>^ † � � � � � � s1s2s<sup>3</sup> D E <sup>¼</sup> h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † U^ 2 † U^ 3 † j i s1s2s<sup>3</sup> ¼ <sup>¼</sup> <sup>δ</sup><sup>s</sup>2,0h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † U^ 2 † j i <sup>s</sup>1s2s<sup>3</sup> <sup>þ</sup> <sup>δ</sup><sup>s</sup>2, <sup>1</sup>h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † U^ 2 † j i s1s21 � s<sup>3</sup> ¼ <sup>¼</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2,0h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † j i <sup>s</sup>1s2s<sup>3</sup> <sup>þ</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2, <sup>1</sup>h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † j iþ s1s21 � s<sup>3</sup> <sup>þ</sup>δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2,0h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † j i <sup>s</sup>1s<sup>21</sup> � <sup>s</sup><sup>3</sup> <sup>þ</sup> <sup>δ</sup><sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2, <sup>1</sup>h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup> † j i s1s2s<sup>3</sup> ¼ <sup>¼</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2,0δ<sup>s</sup>3,<sup>0</sup> 2 þ δ<sup>s</sup>1,0δ<sup>s</sup>2, <sup>1</sup>δ<sup>s</sup>3, <sup>1</sup> 2 þ δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2,0δ<sup>s</sup>3, <sup>1</sup> 2 þ δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2, <sup>1</sup>δ<sup>s</sup>3,<sup>0</sup> <sup>2</sup> (26)

Replacing Eqs. (25) and (26) in the general Eq. (17) yields, for this quantum circuit, the echo intensities:

$$
\langle \mathfrak{s}\_1 \mathfrak{s}\_2 \mathfrak{s}\_3 | \hat{\rho}\_{out} | \mathfrak{s}\_1 \mathfrak{s}\_2 \mathfrak{s}\_3 \rangle = \left\langle \mathfrak{s}\_1 \mathfrak{s}\_2 \mathfrak{s}\_3 \middle| \hat{\mathbf{C}} \middle| \mathbf{000} \right\rangle \left\langle \mathbf{000} \middle| \hat{\mathbf{C}}^\dagger \middle| \mathfrak{s}\_1 \mathfrak{s}\_2 \mathfrak{s}\_3 \right\rangle = \frac{\delta\_{\mathfrak{s}\_1 \mathfrak{s}\_1 \oplus \mathfrak{s}\_2}}{4} \tag{27}
$$

That is, the forward and back propagation is such that the echoes are only formed for the cases where the rule s<sup>3</sup> ¼ s<sup>1</sup> ⊕ s<sup>2</sup> holds, leading to a ¼ probability associated with each alternative firing pattern of the first two neurons.

The Figure 3 shows the theoretical results from the above equations, the simulation in the IBM quantum assembly language (QASM) simulator and the experimental implementation on the Tenerife (ibmqx4) and Melbourne (ibmq\_16\_melbourne) devices.

The QASM simulation expresses, as expected, the basic random results from the repeated experiments, which is associated with the fundamental stochastic dynamics underlying quantum processing; however, the simulator results agree with the theoretical results, so that the basic XOR computation holds, that is, in each case, the output neuron exhibits the firing pattern that is consistent with the XOR rule.

#### Figure 3.

We begin with all three neurons in a nonfiring dynamics; then, the propagation from input to output (in the forward direction of the computational

<sup>¼</sup> h j <sup>s</sup>1s2s<sup>3</sup> <sup>U</sup>^ <sup>3</sup> <sup>U</sup>^ <sup>2</sup>U^ <sup>1</sup>j i <sup>000</sup> <sup>¼</sup>

¼

<sup>2</sup> (25)

¼

¼

δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2, <sup>1</sup>δ<sup>s</sup>3,<sup>0</sup>

j i s1s2s<sup>3</sup> ¼

†

†

δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2, <sup>1</sup>δ<sup>s</sup>3,<sup>0</sup>

<sup>¼</sup> <sup>δ</sup><sup>s</sup>3,s<sup>1</sup> <sup>⊕</sup> <sup>s</sup><sup>2</sup>

j i s1s21 � s<sup>3</sup> ¼

j iþ s1s21 � s<sup>3</sup>

j i s1s2s<sup>3</sup> ¼

<sup>2</sup> (26)

<sup>4</sup> (27)

† U^ 2 †

j i 000 þ j i 010 þ j i 100 þ j i 110 2 � �

j i 000 þ j i 010 þ j i 101 þ j i 111 2 � �

j i 000 þ j i 011 þ j i 101 þ j i 110 2 � �

δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2,0δ<sup>s</sup>3, <sup>1</sup>

† U^ 2 † U^ 3 †

2 þ

s1s2s<sup>3</sup> C^ � � � �000 D E

Artificial Intelligence - Applications in Medicine and Biology

<sup>¼</sup> h j <sup>s</sup>1s2s<sup>3</sup> <sup>U</sup>^ <sup>3</sup>U^ <sup>2</sup>

<sup>¼</sup> h j <sup>s</sup>1s2s<sup>3</sup> <sup>U</sup>^ <sup>3</sup>

¼ h j s1s2s<sup>3</sup>

<sup>000</sup> <sup>C</sup>^ † � � � � � � s1s2s<sup>3</sup> D E

> † U^ 2 †

> > †

†

δ<sup>s</sup>1,0δ<sup>s</sup>2, <sup>1</sup>δ<sup>s</sup>3, <sup>1</sup>

� � � �000 D E

with each alternative firing pattern of the first two neurons.

mental implementation on the Tenerife (ibmqx4) and Melbourne

2 þ

Replacing Eqs. (25) and (26) in the general Eq. (17) yields, for this quantum

That is, the forward and back propagation is such that the echoes are only formed for the cases where the rule s<sup>3</sup> ¼ s<sup>1</sup> ⊕ s<sup>2</sup> holds, leading to a ¼ probability associated

The Figure 3 shows the theoretical results from the above equations, the simulation in the IBM quantum assembly language (QASM) simulator and the experi-

The QASM simulation expresses, as expected, the basic random results from the repeated experiments, which is associated with the fundamental stochastic dynamics underlying quantum processing; however, the simulator results agree with the theoretical results, so that the basic XOR computation holds, that is, in each case, the output neuron exhibits the firing pattern that is consistent with the XOR rule.

δ<sup>s</sup>1,0δ<sup>s</sup>2, <sup>1</sup>δ<sup>s</sup>3, <sup>1</sup>

2 þ

The result in Eq. (25) means that the only probed final alternatives are those where the XOR rule s<sup>3</sup> ¼ s<sup>1</sup> ⊕ s<sup>2</sup> holds; that is, these are the only alternatives where

Likewise, back propagation from the output to the input yields the same result, that is, the only responses come from outputs where the XOR rule s<sup>3</sup> ¼ s<sup>1</sup> ⊕ s<sup>2</sup> holds,

<sup>¼</sup> h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

j i <sup>s</sup>1s2s<sup>3</sup> <sup>þ</sup> <sup>δ</sup><sup>s</sup>2, <sup>1</sup>h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

j i <sup>s</sup>1s2s<sup>3</sup> <sup>þ</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2, <sup>1</sup>h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

j i <sup>s</sup>1s<sup>21</sup> � <sup>s</sup><sup>3</sup> <sup>þ</sup> <sup>δ</sup><sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2, <sup>1</sup>h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2,0δ<sup>s</sup>3, <sup>1</sup>

<sup>000</sup> <sup>C</sup>^ † � � � � � � s1s2s<sup>3</sup> D E

2 þ

2 þ

<sup>¼</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2,0δ<sup>s</sup>3,<sup>0</sup>

there is a nonzero amplitude.

as the following derivation shows:

<sup>¼</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2,0δ<sup>s</sup>3,<sup>0</sup>

circuit, the echo intensities:

(ibmq\_16\_melbourne) devices.

106

<sup>¼</sup> <sup>δ</sup><sup>s</sup>2,0h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

<sup>¼</sup> <sup>δ</sup><sup>s</sup>1,0δ<sup>s</sup>2,0h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

<sup>þ</sup>δ<sup>s</sup>1, <sup>1</sup>δ<sup>s</sup>2,0h j <sup>000</sup> <sup>U</sup>^ <sup>1</sup>

2 þ

<sup>s</sup>1s2s<sup>3</sup> <sup>ρ</sup>^out h i j js1s2s<sup>3</sup> <sup>¼</sup> <sup>s</sup>1s2s<sup>3</sup> <sup>C</sup>^

circuit) yields:

Theoretical and experimental implementation of the XOR representation problem on the QASM simulator, Tenerife and Melbourne devices, with 8192 shots.

In the case of experiments, the XOR rule is predominant, that is, the dominant frequencies are those consistent with the circuit; there are, however, also a few residual cases that deviate from the XOR rule, all with low relative frequencies. These deviations are to be expected on the actual physical devices. For the Tenerife device, the relative frequency of cases that follow the XOR rule is 0.857; for the Melbourne device, this relative frequency is 0.835.

One of the main problems in physical implementation of quantum computation is the presence of errors. Indeed, the equations are derived for an isolated circuit so that the only echoes are those matching the quantum circuit; therefore, in an isolated QUANN, the stochastic results from repeated trials tend, in a frequentist approach, to the actual probabilities with zero frequencies associated with the alternatives for which no echo is produced. This is a basic property of quantum mechanics as predicted by the theory, and explains that the QASM simulator gets a zero measure for those alternatives for which there is no echo.

Of course, if Bohm's conjecture regarding the subquantum dynamics [9, 10] is right, then, even for a sufficiently isolated circuit, small deviations coming from the subquantum level may be present and lead to echoes that do not correspond to those of the main computing circuit. In any other interpretation that does not assume a subquantum dynamics and that takes the formalism to be exact, then, such deviations, for an isolated system, are considered physically impossible.

While we cannot rule out Bohm's subquantum hypothesis, we cannot also confirm it for now, since one never has a completely isolated circuit, and both conjectural lines (Bohmian and others) agree that some deviations on physical devices will always be present due to the environment.

The differences between the two conjectural lines, for quantum computer science, are worth considering regarding quantum error correction; however, for now, in regard to the technological issue of quantum error correction, we cannot yet make use of Bohm's conjecture that the quantum probabilities are average quantities and that subquantum fluctuations may introduce small deviations that average out at the quantum level to lead to the main experimental agreement with the theory.

Having provided, through the XOR problem, an example of how quantum neural computation can be run experimentally on IBM's quantum devices, we now address artificial intelligence (AI) applications; we are interested in the theoretical

and experimental implementation of a form of reinforcement learning using QUANNs, namely the quantum neural reinforcement learning (QNRL) and its connection to quantum robotics and quantum adaptive computation.

E w½ �¼ js ∑

expected reward, that is:

Figure 4.

109

N�1 n¼0

The goal for the agent is to select the action that maximizes this conditional

To solve the optimization problem in Eq. (29), we use a variant of QNRL, which

For modular neural networks, the resulting cognitive architecture resembles an artificial brain with specialized "brain regions" devoted to different tasks and connections between different neural modules corresponding to connections between different brain regions. In the present case, the agent's "artificial brain" (as shown in Figure 4) is comprised of three "brain regions" connected with each other for a specific functionality, where the first module (first brain region) corresponds to the action exploration region, the second module (second brain region) corresponds to

The connections between the modules follow the hierarchical process associated

the reward processing region, and the third module to the decision region.

with the necessary quantum reinforcement learning for each action, Figure 4 expresses this relation. The reinforcement learning, in this case, is a form of quantum search, implemented on the above modular structure, that proceeds in two

In the exploration stage, the agent's first brain region, taking advantage of quantum superposition, explores with equal weights, in parallel, each alternative initial action and the second brain region processes the conditional expected rewards; this last processing is based on optimizing quantum circuits [6], where

<sup>s</sup><sup>∗</sup> <sup>¼</sup> arg max s

applies modular networked learning [16], in the sense that, instead of a single neural network for a single problem, we expand the cognitive architecture and

Modular networked learning (MNL) was addressed in [16] and applied to financial market prediction, where, instead of a single problem and a single target, one uses an expanded cognitive architecture to work on multiple targets with a module assigned to each target and possible links between the modules used to map

work with a modular system of neural networks.

Quantum Neural Machine Learning: Theory and Experiments

DOI: http://dx.doi.org/10.5772/intechopen.84149

links between subproblems of a more complex problem.

stages: the exploration stage and the exploitation stage.

Modular structure for the reward maximization problem.

wnPs½ � wn (28)

E w½ � js (29)
