Examples of the present disclosure relate to a quantum computing device in a support vector machine algorithm, and using such as device in a support vector machine algorithm. Examples of the present disclosure also relate to determining a kernel matrix for a support vector machine algorithm using a quantum computing device, and classifying a test vector in a support vector machine algorithm using a quantum computing device.
Machine learning (ML) can be used to build a computational model based on training data to help make decisions or predictions. In some cases, there may be a large amount of training data, and thus the training process of machine learning algorithms can be time-consuming. To solve this, other computing hardware may be used to provide more computational power and accelerate the existing algorithms. Quantum computing devices can take this role, and thus the original machine learning algorithms need to be redesigned as quantum circuits.
A Support Vector Machine (SVM) is a supervised machine learning technique for solving classification problems. The computational complexity of SVM is 0[poly(NM)], and is proportional to the polynomial in NM, where N is the number of dimensions of the data, and M is the number of training data. The quantum support vector machine (QSVM) is the quantum analogue of SVM algorithm, presented in reference [1], and it can achieve a complexity of 0[log(NM)] on both the training and testing process. This can be exponentially less complex than the classical support vector machine (CSVM) algorithm. Reference [2] propose a QSVM system to classify two-dimensional data points into two sub-groups. The structure of an example QSVM system 100 is shown in
An example of a quantum circuit 200 to compute the kernel matrix is shown in
An example of a quantum circuit 300 for QSVM classification is shown in
One aspect of this disclosure provides a method of determining a kernel matrix for a support vector machine algorithm using a quantum computing device without quantum tomography. The method comprises manipulating quantum states of qubits of a quantum computing device based on a plurality of training vectors, each training vector representing a respective classification. The method also comprises determining a measurement of a status of at least one of the qubits, and computing the kernel matrix based on the measurement using a classical computing device.
Another aspect of this disclosure provides a method of determining a kernel matrix for a support vector machine algorithm based on M training vectors, M≥2. The method comprises determining a partial trace of ρ, where ρ=|ϕϕ|, and
where
An additional aspect of this disclosure provides a method of determining a kernel matrix for a support vector machine algorithm using a quantum computing device based on M training vectors, M≥2. The method comprises performing a respective rotation on the nth qubit of the quantum computing device by an nth angle based on an nth training vector of the training vectors, n=1, . . . , M, and measuring a respective state of each qubit to obtain M two-dimensional results
n=1, . . . , M. The method also comprises calculating the tensor product of all of the two-dimensional results
to obtain a vector:
and determining the kernel matrix from a partial trace of matrix
A further aspect of this disclosure provides a method of classifying a test vector using a support vector machine algorithm. The method comprises determining a kernel matrix of the support vector machine algorithm based on a plurality of training vectors, each training vector representing a respective classification, executing, using a quantum computing device, a linear equation solution algorithm on qubits of the quantum computing device based on the kernel matrix, and manipulating at least one of the qubits of the quantum computing device based on the plurality of training vectors. The method also comprises determining a measurement of a status of the at least one qubit, and classifying a test vector using a classical computing device based on the measurement.
A still further aspect of this disclosure provides apparatus for determining a kernel matrix for a support vector machine algorithm. The apparatus comprises a processor and a memory.
The memory contains instructions executable by the processor such that the apparatus is operable to manipulate quantum states of qubits of a quantum computing device based on a plurality of training vectors, each training vector representing a respective classification, determine a measurement of a status of at least one of the qubits, and compute the kernel matrix based on the measurement using a classical computing device.
An additional aspect of this disclosure provides apparatus for determining a kernel matrix for a support vector machine algorithm based on M training vectors, M≥2. The apparatus comprises a processor and a memory. The memory contains instructions executable by the processor such that the apparatus is operable to determine a partial trace of ρ, where ρ=|ϕϕ|, and
where
A further aspect of this disclosure provides apparatus for determining a kernel matrix for a support vector machine algorithm using a quantum computing device based on M training vectors, M≥2. The apparatus comprises a processor and a memory. The memory contains instructions executable by the processor such that the apparatus is operable to perform a respective rotation on the nth qubit of the quantum computing device by an nth angle based on an nth training vector of the training vectors, n=1, . . . , M, measure a respective state of each qubit to obtain M two-dimensional results
n=1, . . . , M, calculate the tensor product of all of the two-dimensional results
to obtain a vector:
and determine the kernel matrix from a partial trace of matrix
Another aspect of the present disclosure provides apparatus for classifying a test vector using a support vector machine algorithm. The apparatus comprises a processor and a memory. The memory contains instructions executable by the processor such that the apparatus is operable to determine a kernel matrix of the support vector machine algorithm based on a plurality of training vectors, each training vector representing a respective classification, execute, using a quantum computing device, a linear equation solution algorithm on qubits of the quantum computing device based on the kernel matrix, manipulate at least one of the qubits of the quantum computing device based on the plurality of training vectors, determine a measurement of a status of the at least one qubit, and classify a test vector using a classical computing device based on the measurement.
A further aspect of the present disclosure provides apparatus for determining a kernel matrix for a support vector machine algorithm. The apparatus is configured to manipulate quantum states of qubits of a quantum computing device based on a plurality of training vectors, each training vector representing a respective classification, determine a measurement of a status of at least one of the qubits, and compute the kernel matrix based on the measurement using a classical computing device.
A still further aspect of the present disclosure provides apparatus for determining a kernel matrix for a support vector machine algorithm based on M training vectors, M≥2. The apparatus is configured to determine a partial trace of ρ, where ρ=|ϕϕ|, and
where
An additional aspect of the present disclosure provides apparatus for determining a kernel matrix for a support vector machine algorithm using a quantum computing device based on M training vectors, M≥2. The apparatus is configured to perform a respective rotation on the nth qubit of the quantum computing device by an nth angle based on an nth training vector of the training vectors, n=1, . . . , M, measure a respective state of each qubit to obtain M two-dimensional results
n=1, . . . , M, calculate the tensor product of all of the two-dimensional results
to obtain a vector:
and determine the kernel matrix from a partial trace of matrix
Another aspect of the present disclosure provides apparatus for classifying a test vector using a support vector machine algorithm. The apparatus is configured to determine a kernel matrix of the support vector machine algorithm based on a plurality of training vectors, each training vector representing a respective classification, execute, using a quantum computing device, a linear equation solution algorithm on qubits of the quantum computing device based on the kernel matrix, manipulate at least one of the qubits of the quantum computing device based on the plurality of training vectors, determine a measurement of a status of the at least one qubit, and classify a test vector using a classical computing device based on the measurement.
For a better understanding of examples of the present disclosure, and to show more clearly how the examples may be carried into effect, reference will now be made, by way of example only, to the following drawings in which:
The following sets forth specific details, such as particular embodiments or examples for purposes of explanation and not limitation. It will be appreciated by one skilled in the art that other examples may be employed apart from these specific details. In some instances, detailed descriptions of well-known methods, nodes, interfaces, circuits, and devices are omitted so as not obscure the description with unnecessary detail. Those skilled in the art will appreciate that the functions described may be implemented in one or more nodes using hardware circuitry (e.g., analog and/or discrete logic gates interconnected to perform a specialized function, ASICs, PLAs, etc.) and/or using software programs and data in conjunction with one or more digital microprocessors or general purpose computers. Nodes that communicate using the air interface also have suitable radio communications circuitry. Moreover, where appropriate the technology can additionally be considered to be embodied entirely within any form of computer-readable memory, such as solid-state memory, magnetic disk, or optical disk containing an appropriate set of computer instructions that would cause a processor to carry out the techniques described herein.
Hardware implementation may include or encompass, without limitation, digital signal processor (DSP) hardware, a reduced instruction set processor, hardware (e.g., digital or analogue) circuitry including but not limited to application specific integrated circuit(s) (ASIC) and/or field programmable gate array(s) (FPGA(s)), and (where appropriate) state machines capable of performing such functions.
Quantum computing devices may be performance-limited by the coherence time of the qubits. This, in turn, implies that only short depth circuits can be executed. Quantum circuit simulators may also be executed on classical computing devices to simulate the quantum algorithms, but they are also limited in processing power by the bit limitation of the classical computing devices.
The QSVM system 100 shown in
Methods and apparatus disclosed herein propose to improve both the kernel matrix computation part and the classification part of a support vector machine (SVM). In the proposed solution, we provide methods to improve both Part 1 and Part 2 of the original QSVM system. For example, in some embodiments, proposed herein is a classical method for result readout after the quantum circuit 200 in
Step 404 of the method 400 comprises determining a measurement of a status of at least one of the qubits. For example, a measurement of the status |Ψ of both qubits of the quantum circuit 200 shown in
In some examples, manipulating quantum states of the qubits comprises performing first and second conditional rotations. For example, a first conditional rotation may be performed on a first qubit of the qubits by a first angle based on a first training vector of the plurality of training vectors, wherein the first conditional rotation is conditional based on the state of a second qubit of the qubits. For example, the first conditional rotation may be based on an angle θ1 associated with the first training vector (for example where the first training vector is represented by polar coordinates). Additionally, a second conditional rotation is performed on the first qubit by a second angle based on a second training vector of the plurality of training vectors, wherein the second conditional rotation is conditional based on the state of the second qubit. For example, the second conditional rotation may be based on an angle θ2 associated with the second training vector (for example where the second training vector is represented by polar coordinates). In some examples, the first and second training vectors are normalised or unit-length vectors.
In some examples, the measurement of the status of at least one of the qubits comprises measuring |Ψ=α0|00+α1|01+α2|10+α3|11, where |Ψ is the status of two of the qubits (such as for example the qubits of the quantum circuit 200 shown in
In some examples, computing the kernel matrix based on the measurement using a classical computing device comprises calculating the kernel matrix K such that:
where p0 is defined as |α0|2+|α2|2; p1 is defined as |α1|2+|α3|2; |Ψ0 is defined as
and |Ψ1 is defined as
Thus, the kernel matrix K can be determined based on the status |Ψ of the two of the qubits, such as for example the status of the qubits of the quantum circuit 200 of
In some examples, the kernel matrix K is determined such that:
where K is a matrix of dimension M×M, M is the number of training vectors, γ is a user-specified tuning parameter (an example value is γ=2), {right arrow over (α)} forms a normal vector {right arrow over (w)} by {right arrow over (w)}=Σj=1Mαj{right arrow over (x)}j, {right arrow over (x)}j is a N-dimensional test vector, yj is a label of {right arrow over (x)}j, and the classification decision boundary line y={right arrow over (w)}x+b. For example, {right arrow over (y)} stores the labels of training vectors (e.g. +1 and −1) and are known, and the purpose is to calculate b and α. With α, {right arrow over (w)} can be calculated. Thus, the decision boundary of classification can be represented by a line y={right arrow over (w)}x+b.
Thus, {right arrow over (w)} and b can in some examples be considered as parameters of the classification decision boundary (NB. y is not the same as {right arrow over (y)}).
Instead of using the quantum circuit 200 as depicted in
When there are two training vectors, the density matrix of both qubits in
where |
which is the generalisation of the expression for |ϕwhere there are two or more training vectors. |
An alternative quantum circuit 600 that can be used for determining the kernel matrix is shown in
n=1, . . . , M. Step 706 comprises calculating the tensor product of all of the two-dimensional results
to obtain a vector:
Finally, step 708 of the method 700 comprises determining the kernel matrix from a partial trace of matrix
Thus the kernel matrix can be determined using a quantum circuit with less depth than the circuit 200 shown in
The QSVM classification quantum circuit 300 shown in
The fourth qubit |q4is the ancilla register, and has the final the value of |1if the matrix inversion part 302 has a solution and |0otherwise, and it is also initialized as |0.
The matrix inversion part 300 and the training data oracle part 304 of the circuit 300 represent the training part of the circuit. It is designed to determine for example the hyperplane that can separate the data points into two sub-groups based on the training vectors. The test data oracle 306 represents the testing part of the circuit.
When using this quantum circuit 300, for every test vector (test data to be classified), the whole quantum circuit 300 needs to be executed. Thus, if in total there are m test data points, both the training part (including the matrix inversion and training data oracle parts) and the testing part need to be executed m times, and there is a lot of redundancy. The total circuit depth is (20+2)×m=22 m.
In embodiments as proposed herein, a process of testing is disclosed that has reduced the redundancy compared to the testing process using the quantum circuit 300.
Step 908 of the method 900 comprises determining a measurement of a status of the at least one qubit, and step 910 comprises classifying a test vector using a classical computing device based on the measurement. In some examples, the method 900 also includes classifying one or more further test vectors based on the measurement (e.g. repeating step 910 for one or more further test vectors). This can be done for example without repeating the executing and manipulating steps, i.e. without repeating one or more of steps 902-908 of the method 900.
In some examples, determining the measurement of the status of the at least one qubit comprises determining a measurement of the status of four qubits of the quantum computing device. These may be for example qubits |q1to |q4of the quantum circuit 800 shown in
α1=α0+α1+α4+α5+α8+α9+α12+α13, and
α2=α2+α3+α6+α7+α10+α11+α14+α15;
Classifying a test vector using a classical computing device based on the measurement may also comprise determining a classification y({right arrow over (x0)}) of the test vector, where:
y({right arrow over (x0)})=sign(Σi=1Mαi({right arrow over (xl)}·{right arrow over (x0)})+b),
{right arrow over (x0)} is the test vector,
{right arrow over (xl)}, i=1, . . . , M are the M training vectors;
b is 0, or an offset of a decision boundary between first and second classifications for the test vector; and
M=2.
Thus, for each of the M test vectors (test test vectors), a respective classification result +1 or −1 can be determined. The sign( )function is defined in some examples as:
Example results of a classification process for a plurality of test vectors are shown in
where
n=1, . . . , M, calculate the tensor product of all of the two-dimensional results
to obtain a vector:
and determine the kernel matrix from a partial trace of matrix
It should be noted that the above-mentioned examples illustrate rather than limit the invention, and that those skilled in the art will be able to design many alternative examples without departing from the scope of the appended statements. The word “comprising” does not exclude the presence of elements or steps other than those listed in a claim or embodiment, “a” or “an” does not exclude a plurality, and a single processor or other unit may fulfil the functions of several units recited in the statements below. Where the terms, “first”, “second” etc are used they are to be understood merely as labels for the convenient identification of a particular feature. In particular, they are not to be interpreted as describing the first or the second feature of a plurality of such features (i.e. the first or second of such features to occur in time or space) unless explicitly stated otherwise. Steps in the methods disclosed herein may be carried out in any order unless expressly otherwise stated. Any reference signs in the statements shall not be construed so as to limit their scope.
The following references are incorporated herein by reference.
[1] Lloyd, Seth. “Quantum algorithm for solving linear systems of equations.” APS March Meeting Abstracts. 2010.
[2] Li, Zhaokai, et al. “Experimental realization of a quantum support vector machine.” Physical review letters 114.14 (2015): 140504.
[3] Nielsen, Michael A., and Isaac Chuang. “Quantum computation and quantum information.” (2002): 558-559. p.389-394
[4] Thew R T, Nemoto K, White A G, et al. Qudit quantum-state tomography[J]. Physical Review A, 2002, 66(1): 012303.
[5] Qiskit—Quantum Tomography Module, https://qiskit.org/documentation/autodoc/qiskit.tools.qcvv.tomography.html, Accessed Jun. 11, 2019
[6] Coles, Patrick J. et al, “Quantum Algorithm Implementations for Beginners.” arXiv:1804.03719 v1, 10 Apr. 2018
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/SE2019/050640 | 6/28/2019 | WO |