CN113379059B - Model training method for quantum data classification and quantum data classification method - Google Patents

Model training method for quantum data classification and quantum data classification method Download PDF

Info

Publication number
CN113379059B
CN113379059B CN202110649751.6A CN202110649751A CN113379059B CN 113379059 B CN113379059 B CN 113379059B CN 202110649751 A CN202110649751 A CN 202110649751A CN 113379059 B CN113379059 B CN 113379059B
Authority
CN
China
Prior art keywords
quantum
training
local
circuits
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110649751.6A
Other languages
Chinese (zh)
Other versions
CN113379059A (en
Inventor
王鑫
赵炫强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110649751.6A priority Critical patent/CN113379059B/en
Publication of CN113379059A publication Critical patent/CN113379059A/en
Application granted granted Critical
Publication of CN113379059B publication Critical patent/CN113379059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Mathematical Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computational Mathematics (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Evolutionary Biology (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Complex Calculations (AREA)

Abstract

The disclosure provides a model training method for quantum data classification and a quantum data classification method, and relates to the technical field of artificial intelligence, in particular to the technical field of quantum computation and deep learning. The specific implementation scheme is as follows: obtaining first class information of each sample quantum data point in a quantum data training set; determining a plurality of local quantum circuits and partial quantum bits of sample quantum data points acted by the local quantum circuits respectively in a pre-training mode; aiming at each sample quantum data point, respectively acting a plurality of local quantum circuits on partial quantum bits of the sample quantum data point, wherein the quantum bits acted by different local quantum circuits have differences; and the first state information and the first class information of the partial quantum bits after the action obtained by measurement are used as training data for training the classical neural network. The quantum resources used in quantum data classification are saved, and a foundation is laid for improving the precision of quantum data classification.

Description

Model training method for quantum data classification and quantum data classification method
Technical Field
The present disclosure relates to the field of artificial intelligence technologies, and in particular, to the field of quantum computing and deep learning technologies, and in particular, to a model training method for quantum data classification and a quantum data classification method.
Background
Quantum computers are moving toward scaling and practical applications, and Quantum Machine Learning (Quantum Machine Learning) is the leading edge direction in Quantum computing. Similar to classical machine learning, accurately classifying and discriminating quantum data is an extremely important problem.
Since currently operable quantum devices are of a medium scale (50-100 qubits) and contain noise, how to use as few quantum resources as possible in combination with the computational power of classical computers to achieve accurate classification of quantum data is an urgent issue to be solved in the direction of quantum machine learning.
Disclosure of Invention
The present disclosure provides a model training method for quantum data classification, a quantum data classification method, an apparatus, an electronic device, a storage medium, and a computer program product.
According to an aspect of the present disclosure, there is provided a model training method for quantum data classification, including: acquiring a quantum data training set and first class information of each sample quantum data point in the quantum data training set; determining a plurality of local quantum circuits and partial quantum bits of the sample quantum data points acted on respectively by the local quantum circuits in a pre-training mode; for each sample quantum data point, respectively applying a plurality of local quantum circuits to the part of the qubits of the sample quantum data point, and measuring to obtain first state information of the applied part of the qubits, wherein different qubits applied by the local quantum circuits have different functions; and taking the first state information and the first class information as training data for training a classical neural network, so that the trained classical neural network classifies a quantum data set to be classified.
According to an aspect of the present disclosure, there is provided another model training method for quantum data classification, including: acquiring training data; the training data comprises first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of partial quantum bits obtained by measuring after a plurality of local quantum circuits act on the partial quantum bits of each sample quantum data point respectively; wherein the plurality of local quantum circuits and the portions of qubits of the sample quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ; and training a classical neural network by using the training data so that the trained classical neural network classifies the quantum data set to be classified.
According to an aspect of the present disclosure, there is provided a method of classifying quantum data, including: obtaining a quantum data set to be classified; respectively acting a plurality of local quantum circuits on partial quantum bits of quantum data points in the quantum data set to be classified, and measuring to obtain third state information of the acted partial quantum bits, so that the trained classical neural network classifies the quantum data set to be classified according to the third state information; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined by means of pre-training, and there is a difference in qubits acted upon by different ones of the local quantum circuits.
According to an aspect of the present disclosure, there is provided another quantum data classification method including: obtaining third state information of partial quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on partial quantum bits of quantum data points in a quantum data set to be classified; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ; and inputting the third state information into the trained classical neural network to obtain the prediction information of the class to which the quantum data point in the quantum data set belongs.
According to another aspect of the present disclosure, there is provided a model training apparatus for quantum data classification, including: the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a quantum data training set and first class information of each sample quantum data point in the quantum data training set; the determining module is used for determining a plurality of local quantum circuits and partial quantum bits of the sample quantum data points which are respectively acted by the local quantum circuits in a pre-training mode; the first processing module is used for respectively acting a plurality of local quantum circuits on the part of the qubits of the sample quantum data points aiming at each sample quantum data point, and measuring to obtain first state information of the acted part of the qubits, wherein the qubits acted by different local quantum circuits have different functions; and the second processing module is used for taking the first state information and the first class information as training data for training a classical neural network so as to enable the trained classical neural network to classify the quantum data set to be classified.
According to another aspect of the present disclosure, there is provided another model training apparatus for quantum data classification, including: the third acquisition module is used for acquiring training data; the training data comprise first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits are respectively acted on the part of the quantum bits of each sample quantum data point; wherein the plurality of local quantum circuits and the portions of qubits of the sample quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ; and the second training module is used for training a classical neural network by using the training data so as to enable the trained classical neural network to classify the quantum data set to be classified.
According to another aspect of the present disclosure, there is provided a quantum data classification apparatus including: a fifth obtaining module, configured to obtain a quantum data set to be classified; the third processing module is used for respectively acting the plurality of local quantum circuits on partial quantum bits of quantum data points in the quantum data set to be classified and measuring to obtain third state information of the acted partial quantum bits so that the trained classical neural network classifies the quantum data set to be classified according to the third state information; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined by means of pre-training, and there is a difference in qubits acted upon by different ones of the local quantum circuits.
According to another aspect of the present disclosure, there is provided another quantum data classification apparatus including: the sixth acquisition module is used for acquiring third state information of partial quantum bits obtained by measuring after the plurality of local quantum circuits respectively act on the partial quantum bits of the quantum data points in the quantum data sets to be classified; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ; and the fourth processing module is used for inputting the third state information into the trained classical neural network to obtain the prediction information of the class to which the quantum data point in the quantum data set belongs.
According to another aspect of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the model training method for quantum data classification as described in the second aspect above or to perform the quantum data classification method as described in the fourth aspect above.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the model training method for quantum data classification as described in the second aspect above or to perform the quantum data classification method as described in the fourth aspect.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the model training method for quantum data classification according to the second aspect described above, or performs the quantum data classification method of the fourth aspect.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a schematic flow diagram of a model training method for quantum data classification performed in a quantum device according to a first embodiment of the present disclosure;
fig. 2 is an example diagram of a global quantum circuit according to an embodiment of the present disclosure;
fig. 3 is an example diagram of a local quantum circuit according to an embodiment of the present disclosure;
fig. 4 is a flow diagram of a model training method for quantum data classification performed in a quantum device according to a second embodiment of the present disclosure;
fig. 5 is a flowchart schematic diagram of a model training method for quantum data classification performed in an electronic device according to a third embodiment of the present disclosure;
fig. 6 is a schematic flow chart diagram of a model training method for quantum data classification performed in an electronic device according to a fourth embodiment of the present disclosure;
fig. 7 is a schematic flow chart diagram of a model training method for quantum data classification performed in an electronic device according to a fifth embodiment of the present disclosure;
fig. 8 is a flowchart schematic of a model training method for quantum data classification performed in a quantum device and an electronic device according to a sixth embodiment of the present disclosure;
fig. 9 is another flowchart schematic of a quantum device and a model training method for quantum data classification performed in an electronic device according to a sixth embodiment of the present disclosure;
fig. 10 is a schematic flow diagram of a quantum data classification method performed in a quantum device according to a seventh embodiment of the present disclosure;
fig. 11 is a flowchart schematic diagram of a quantum data classification method performed in an electronic device according to an eighth embodiment of the present disclosure;
fig. 12 is a schematic structural diagram of a model training apparatus for quantum data classification configured in a quantum device according to a ninth embodiment of the present disclosure;
fig. 13 is a schematic structural diagram of a model training apparatus for quantum data classification configured in an electronic device according to a tenth embodiment of the present disclosure;
fig. 14 is a schematic structural diagram of a quantum data sorting apparatus configured in a quantum device according to an eleventh embodiment of the present disclosure;
fig. 15 is a schematic structural diagram of a quantum data sorting apparatus configured in an electronic device according to a twelfth embodiment of the present disclosure;
fig. 16 is a block diagram of an electronic device used to implement the model training method for quantum data classification or the quantum data classification method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It can be understood that, since the currently operable quantum devices are of a medium scale (50-100 qubits) and contain noise, how to use as few quantum resources as possible in combination with the computational power of a classical computer to achieve accurate classification of quantum data becomes an urgent issue to be solved in the direction of quantum machine learning.
The present disclosure proposes a model training method for quantum data classification and a quantum data classification method in order to achieve accurate classification of quantum data using as few quantum resources as possible. The model training method for quantum data classification is realized by combining quantum equipment and electronic equipment, wherein the quantum equipment is provided with a quantum circuit, and the electronic equipment is provided with a classical neural network. After the quantum device acquires the training set of quantum data and the first class information to which each sample quantum data point in the training set of quantum data belongs, determining a plurality of local quantum circuits and partial quantum bits of sample quantum data points acted by the local quantum circuits respectively in a pre-training mode, respectively acting the local quantum circuits on the partial quantum bits of the sample quantum data points respectively aiming at each sample quantum data point, and measuring to obtain first state information of the acted partial quantum bits, the quantum bits of different local quantum circuit functions are different, and then the first state information and the first class information are used as training data for training the classical neural network to train the classical neural network, so that the trained classical neural network is used for classifying the quantum data sets to be classified. The quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and a foundation is laid for improving the precision of quantum data classification.
A model training method for quantum data classification, a quantum data classification method, an apparatus, an electronic device, a non-transitory computer-readable storage medium, and a computer program product of embodiments of the present disclosure are described below with reference to the accompanying drawings.
First, referring to fig. 1, a detailed description is given of a model training method for quantum data classification performed in a quantum device provided in the present disclosure.
Fig. 1 is a schematic flow diagram of a model training method for quantum data classification performed in a quantum device according to a first embodiment of the present disclosure. It should be noted that the model training method for quantum data classification provided in this embodiment is executed by a model training apparatus for quantum data classification, where the model training apparatus for quantum data classification in this embodiment is simply referred to as a training apparatus. The training apparatus can be implemented by software and/or hardware, and the training apparatus can be configured in a quantum device to realize accurate classification of quantum data by using quantum resources as few as possible.
The quantum device may be any computing device capable of processing quantum data, such as a quantum computer capable of providing a quantum circuit in the near term, which is not limited by the present disclosure.
As shown in fig. 1, the model training method for quantum data classification may include the following steps:
step 101, obtaining a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs.
The quantum data training set comprises a plurality of sample quantum data points, each sample quantum data point corresponds to first class information to which the sample quantum data point belongs, and the first class information represents a class to which the sample quantum data point belongs.
Step 102, determining a plurality of local quantum circuits and partial quantum bits of sample quantum data points acted on respectively in a pre-training mode.
And 103, respectively acting a plurality of local quantum circuits on partial qubits of the sample quantum data points for each sample quantum data point, and measuring to obtain first state information of the acted partial qubits, wherein the qubits acted by different local quantum circuits have different functions.
The local quantum circuit is a quantum circuit acting on part of quantum bits of the quantum data points.
Reference is made to the global quantum circuit shown in fig. 2 and to the local quantum circuit shown in fig. 3. Suppose a quantum data point consists of q 0 、q 1 、q 2 、q 3 These 4 qubit descriptions, the effect shown in FIG. 2 is on all qubits q 0 、q 1 、q 2 、q 3 The quantum circuit U' (θ) above may be referred to as a global quantum circuit, shown in fig. 3 as acting on a portion of a qubit such as q 0 、q 1 The quantum circuit U (θ) above may be referred to as a local quantum circuit.
It will be appreciated that, assuming that each quantum data point is described by n qubits, each local quantum circuit acts only on m' qubits therein, at most one can prepare for
Figure BDA0003111268080000061
A local quantum circuit, wherein
Figure BDA0003111268080000062
Indicating how many possibilities m's are selected from the n qubits.
In the embodiment of the disclosure, a plurality of candidate local quantum circuits may be prepared in advance, after the training device obtains the quantum data training set and the first class information to which each sample quantum data point in the quantum data training set belongs, a plurality of local quantum circuits may be determined from the plurality of candidate local quantum circuits in a pre-training manner, and partial qubits of the sample quantum data points on which the plurality of local quantum circuits respectively act are determined, so that when the model for quantum data classification is trained by using the quantum data training set, for each sample quantum data point in the quantum data training set, the plurality of local quantum circuits determined in the pre-training process may be respectively applied to the partial qubits of the sample quantum data point, where qubits on which different local quantum circuits act are different. After the plurality of local quantum circuits are respectively applied to partial qubits of the sample quantum data points, the first state information of the applied partial qubits can be measured.
For example, assume that each quantum data point consists of q 0 、q 1 、q 2 、q 3 These 4 qubits describe.In the embodiment of the present disclosure, 5 candidate local quantum circuits U may be prepared 11 )、U 22 )、U 33 )、U 44 )、U 55 ) And each candidate local quantum circuit is arranged to act on 2 of the 4 qubits, respectively. After the quantum data training set and the first class information to which each sample quantum data point belongs in the quantum data training set are obtained, a plurality of local quantum circuits can be determined from the 5 candidate local quantum circuits in a pre-training mode, and partial quantum bits of the sample quantum data points respectively acted by the plurality of local quantum circuits are determined.
Suppose that 3 local quantum circuits U are determined by means of pre-training in the embodiments of the present disclosure 11 )、U 22 )、U 33 ) And for the same sample quantum data point, determining a local quantum circuit U 11 ) Qubits (q) acting on sample quantum data points 0 ,q 1 ) (wherein, in the disclosed embodiments with (q) 0 ,q 1 ) Denotes q 0 And q is 1 ) Upper, local quantum circuit U 22 ) Qubits (q) acting on sample quantum data points 1 ,q 2 ) Upper, local quantum circuit U 33 ) Qubits (q) acting on sample quantum data points 1 ,q 3 ) The above.
Then, when training the model for quantum data classification using the quantum data training set, the local quantum circuit U determined by the pre-training process may be used for each sample quantum data point 11 ) Qubits (q) acting on sample quantum data points 0 ,q 1 ) And measuring to obtain a qubit (q) 0 ,q 1 ) Effect local quantum circuit U 11 ) The first state information later is to make the local quantum circuit U 22 ) Qubits (q) acting on sample quantum data points 1 ,q 2 ) And measuring to obtain a qubit (q) 1 ,q 2 ) Function ofLocal quantum circuit U 22 ) The first state information later is to make the local quantum circuit U 33 ) Qubits (q) acting on sample quantum data points 1 ,q 3 ) And measuring to obtain a qubit (q) 1 ,q 3 ) Effect local quantum circuit U 33 ) The latter first state information.
It should be noted that, in the embodiment of the present disclosure, the number of candidate local quantum circuits and the number of local quantum circuits may be set as needed. For example, in order to improve the training efficiency of the pre-training process, it may be configured to perform the pre-training using fewer candidate local quantum circuits, and in order to improve the training efficiency of the model for quantum data classification, it may be determined from a plurality of candidate local quantum circuits that fewer local quantum circuits are respectively applied to a part of the qubits of the sample quantum data point.
The structure of the candidate local quantum circuit or the local quantum circuit may be set as needed. For example, the structure of the local quantum circuit can be optimized according to the limitation of the quantum device, so that the local quantum circuit is more suitable for the realization of the recent quantum device. The restriction of the quantum device can be understood as a restriction caused by that a part of qubits on the quantum device are influenced by noise to a large extent or information cannot be easily extracted simultaneously among a part of qubits, such as the quantum device itself.
And 104, taking the first state information and the first class information as training data for training the classical neural network, so that the trained classical neural network classifies the quantum data set to be classified.
The classical neural network may be any neural network that can be implemented in a classical electronic device, and the present disclosure is not limited thereto. For example, the classical neural network may be a recurrent neural network, a convolutional neural network, or the like.
In an exemplary embodiment, after the plurality of local quantum circuits are respectively applied to part of the quantum bits of each sample quantum data point in the quantum data training set, the first state information of the applied part of the quantum bits obtained through measurement and the first class information to which each sample quantum data point in the quantum data training set belongs can be used as training data to lay a foundation for the subsequent training of a classical neural network. The classical neural network is utilized to carry out post-processing on the first state information to obtain the prediction information of the class to which each sample quantum data point in the quantum data training set belongs, and the training data is utilized to train the classical neural network in combination with the first class information of each sample quantum data point in the quantum data training set, so that the trained classical neural network can classify the quantum data set to be classified.
Compared with a global quantum circuit, the number of the parametric quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and a foundation is laid for improving the precision of quantum data classification. And because the quantum bits of a single quantum data point may have differences, and the quantum bits on the same quantum device may also have differences, the training process can be more flexible and targeted by flexibly setting partial quantum bits acted by the local quantum circuit, so that more accurate state information can be provided for the classical neural network, and the classification precision of the trained classical neural network is further improved. And moreover, by adopting a pre-training mode, a plurality of local quantum circuits and partial quantum bits of sample quantum data points which act respectively are determined, and then in the training process of the model for classifying quantum data, the local quantum circuits determined in the pre-training process and the partial quantum bits which act respectively are directly adopted to train the model, so that the training effect of the model is improved, and a foundation is laid for improving the precision of the model for classifying the quantum data. In addition, by means of pre-training, a plurality of local quantum circuits are determined from the plurality of candidate local quantum circuits for model training, unnecessary candidate local quantum circuits can be avoided from being used when the model training and the trained model are used for quantum data classification, quantum resources used when the quantum data classification is further saved, and the number of the used local quantum circuits is reduced, so that the model training efficiency is improved.
The model training method for quantum data classification provided by the embodiment of the disclosure determines a plurality of local quantum circuits and partial quantum bits of sample quantum data points which are respectively acted by the local quantum circuits by a pre-training mode after acquiring a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs, respectively acts the local quantum circuits on the partial quantum bits of the sample quantum data points, and measures to obtain first state information of the acted partial quantum bits, wherein the quantum bits acted by different local quantum circuits have differences, and further takes the first state information and the first class information as training data for training a classical neural network to train the classical neural network so as to classify the quantum data set to be classified by using the trained classical neural network, the quantum data classification problem is solved by combining quantum computing and a classical neural network technology, and the number of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in a training process can be reduced, and a foundation is laid for improving the precision of quantum data classification.
The model training method for quantum data classification performed in the quantum device provided by the present disclosure is further explained below with reference to fig. 4.
Fig. 4 is a flowchart schematic of a model training method for quantum data classification performed in a quantum device according to a second embodiment of the present disclosure. As shown in fig. 4, the model training method for quantum data classification may include the following steps:
step 401, obtaining a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs.
For a specific implementation process and principle of step 401, reference may be made to the description of the foregoing embodiments, and details are not described here.
Step 402, obtaining a quantum data pre-training set and second class information to which each pre-training quantum data point in the quantum data pre-training set belongs.
In an exemplary embodiment, a portion of sample quantum data points may be extracted from a training set of quantum data to form a pre-training set of quantum data; or, a plurality of sample quantum data points can be divided into two parts, and after a quantum data training set is formed by using one part of sample quantum data points, a quantum data pre-training set is formed by using the other parts of sample quantum data points; alternatively, the quantum data pre-training set may be obtained in other ways, which is not limited by the embodiments of the present disclosure.
And 403, for each pre-training quantum data point, respectively applying a plurality of candidate local quantum circuits to part of the candidate quantum bits of the randomly selected pre-training quantum data point, and measuring to obtain second state information of the applied part of the candidate quantum bits, wherein the part of the candidate quantum bits acted by different candidate local quantum circuits has differences.
In an exemplary embodiment, a plurality of candidate local quantum circuits may be prepared in advance, and for each pre-training quantum data point, a partial candidate quantum bit acted on by each of the plurality of candidate local quantum circuits is randomly selected, where there is a difference in partial candidate quantum bits acted on by different candidate local quantum circuits. And then aiming at each pre-training quantum data point, respectively acting a plurality of candidate local quantum circuits on partial candidate quantum bits of the randomly selected pre-training quantum data point, and measuring to obtain second state information of the acted partial candidate quantum bits. Wherein, partial candidate quantum bits acted by the plurality of candidate local quantum circuits respectively can be randomly selected by the electronic device.
For example, assume that 5 candidate local quantum circuits U are prepared in advance 11 )、U 22 )、U 33 )、U 44 )、U 55 ) And randomly selecting a candidate local quantum circuit U for each pre-training quantum data point 11 ) Acting at a quantum ratioSpecially (q) 0 ,q 1 ) Upper, candidate local quantum circuit U 22 ) Acting on qubits (q) 1 ,q 2 ) Upper, candidate local quantum circuit U 33 ) Acting on qubits (q) 1 ,q 3 ) Upper, candidate local quantum circuit U 44 ) Acting on qubits (q) 0 ,q 2 ) Upper, candidate local quantum circuit U 55 ) Acting on qubits (q) 0 ,q 3 ) The above.
Then, for each pre-training quantum data point, the candidate local quantum circuit U may be implemented according to the part of the qubits respectively acted on by the randomly selected multiple candidate local quantum circuits 11 )、U 22 )、U 33 )、U 44 )、U 55 ) Respectively acting on part of the quantum bits of the pre-training quantum data points, and measuring to obtain the quantum bits (q) 0 ,q 1 ) Action candidate local quantum circuit U 11 ) Second state information, qubit (q) 1 ,q 2 ) Action candidate local quantum circuit U 22 ) Second state information, qubit (q) 1 ,q 3 ) Action candidate local quantum circuit U 33 ) Second state information, qubit (q) 0 ,q 2 ) Action candidate local quantum circuit U 44 ) The latter second state information and the qubit (q) 0 ,q 3 ) Action candidate local quantum circuit U 55 ) The latter second state information.
Step 404, using the second state information and the second category information as pre-training data for pre-training the classical neural network, determining a plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and using partial candidate quantum bits of the pre-training quantum data points as partial quantum bits of corresponding sample quantum data points.
In an exemplary embodiment, after the plurality of candidate local quantum circuits are respectively applied to part of the candidate quantum bits of each pre-training quantum data point in the quantum data pre-training set, the second state information of the applied part of the candidate quantum bits and the second class information to which each pre-training quantum data point in the quantum data pre-training set belongs are measured and can be used as pre-training data to lay a foundation for the pre-training of a subsequent classical neural network. The classical neural network is used for post-processing the second state information to obtain the prediction information of the class to which each pre-training quantum data point in the quantum data pre-training set belongs, and the pre-training of the classical neural network can be realized by using the pre-training data in combination with the second class information of each pre-training quantum data point in the quantum data pre-training set.
In an exemplary embodiment, after the classical neural network is pre-trained, a plurality of local quantum circuits may be determined from the plurality of candidate local quantum circuits according to parameters of the pre-trained classical neural network, and partial candidate qubits of the pre-trained quantum data points acted on by the plurality of local quantum circuits are used as partial qubits of corresponding sample quantum data points.
For example, continuing with the above embodiment, assume that the candidate local quantum circuit U is derived from parameters of the pre-trained classical neural network 11 )、U 22 )、U 33 )、U 44 )、U 55 ) In determining U 11 )、U 22 )、U 33 ) For the local quantum circuit, the local quantum circuit U can be 11 ) Partial candidate quantum bits (q) of the acted pre-training quantum data points 0 ,q 1 ) As a local quantum circuit U 11 ) Partial qubits of the affected sample quantum data points, the local quantum circuit U 22 ) Partial candidate quantum bits (q) of an affected pre-trained quantum data point 1 ,q 2 ) As a local quantum circuit U 22 ) Fractional quantum ratio of sample quantum data points of effectSpecially, local quantum circuit U 33 ) Partial candidate quantum bits (q) of an affected pre-trained quantum data point 1 ,q 3 ) As a local quantum circuit U 33 ) A fraction of qubits of the sample quantum data points of the effect.
In an exemplary embodiment, the plurality of local quantum circuits and the partial qubits of the sample quantum data points that are respectively acted may be a plurality of candidate local quantum circuits and partial candidate qubits that are respectively acted, in candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network, to which a parameter satisfying a preset condition is associated.
The preset condition may be, for example, that the absolute value of the parameter is not close to 0.
It can be understood that there is an association relationship between each parameter of the classical neural network and a plurality of candidate local quantum circuits, and when the absolute value of a certain parameter of the classical neural network is close to 0, it indicates that the information extracted from the partial candidate quantum bits acted by the candidate local quantum circuit associated with the parameter has little effect on the classification of the pre-training quantum data points. Then, in the embodiment of the present disclosure, the candidate local quantum circuit associated with the parameter whose absolute value is close to 0 may not be used as the local quantum circuit in the subsequent training process, but only the candidate local quantum circuit associated with the parameter whose absolute value is not close to 0 may be used as the local quantum circuit in the subsequent training process, so as to improve the training efficiency and the final classification effect of the model for quantum data classification.
For example, assume that the candidate local quantum circuit includes U 11 )、U 22 )、U 33 )、U 44 )、U 55 ) The parameters of the classical neural network include w 1 、w 2 、w 3 Wherein the parameter w 1 And candidate local quantum circuit U 11 ) Correlation, parameter w 2 And candidate local quantum circuit U 22 )、U 33 ) Correlation, parameter w 3 And candidate officeDomain quantum circuit U 44 )、U 55 ) And (4) correlating, wherein the preset condition is that the absolute value of the parameter is not close to 0.
Assuming a parameter w of a pre-trained classical neural network 3 Close to 0, then U may be adjusted 11 )、U 22 )、U 33 )、U 44 )、U 55 ) In parameter w 1 Associated candidate local quantum circuit U 11 ) And a parameter w 2 Associated candidate local quantum circuit U 22 )、U 33 ) As a local quantum circuit required by subsequent training, and a local quantum circuit U 11 ) Partial candidate quantum bits of the acted pre-training quantum data points are used as a local quantum circuit U 11 ) Partial qubits of the affected sample quantum data points, the local quantum circuit U 22 ) Partial candidate quantum bits of the acted pre-training quantum data points are used as a local quantum circuit U 22 ) Partial qubits of the affected sample quantum data points, the local quantum circuit U 33 ) Partial candidate quantum bits of the acted pre-training quantum data points are used as a local quantum circuit U 33 ) A fraction of qubits of the sample quantum data points of the effect.
In the candidate local quantum circuits respectively associated with the parameters of the pre-trained classical neural network, the candidate local quantum circuits associated with the parameters meeting the preset conditions and the candidate quantum bits respectively acting are used as the local quantum circuits and the partial quantum bits of the sample quantum data points respectively acting, so that the combination of the partial quantum bits which help the maximum classification result of the final quantum data is used as the positions where the local quantum circuits act, the function of the local quantum circuits can be exerted to the maximum extent, and the training efficiency and the final classification effect of the model for quantum data classification are improved.
By adopting the pre-training mode, a plurality of local quantum circuits and quantum bit positions more useful for extracting the characteristics of the sample quantum data points are determined, and then in the training process of the model for classifying the quantum data, the local quantum circuits determined in the pre-training process and the quantum bit positions respectively acting are directly adopted to train the model, so that the training effect of the model is improved, and a foundation is laid for improving the precision of the model for classifying the quantum data. In addition, after the plurality of local quantum circuits and the quantum bit positions more useful for extracting the features of the sample quantum data points are determined in the pre-training process for a certain scene, such as human face recognition, object recognition or traffic indication signal recognition, the pre-training information is directly adopted for training the model for the certain scene, so that the features extracted in the training process are more helpful for classifying the quantum data in the certain scene, the trained model can be more suitable for classifying the quantum data in the certain scene, and the applicability of the model for classifying the quantum data to different scenes is improved.
Step 405, for each sample quantum data point, respectively applying a plurality of local quantum circuits to a part of the qubits of the sample quantum data point, and measuring to obtain first state information of the applied part of the qubits, wherein the qubits applied by different local quantum circuits have differences.
And 406, using the first state information and the first class information as training data for training the classical neural network, so that the trained classical neural network classifies the quantum data set to be classified.
The specific implementation process and principle of steps 405 and 406 can refer to the description of the above embodiments, and are not described herein again.
It can be understood that after the classical neural network is trained, a plurality of local quantum circuits and the classical neural network can be combined to realize the classification of quantum data.
In an exemplary embodiment, to improve the accuracy of classification of quantum data, a plurality of local quantum circuits in the present disclosure may be trained while training a classical neural network with first state information and first class information.
Specifically, for each sample quantum data point in the quantum data training set, the training apparatus in the quantum device may apply the multiple local quantum circuits to partial quantum bits of the sample quantum data point, respectively, and after first state information of the applied partial quantum bits is obtained through measurement, input the first state information into a classical neural network set on the electronic device, to obtain prediction information corresponding to the sample quantum data point, where the prediction information is prediction information output by the classical neural network and used for characterizing a category to which the sample quantum data point belongs.
The training device in the quantum device can acquire the total difference between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which each sample quantum data point belongs, and then adjust the parameters of the multiple local quantum circuits based on the total difference so as to train the multiple local quantum circuits.
Correspondingly, the model training method for quantum data classification provided by the embodiment of the present disclosure may further include the following steps:
acquiring a total difference, wherein the total difference is determined according to the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information respectively belonging to the sample quantum data points;
and training the plurality of local quantum circuits based on the total difference.
In an exemplary embodiment, the electronic device may determine the loss function according to the total difference, and the training apparatus in the quantum device may adjust parameters of the plurality of local quantum circuits by a gradient descent method to optimize the minimum loss function, so as to obtain optimal parameters of the plurality of local quantum circuits, thereby implementing training of the plurality of local quantum circuits.
Each local quantum circuit is composed of a plurality of single quantum bit revolving gates and controlled back gates, for example, the rotation angles of the plurality of single quantum bit revolving gates can constitute parameters of the local quantum circuit.
It should be noted that the method for optimizing the parameters of the multiple local quantum circuits by using the gradient descent method is only an example, and in practical application, a person skilled in the art may select a suitable optimization method to find the optimal parameters of the multiple local quantum circuits by combining a specific application scenario and hardware devices to improve the classification effect of the multiple local quantum circuits.
Through the feedback information of the quantum equipment based on the classical electronic equipment, a plurality of local quantum circuits are trained, the loss function in the classical neural network is set to be a loss function more suitable for multi-classification problems, the multi-classification problems of quantum data are efficiently processed by combining the capacity of efficiently extracting quantum data characteristics of the local quantum circuits and the data processing capacity of the classical neural network are realized, and the precision of quantum data classification by utilizing the trained local quantum circuits and the classical neural network is improved.
It should be noted that, similar to the process of training the classical neural network by using the first state information and the first category information as training data, the process of training the multiple local quantum circuits is similar, and while pre-training the classical neural network by using the second state information and the second category information as pre-training data, the process of pre-training the multiple candidate local quantum circuits can also be performed simultaneously to obtain optimal parameters of the multiple candidate local quantum circuits, so as to improve the accuracy of the pre-trained classical neural network parameters, and further improve the accuracy of the determined local quantum circuits and the accuracy of the separately acting partial qubits.
The model training method for quantum data classification performed in the electronic device provided by the present disclosure is described in detail below with reference to fig. 5.
Fig. 5 is a flowchart schematic diagram of a model training method for quantum data classification performed in an electronic device according to a third embodiment of the present disclosure. It should be noted that the model training method for quantum data classification provided in this embodiment is executed by a model training apparatus for quantum data classification, where the model training apparatus for quantum data classification in this embodiment is simply referred to as a training apparatus. The training apparatus can be implemented by software and/or hardware, and the training apparatus can be configured in an electronic device to realize accurate classification of quantum data by using quantum resources as few as possible.
The electronic device may be any classical computing device capable of processing classical data, and the disclosure does not limit this. The electronic device may be, for example, a mobile computing device such as a notebook computer, a smart phone, a wearable device, or a stationary classic computing device such as a desktop computer, which is not limited in this disclosure.
As shown in fig. 5, the model training method for quantum data classification may include the following steps:
step 501, acquiring training data; the training data comprises first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of quantum bits of each sample quantum data point; the plurality of local quantum circuits and the part of the quantum bits of the sample quantum data points acted by the local quantum circuits are determined in a pre-training mode, and the quantum bits acted by different local quantum circuits are different.
Wherein the training data may be transmitted by the quantum device to a training apparatus in the electronic device.
In an exemplary embodiment, the quantum device may obtain a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs, and, in combination with the electronic device, determine, in a pre-training manner, a plurality of local quantum circuits and partial quantum bits of the sample quantum data points that are respectively acted on the local quantum circuits, respectively act, for each sample quantum data point, the plurality of local quantum circuits determined in the pre-training process on the partial quantum bits of the sample quantum data point, and measure to obtain first state information of the acted partial quantum bits, where quantum bits acted on different local quantum circuits have differences. The quantum device can then send the first state information corresponding to each sample quantum data point in the quantum data training set and the first class information to which each sample quantum data point in the quantum data training set belongs to the electronic device as training data for training the classical neural network.
After the plurality of local quantum circuits act on part of the qubits of each sample quantum data point, the process of obtaining state information of the part of the qubits may refer to the description of the foregoing embodiment, and details are not described here.
Step 502, training the classical neural network with training data, so that the trained classical neural network classifies the quantum data set to be classified.
In an exemplary embodiment, a training apparatus in an electronic device may train a classical neural network with training data so that the trained classical neural network may classify a quantum data set to be classified.
The model training method for quantum data classification provided by the embodiment of the disclosure obtains training data, wherein the training data includes first class information to which each sample quantum data point in a quantum data training set belongs, and after a plurality of local quantum circuits respectively act on part of qubits of each sample quantum data point, first state information of the part of qubits obtained by measurement is obtained, wherein the plurality of local quantum circuits and the part of qubits of the sample quantum data points respectively act are determined by a pre-training mode, the qubits acting on different local quantum circuits have differences, a classical neural network is trained by using the training data, so that the trained classical neural network classifies the quantum data sets to be classified, and the problem of quantum data classification is solved by combining quantum computing and classical neural network technologies, the quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and a foundation is laid for improving the precision of quantum data classification.
The model training method for quantum data classification performed in the electronic device provided by the present disclosure is further described below with reference to fig. 6.
Fig. 6 is a flowchart schematic diagram of a model training method for quantum data classification performed in an electronic device according to a fourth embodiment of the present disclosure. As shown in fig. 6, the model training method for quantum data classification may include the following steps:
step 601, acquiring training data; the training data comprises first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of quantum bits of each sample quantum data point, wherein the plurality of local quantum circuits and the part of quantum bits of the sample quantum data points respectively act are determined in a pre-training mode, and quantum bits acting on different local quantum circuits have differences.
The specific implementation process and principle of step 601 may refer to the description of the foregoing embodiments, and are not described herein again.
Step 602, for each sample quantum data point in the training data, after the plurality of local quantum circuits are respectively applied to a part of the quantum bits of the sample quantum data point, the first state information of the part of the quantum bits obtained by measurement is input to the classical neural network, and the prediction information corresponding to the sample quantum data point output by the classical neural network is obtained.
And for each sample quantum data point, first state information obtained by measuring the sample quantum data point after the sample quantum data point acts on a plurality of local quantum circuits is input into the classical neural network, and the classical neural network can output the prediction information corresponding to the sample quantum data point. And the prediction information is used for representing the category to which the sample quantum data point belongs.
Step 603, determining the total difference according to the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information respectively belonging to each sample quantum data point.
In an exemplary embodiment, for each sample quantum data point in the quantum data training set, the difference between the prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs may be determined, and then the total difference is determined according to the difference between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which the sample quantum data point belongs.
And step 604, determining a loss function according to the total difference, so as to train the classical neural network based on the loss function.
In an exemplary embodiment, a loss function can be determined according to the total difference, and then based on the loss function, the loss function is minimized through a gradient descent method to obtain the optimal parameters of the classical neural network, so that training of the classical neural network is achieved.
It should be noted that the method for optimizing the parameters of the classical neural network by using the gradient descent method is only an example, and in practical application, a person skilled in the art may select a suitable optimization method to find the optimal parameters of the classical neural network by combining a specific application scenario and hardware devices to improve the classification effect of the classical neural network.
In an exemplary embodiment, for each sample quantum data point in the quantum data training set, the prediction information corresponding to the sample quantum data point and the cross entropy between the first class information to which the sample quantum data point belongs may be calculated, the cross entropy is used as the difference between the prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs, and then the total difference is determined according to the difference between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which the sample quantum data point belongs, so as to determine a loss function, and obtain the optimal parameter of the classical neural network by minimizing the loss function, thereby implementing the training of the classical neural network.
Therefore, the prediction information corresponding to the sample quantum data points and the cross entropy between the first class information of the sample quantum data points are used as the difference degree between the prediction information corresponding to the sample quantum data points and the first class information of the sample quantum data points, the total difference degree is determined according to the difference degree between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information of the sample quantum data points, the loss function is determined according to the total difference degree, the classical neural network is trained based on the loss function, the accuracy of the determined total difference degree is improved, and a foundation is laid for improving the precision of the classical neural network for classifying the quantum data.
The above-mentioned method of determining the total difference degree and thus determining the loss function by using the cross entropy between the prediction information corresponding to the sample quantum data point and the belonging first class information as the difference degree between the prediction information corresponding to the sample quantum data point and the belonging first class information is only an example. In practical application, a person skilled in the art can design or select a proper loss function in the deep learning field to train the classical neural network according to a specific application scene and hardware equipment, so that the classical neural network can achieve a better classification effect under the corresponding application scene.
In an exemplary embodiment, the quantum device may also train the plurality of local quantum circuits based on the loss function to obtain optimal parameters of the plurality of local quantum circuits, and the classifier may be composed of the trained plurality of local quantum circuits and the trained classical neural network, and may classify the quantum data set to be classified.
For example, for each sample quantum data point in the quantum data training set, the training device in the electronic device may determine a difference between prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs, and then determine a total difference according to the difference between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which the sample quantum data point belongs, thereby determining a loss function. The trained classical neural network and the plurality of local quantum circuits may form a classifier for classifying the quantum data set to be classified.
By training a plurality of local quantum circuits and the classical neural network simultaneously based on the loss function, a foundation is laid for improving the precision of quantum data classification. Moreover, the quantum data can be classified by combining the capability of efficiently extracting quantum data characteristics of the local quantum circuit and the data processing capability of the classical neural network, and the loss function in the classical neural network is set to be a loss function more suitable for multi-classification problems, so that the multiple local quantum circuits and the classical neural network trained in the application can efficiently process the multi-classification problems.
The model training method for quantum data classification performed in the electronic device provided by the present disclosure is further described below with reference to fig. 7.
Fig. 7 is a flowchart schematic diagram of a model training method for quantum data classification performed in an electronic device according to a fifth embodiment of the present disclosure. As shown in fig. 7, the model training method for quantum data classification may include the following steps:
step 701, acquiring pre-training data; the pre-training data comprises second class information to which each pre-training quantum data point in the quantum data pre-training set belongs, and second state information of part of candidate quantum bits obtained by measuring after a plurality of candidate local quantum circuits respectively act on part of candidate quantum bits of the randomly selected pre-training quantum data points, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences.
Wherein the pre-training data may be transmitted by the quantum device to a training apparatus in the electronic device.
In an exemplary embodiment, the quantum device may obtain the quantum data pre-training set and second category information to which each pre-training quantum data point in the quantum data pre-training set belongs, respectively apply a plurality of candidate local quantum circuits to part of the candidate quantum bits of the randomly selected pre-training quantum data point for each pre-training quantum data point, and measure to obtain second state information of the applied part of the candidate quantum bits, where there is a difference between the part of the candidate quantum bits applied by different candidate local quantum circuits. And then the quantum device can send the second state information corresponding to each pre-training quantum data point in the quantum data pre-training set and the second class information to which each pre-training quantum data point in the quantum data pre-training set belongs to the electronic device as the pre-training data of the pre-training classical neural network. Wherein, partial candidate quantum bits acted by the plurality of candidate local quantum circuits respectively can be randomly selected by the electronic device.
After the plurality of candidate local quantum circuits respectively act on part of the candidate quantum bits of each pre-training quantum data point, reference may be made to the description of the foregoing embodiment for the process of acquiring the second state information of the part of the candidate quantum bits, and details are not repeated here.
And 702, pre-training the classical neural network by using pre-training data, determining a plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and using partial candidate quantum bits of the pre-training quantum data points as partial quantum bits of corresponding sample quantum data points.
In an exemplary embodiment, a training apparatus in an electronic device may pre-train a classical neural network with pre-training data.
In an exemplary embodiment, similar to the process of training a classical neural network using training data, when the classical neural network is pre-trained using pre-training data, the training device in the electronic device may apply the plurality of candidate local quantum circuits to a part of the candidate quantum bits of the pre-training quantum data points selected randomly for each pre-training quantum data point in the pre-training data, second state information of partial candidate quantum bits obtained by measurement is input into a classical neural network, and obtaining the corresponding prediction information of the pre-training quantum data points output by the classical neural network, then determining the total difference degree according to the corresponding prediction information of each pre-training quantum data point in the quantum data pre-training set and the second class information of each pre-training quantum data point, and then determining a loss function according to the total difference, and pre-training the classical neural network based on the loss function. For the specific pre-training process, reference may be made to the process of training the classical neural network by using the training data in the foregoing embodiment, which is not described herein again.
After the classical neural network is pre-trained, a plurality of local quantum circuits can be determined from a plurality of candidate local quantum circuits according to parameters of the pre-trained classical neural network, and partial candidate quantum bits of the pre-trained quantum data points are used as partial quantum bits of corresponding sample quantum data points.
In an exemplary embodiment, the plurality of local quantum circuits may be determined from the plurality of candidate local quantum circuits and the partial candidate qubits of the acted pre-training quantum data point may be taken as the partial qubits of the corresponding sample quantum data point by:
acquiring candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network; and determining a plurality of candidate local quantum circuits associated with the parameters meeting the preset conditions in the parameters as a plurality of local quantum circuits, and taking partial candidate quantum bits of the pre-training quantum data points which are respectively acted as partial quantum bits of the corresponding sample quantum data points.
The preset condition may be, for example, that the absolute value of the parameter is not close to 0.
It is understood that each parameter of the classical neural network is associated with a plurality of candidate local quantum circuits, for example, one parameter may be associated with one or more candidate local quantum circuits, and one candidate local quantum circuit may also be associated with a plurality of parameters. Since the absolute value of a parameter of the classical neural network is close to 0, which indicates that the information extracted from the partial candidate quantum bit acted by the candidate local quantum circuit associated with the parameter hardly has an effect on the classification of the pre-trained quantum data point, in the embodiment of the present disclosure, after the classical neural network is pre-trained and the candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network are obtained, the candidate local quantum circuit associated with the parameter whose absolute value is close to 0 may not be used as the local quantum circuit in the subsequent training process, but only the candidate local quantum circuit associated with the parameter whose absolute value is not close to 0 is used as the local quantum circuit in the subsequent training process, and the partial candidate quantum bit of the pre-trained quantum data point respectively acted is used as the partial quantum bit of the corresponding sample quantum data point, thereby improving the training efficiency and the final classification effect of the model for quantum data classification.
For example, assume that the candidate local quantum circuit includes U 11 )、U 22 )、U 33 )、U 44 )、U 55 ) The parameters of the classical neural network include w 1 、w 2 、w 3 Wherein the parameter w 1 And candidate local quantum circuit U 11 ) Correlation, parameter w 2 And candidate local quantum circuit U 22 )、U 33 ) Correlation, parameter w 3 And candidate local quantum circuit U 44 )、U 55 ) And (4) correlating, wherein the preset condition is that the absolute value of the parameter is not close to 0.
Assuming a parameter w of a pre-trained classical neural network 3 Close to 0, then U may be adjusted 11 )、U 22 )、U 33 )、U 44 )、U 55 ) In parameter w 1 Associated candidate local quantum circuit U 11 ) And a parameter w 2 Associated candidate local quantum circuit U 22 )、U 33 ) As a local quantum circuit required by subsequent training, and a local quantum circuit U 11 ) Partial candidate quantum ratios of contributing pre-trained quantum data pointsSpecially, as a local quantum circuit U 11 ) Partial qubits of the affected sample quantum data points, the local quantum circuit U 22 ) Partial candidate quantum bits of the acted pre-training quantum data points are used as a local quantum circuit U 22 ) Partial qubits of the affected sample quantum data points, the local quantum circuit U 33 ) Partial candidate quantum bits of the acted pre-training quantum data points are used as a local quantum circuit U 33 ) A fraction of qubits of the sample quantum data points of the effect.
In the candidate local quantum circuits respectively associated with the parameters of the pre-trained classical neural network, the candidate local quantum circuits associated with the parameters meeting the preset conditions and the candidate quantum bits respectively acting are used as the local quantum circuits and the partial quantum bits of the sample quantum data points respectively acting, so that the combination of the partial quantum bits which help the maximum classification result of the final quantum data is used as the positions where the local quantum circuits act, the function of the local quantum circuits can be exerted to the maximum extent, and the training efficiency and the final classification effect of the model for quantum data classification are improved.
It should be noted that, the association relationship between each parameter of the classical neural network and the plurality of candidate local quantum circuits may be determined and stored when the classical neural network is constructed, and after the classical neural network is pre-trained, the candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network may be directly obtained according to the pre-stored association relationship between each parameter of the classical neural network and the plurality of candidate local quantum circuits.
Step 703, acquiring training data; the training data comprise first class information to which each sample quantum data point in the quantum data training set belongs, and first state information of part of the quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of the quantum bits of each sample quantum data point; the plurality of local quantum circuits and the part of the quantum bits of the sample quantum data points acted by the local quantum circuits are determined in a pre-training mode, and the quantum bits acted by different local quantum circuits are different.
Step 704, training the classical neural network by using the training data, so that the trained classical neural network classifies the quantum data set to be classified.
The specific implementation process and principle of steps 703-704 may refer to the description of the foregoing embodiments, and are not described herein again.
The model training method for quantum data classification provided by the embodiment of the disclosure includes the steps of obtaining pre-training data, pre-training a classical neural network by using the pre-training data, determining a plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, using partial candidate qubits of the acting pre-training quantum data points as partial qubits of corresponding sample quantum data points, training the classical neural network by using the training data after obtaining the training data, classifying a quantum data set to be classified by the trained classical neural network, determining the plurality of local quantum circuits and the qubit positions more useful for extracting the characteristics of the sample quantum data points by using a pre-training mode, and further determining the positions of the quantum bits more useful for extracting the characteristics of the sample quantum data points in the training process of the model for quantum data classification, the model is trained by directly adopting a plurality of local quantum circuits determined in the pre-training process and quantum bit positions respectively acting, so that the training effect of the model is improved, and a foundation is laid for improving the precision of the model for classifying quantum data. In addition, after the plurality of local quantum circuits and the quantum bit positions more useful for extracting the features of the sample quantum data points are determined in the pre-training process for a certain scene, such as human face recognition, object recognition or traffic indication signal recognition, the pre-training information is directly adopted for training the model for the certain scene, so that the features extracted in the training process are more helpful for classifying the quantum data in the certain scene, the trained model can be more suitable for classifying the quantum data in the certain scene, and the applicability of the model for classifying the quantum data to different scenes is improved.
The model training method for quantum data classification provided by the present disclosure is further explained below with reference to specific examples.
Fig. 8 is a flowchart schematic diagram of a quantum device and a model training method for quantum data classification performed in an electronic device according to a sixth embodiment of the present disclosure. Fig. 9 is another flowchart schematic of a quantum device and a model training method for quantum data classification performed in an electronic device according to a sixth embodiment of the present disclosure.
It should be noted that, in this example, a plurality of local quantum circuits that can be provided by the quantum device 901 are utilized, and post-processing (post-processing) is performed on intermediate information output by the measurement quantum system (that is, after the plurality of local quantum circuits are respectively applied to part of the qubits of the sample quantum data point, first state information of the measured part of the qubits) by combining data processing capability of a typical neural network in the electronic device 902, so as to optimize a classification result of classifying the quantum data. The structure of the local quantum circuit used in this example can be designed in advance according to the limitation of the quantum device 901, so as to be more suitable for the recent quantum device. Compared with a global quantum circuit commonly used in the related art, the number of the parameterized quantum gates related in the example is greatly reduced, and introduction of system noise in a training process is further reduced. Moreover, aiming at different scenes, a plurality of local quantum circuits and part of quantum bits of information to be extracted together can be determined in a pre-training mode, and in the training process of the model for classifying quantum data in the same scene, the local quantum circuits determined in the pre-training process and the part of quantum bits of information to be extracted together are directly adopted to train the model, so that the training efficiency and the final classification effect of the model are improved. For example, for a face recognition scene, the qubit positions acted on by each local quantum circuit can be obtained in a pre-training manner, and then, for a face recognition model, the solution of the classification problem can be directly performed by adopting pre-training information. At the same time, the present example can also easily cope with the multi-classification problem of quantum data.
In addition, the example also sets an activation function similar to that in the classical neural network, such as a Softmax function, and uses the cross entropy between the true label (i.e., the first class information to which each sample quantum data point in the quantum data training set belongs) and the prediction label output by the classical neural network for each sample quantum data point in the quantum data training set as a loss function, so as to optimize the parameters in the multiple local quantum circuits and the classical neural network based on the loss function, thereby achieving the purpose of improving the accuracy of the classification result.
Before describing the detailed steps of the present example, the following explanation is made.
In particular, a training set of quantum data containing N elements is given
Figure BDA0003111268080000221
Where ρ is (m) Represents the m-th element (i.e., the m-th sample quantum data point) in the training set S of quantum data encoded into a quantum state, and the label corresponding to the element is y (m) Y of the (m) Vector characterization may be used, such as an x-dimensional vector. If the sample quantum data point belongs to the 1 st class, only the 1 st element in the x-dimensional vector is 1, and the rest are all 0 s, and if the sample quantum data point belongs to the 2 nd class, only the 2 nd element in the x-dimensional vector is 1, and the rest are all 0 s, and so on, the first class information to which the sample quantum data point belongs is represented.
In practice, the quantum state ρ of n qubits can be represented as 2 n ×2 n And tr (ρ) ═ 1, where tr denotes the trace of the matrix.
As shown in fig. 8, the model training method for quantum data classification may include the following steps:
step 801, a training set of quantum data including N sample quantum data points and first class information to which each sample quantum data point belongs are acquired.
Wherein the mth sample quantum data point belongs toThe first category of information may specifically be the real tag vector y (m)
Step 802, preparing T candidate local quantum circuits with adjustable parameters, and determining a plurality of local quantum circuits from the T candidate local quantum circuits and determining partial qubits of the sample quantum data points acted on by the plurality of local quantum circuits, respectively, in a pre-training manner.
Wherein the value of T can be selected by the user as desired. The local quantum circuit consists of a plurality of single quantum bit revolving gates and controlled back gates. A plurality of rotation angles in the ith local quantum circuit form a vector theta i Theta of i I.e. the parameter of the ith local quantum circuit, which is marked as U ii ) And the overall parameter of the multiple local quantum circuits is marked as theta. The collection of partial quantum bits acted by the ith local quantum circuit is marked as a collection Q i
Step 803, a classical neural network is prepared, which includes a plurality of weighting coefficients (also called parameters), and these weighting coefficients form a vector w, which is the parameter of the classical neural network, and the classical neural network is denoted as v (w).
Step 804, for a sample quantum data ρ (m) Local quantum circuit U to be determined ii ) Respectively acting on sample quantum data rho (m) Of the determined partial qubit Q i And measuring to obtain first state information of partial quantum bits after the partial quantum bits are respectively acted by the plurality of local quantum circuits.
In this case, the first state information corresponding to different partial quantum bits constitutes a vector
Figure BDA0003111268080000239
Specifically, as shown in fig. 9, a local quantum circuit U may be provided 11 ) Acting on qubits (q) 0 ,q 1 ) After the above, the measurement yields the qubit (q) 0 ,q 1 ) First state information of
Figure BDA00031112680800002310
Will local quantum circuit U 22 ) Acting on qubits (q) 1 ,q 2 ) After the above, the measurement yields the qubit (q) 1 ,q 2 ) First state information of
Figure BDA0003111268080000233
Local quantum circuit U 33 ) Acting on qubits (q) 1 ,q 3 ) After the above, the measurement yields the qubit (q) 1 ,q 3 ) First state information of
Figure BDA0003111268080000234
Step 805, forming the first state information of the partial qubits respectively acted on by the plurality of local quantum circuits into a vector O (m) After input into classical neural network V (w) to obtain output result
Figure BDA0003111268080000235
Wherein the result is output
Figure BDA0003111268080000236
I.e. for the sample quantum data point ρ (m) The predictive tag vector of (2).
Step 806, calculate the predicted tag vector
Figure BDA0003111268080000237
And a true tag vector y (m) Cross entropy between
Figure BDA0003111268080000238
Where j represents the jth classification category, and there are k categories in total. Wherein, the cross entropy is used for measuring the current classifier composed of a plurality of local quantum circuits and a classical neural network aiming at the sample quantum data point rho (m) The correctness of the multi-classification task is realized, and the smaller the cross entropy is, the higher the correctness of the classifier is.
Step 807, for each sample quantum data point in the training set of quantum data, repeating steps 804-806 and accumulating L (m) Obtaining a loss function
Figure BDA0003111268080000241
Wherein N is the number of sample quantum data points in the training set of quantum data.
808, minimizing the loss function L by adjusting the parameter w of the classical neural network v (w) and the parameters θ of the plurality of local quantum circuits through a gradient descent method or other optimization methods, and obtaining the optimal parameter w * And theta *
The pre-training process in step 802 may be: extracting, for example, 10% of sample quantum data points from the quantum data training set to form a quantum data pre-training set, randomly selecting partial candidate quantum bits of the pre-training quantum data points, which are respectively acted by each candidate local quantum circuit, and ensuring that the partial candidate quantum bits acted by different candidate local quantum circuits have differences in the randomly selecting process; preparing a classical neural network V (w); for each pre-training quantum data point, respectively acting a plurality of candidate local quantum circuits on part of candidate quantum bits of the randomly selected pre-training quantum data point in a similar manner of steps 804 and 808, measuring to obtain second state information of the acted part of candidate quantum bits, using the second state information and second class information to which each pre-training quantum data point in the quantum data pre-training set belongs as pre-training data, and pre-training the plurality of candidate local quantum circuits and the classical neural network, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences.
After the pre-training is completed, the optimal parameters of the classical neural network and the multiple candidate local quantum circuits can be obtained, then the multiple local quantum circuits can be determined from the multiple candidate local quantum circuits according to the parameters of the classical neural network, and partial candidate quantum bits of the acting pre-training quantum data points are used as partial quantum bits of the corresponding sample quantum data points.
Further, step 803-808 can be performed to implement training of the plurality of local quantum circuits and the classical neural network, and the trained plurality of local quantum circuits U (θ) * ) And a classical neural network V (w) * ) A trained classifier is formed. The classification of the quantum data set to be classified can be realized by utilizing the trained classifier.
It should be noted that, in the embodiment of the present disclosure, the pre-trained classical neural network may be used as a classical neural network used in a training process, so as to continue training the pre-trained classical neural network. In practical applications, the classical neural network in the pre-training process and the training process may also be different, which is not limited by the embodiments of the present disclosure.
In addition, in the above steps, the processing procedure related to the quantum data is executed in the quantum device, and the processing procedure related to the classical neural network is executed in the electronic device such as the classical computer, so that the quantum computing and the classical neural network technology are combined to realize the accurate discrimination of the class of the quantum data.
The embodiments described above introduce a model training method for quantum data classification, and based on the embodiments described above, the embodiments of the present disclosure further provide a quantum data classification method.
Fig. 10 is a flowchart illustrating a quantum data classification method performed in a quantum device according to a seventh embodiment of the present disclosure. It should be noted that the quantum data classification method provided in this embodiment is executed by a quantum data classification apparatus, where the quantum data classification apparatus may be implemented by software and/or hardware, and the quantum data classification apparatus may be configured in a quantum device to implement accurate classification of quantum data by using as few quantum resources as possible.
As shown in fig. 10, the quantum data classification method may include the steps of:
step 1001, a quantum data set to be classified is obtained.
The quantum data set to be classified may include one or more quantum data points, and the number of quantum data points in the quantum data set to be classified is not limited by the present disclosure. In addition, the quantum data points may be quantum states that need to be classified themselves, or quantum states that encode classical data, which is not limited by this disclosure.
Step 1002, respectively applying a plurality of local quantum circuits to a part of quantum bits of quantum data points in a quantum data set to be classified, and measuring to obtain third state information of the applied part of quantum bits, so that the trained classical neural network classifies the quantum data set to be classified according to the third state information; the quantum data points are respectively acted on the plurality of local quantum circuits, wherein the plurality of local quantum circuits and partial quantum bits of the quantum data points respectively acted on the plurality of local quantum circuits are determined in a pre-training mode, and the quantum bits acted on different local quantum circuits are different.
The plurality of local quantum circuits may be a plurality of local quantum circuits trained by the model training method of the above embodiment, or may be a plurality of local quantum circuits not trained by the model training method of the above embodiment, which is not limited in this disclosure.
In an exemplary embodiment, for each quantum data point in the quantum data set to be classified, the plurality of local quantum circuits may be respectively applied to a part of the qubits of the quantum data point, and the third state information of the applied part of the qubits is measured, where the qubits applied by different local quantum circuits have different functions.
In step 1002, a specific implementation process of applying the multiple local quantum circuits to a part of the qubits of the quantum data points in the quantum data set to be classified respectively and measuring to obtain third state information of the applied part of the qubits is similar to the specific implementation process of step 102 in the foregoing embodiment, and is not described here again.
It should be noted that, for each local quantum circuit, the partial qubits of the quantum data points in the quantum data set to be classified, which are acted by the local quantum circuit, are the same as the partial qubits of the sample quantum data points in the quantum data training set, which are acted by the local quantum circuit in the model training process. That is, for each local quantum circuit, the qubits acted on the local quantum circuit in the training process and the use process of the classifier are the same.
In an exemplary embodiment, the third state information of the partial qubits obtained in step 1002 may be used as intermediate data when the classical neural network trained by the model training method in the above embodiment classifies the quantum data to be classified, so that the trained classical neural network may classify the quantum data set to be classified according to the state information as the intermediate data.
Compared with a global quantum circuit, the quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process is reduced, state information of training data serving as a classical neural network is more accurate, classification precision of the trained classical neural network is higher, and classification precision is improved when the trained classical neural network is used for classifying the quantum data sets to be classified. And because the quantum bits of single quantum data may have difference, and the quantum bits on the same quantum device may also have difference, by adopting a pre-training mode, the positions of a plurality of local quantum circuits and the quantum bits which are more useful for extracting the characteristics of quantum data points are determined, the accuracy of information extracted by the local quantum circuits can be improved, and the classification effect of the quantum data is further improved.
The quantum data classification method provided by the embodiment of the disclosure includes the steps that after a quantum data set to be classified is obtained, a plurality of local quantum circuits are respectively applied to partial quantum bits of quantum data points in the quantum data set to be classified, and third state information of the applied partial quantum bits is obtained through measurement, so that a trained classical neural network classifies the quantum data set to be classified according to the third state information; the plurality of local quantum circuits and part of the quantum bits of the quantum data points acted on the local quantum circuits are determined in a pre-training mode, and the quantum bits acted on different local quantum circuits are different. The quantum computing and classical neural network technology are combined to solve the problem of quantum data classification, and the quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and the precision of classification of quantum data sets to be classified is improved.
Based on the model training method for quantum data classification of the above embodiment, the embodiment of the present disclosure further provides another quantum data classification method.
Fig. 11 is a flowchart illustrating a quantum data classification method performed in an electronic device according to an eighth embodiment of the present disclosure. It should be noted that the quantum data classification method provided in this embodiment is executed by a quantum data classification apparatus, where the quantum data classification apparatus may be implemented by software and/or hardware, and the quantum data classification apparatus may be configured in an electronic device to implement accurate classification of quantum data using as few quantum resources as possible.
As shown in fig. 11, the quantum data classification method may include the steps of:
step 1101, acquiring third state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of quantum bits of quantum data points in a quantum data set to be classified; the plurality of local quantum circuits and part of the quantum bits of the quantum data points acted on the local quantum circuits are determined in a pre-training mode, and the quantum bits acted on different local quantum circuits are different.
After the plurality of local quantum circuits are respectively applied to part of the quantum bits of the quantum data points in the quantum data set to be classified, the third state information of the part of the quantum bits obtained through measurement can be sent to a quantum data classification device in the electronic equipment by the quantum equipment.
In an exemplary embodiment, the quantum device may obtain a quantum data set to be classified, and for each quantum data point in the quantum data set, may apply the multiple local quantum circuits to partial qubits of the quantum data point respectively, and measure to obtain third state information of the applied partial qubits, where the multiple local quantum circuits and the partial qubits of the quantum data points applied respectively are determined in a pre-training manner, and there is a difference between the qubits applied by different local quantum circuits. The quantum device may then send the third state information corresponding to each quantum data point in the quantum data set to the electronic device.
After the plurality of local quantum circuits act on part of the qubits of each quantum data point, reference may be made to the description of the foregoing embodiment for the process of obtaining the third state information of the measured part of the qubits, which is not described herein again.
Step 1102, inputting the third state information into the trained classical neural network to obtain prediction information of the category to which the quantum data point in the quantum data set belongs.
In an exemplary embodiment, for each quantum data point, the third state information obtained by measuring after the quantum data point is acted on a plurality of local quantum circuits is input into the classical neural network trained by the model training method, and the classical neural network can output the prediction information of the class to which the quantum data point belongs.
The quantum data classification method provided by the embodiment of the disclosure obtains third state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of quantum bits of quantum data points in a quantum data set to be classified; the method comprises the steps that a plurality of local quantum circuits and partial quantum bits of quantum data points acted by the local quantum circuits are determined in a pre-training mode, the quantum bits acted by different local quantum circuits are different, third state information is input into a trained classical neural network, prediction information of the class to which the quantum data points belong in a quantum data set is obtained, the quantum data classification problem is solved by combining quantum computing and the classical neural network technology, quantum resources used in quantum data classification are saved due to the fact that the number of parametric quantum gates involved in the local quantum circuits is greatly reduced, system noise introduced in the training process can be reduced, and therefore the quantum data classification precision is improved.
The following describes a model training apparatus for quantum data classification configured in a quantum device provided by the present disclosure with reference to fig. 12.
Fig. 12 is a schematic structural diagram of a model training apparatus for quantum data classification configured in a quantum device according to a ninth embodiment of the present disclosure.
As shown in fig. 12, the present disclosure provides a model training apparatus 1200 for quantum data classification, comprising: a first obtaining module 1201, a determining module 1202, a first processing module 1203, and a second processing module 1204.
The first obtaining module 1201 is configured to obtain a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs;
a determining module 1202, configured to determine, in a pre-training manner, a plurality of local quantum circuits and partial qubits of sample quantum data points acted on by the local quantum circuits respectively;
a first processing module 1203, configured to apply, for each sample quantum data point, a plurality of local quantum circuits to a part of qubits of the sample quantum data point, respectively, and measure to obtain first state information of the applied part of qubits, where there is a difference between the qubits applied by different local quantum circuits;
the second processing module 1204 is configured to use the first state information and the first class information as training data for training the classical neural network, so that the trained classical neural network classifies the quantum data set to be classified.
It should be noted that, the model training apparatus 1000 for quantum data classification provided in this embodiment, hereinafter referred to as a training apparatus for short, may perform the model training method for quantum data classification performed in the quantum device of the foregoing first aspect embodiment, so as to realize accurate classification of quantum data by using as few quantum resources as possible.
In an exemplary embodiment, the determining module 1202 includes:
the quantum data pre-training set comprises a first acquisition unit, a second acquisition unit and a control unit, wherein the first acquisition unit is used for acquiring the quantum data pre-training set and second category information to which each pre-training quantum data point in the quantum data pre-training set belongs;
the first processing unit is used for respectively acting a plurality of candidate local quantum circuits on partial candidate quantum bits of the pre-training quantum data points selected randomly aiming at each pre-training quantum data point, and measuring to obtain second state information of the acted partial candidate quantum bits, wherein the partial candidate quantum bits acted by different candidate local quantum circuits have differences;
a second processing unit, configured to use the second state information and the second class information as pre-training data for pre-training the classical neural network, determine a plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and use partial candidate qubits of the applied pre-training quantum data points as partial qubits of corresponding sample quantum data points,
in an exemplary embodiment, the plurality of local quantum circuits and the part of qubits of the sample quantum data points that are respectively acted are the plurality of candidate local quantum circuits and the part of candidate qubits that are respectively acted, in the candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network, to which the parameter meeting the preset condition is associated.
In an exemplary embodiment, the training apparatus 1200 further comprises:
the second acquisition module is used for acquiring the total difference, wherein the total difference is determined according to the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information respectively belonging to each sample quantum data point;
and the first training module is used for training the plurality of local quantum circuits based on the total difference degree.
It should be noted that the foregoing description of the embodiment of the model training method for quantum data classification performed in a quantum device is also applicable to the model training apparatus for quantum data classification provided in the present disclosure, and is not repeated herein.
The model training device for quantum data classification provided by the embodiment of the disclosure determines a plurality of local quantum circuits and partial quantum bits of sample quantum data points respectively acted by the local quantum circuits in a pre-training manner after acquiring a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs, respectively acts the local quantum circuits on the partial quantum bits of the sample quantum data points, and measures to obtain first state information of the acted partial quantum bits, wherein the quantum bits acted by different local quantum circuits have differences, and further takes the first state information and the first class information as training data for training a classical neural network to train the classical neural network so as to classify the quantum data set to be classified by using the trained classical neural network, the quantum computing and the classical neural network technology are combined to solve the problem of quantum data classification, and the quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in the quantum data classification are saved, system noise introduced in the training process can be reduced, and a foundation is laid for improving the precision of the quantum data classification.
The following describes a model training apparatus for quantum data classification configured in an electronic device provided in the present disclosure with reference to fig. 13.
Fig. 13 is a schematic structural diagram of a model training apparatus for quantum data classification configured in an electronic device according to a tenth embodiment of the present disclosure.
As shown in fig. 13, the present disclosure provides a model training apparatus 1300 for quantum data classification, comprising: a third obtaining module 1301 and a second training module 1302.
The third obtaining module 1301 is configured to obtain training data; the training data comprises first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of quantum bits of each sample quantum data point; the quantum bit of the sample quantum data points acted by the plurality of local quantum circuits and the sample quantum data points respectively is determined in a pre-training mode, and the quantum bits acted by different local quantum circuits are different;
the second training module 1302 is configured to train the classical neural network with the training data, so that the trained classical neural network classifies the quantum data set to be classified.
It should be noted that the model training apparatus 1300 for quantum data classification provided in this embodiment, hereinafter referred to as training apparatus for short, may perform the model training method for quantum data classification performed in the electronic device according to the foregoing second aspect embodiment, so as to realize accurate classification of quantum data by using as few quantum resources as possible.
In an exemplary embodiment, the training apparatus 1300 may further include:
the fourth acquisition module is used for acquiring pre-training data; the pre-training data comprises second category information to which each pre-training quantum data point in the quantum data pre-training set belongs, and second state information of part of candidate quantum bits obtained by measuring after a plurality of candidate local quantum circuits respectively act on part of candidate quantum bits of the randomly selected pre-training quantum data points, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
and the third training module is used for pre-training the classical neural network by utilizing the pre-training data, determining a plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and taking partial candidate quantum bits of the pre-training quantum data points as partial quantum bits of the corresponding sample quantum data points.
In an exemplary embodiment, the third training module includes:
the second acquisition unit is used for acquiring candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network;
the first determining unit is used for determining a plurality of candidate local quantum circuits associated with parameters meeting preset conditions in the parameters into a plurality of local quantum circuits, and taking partial candidate quantum bits of pre-training quantum data points which are respectively acted as partial quantum bits of corresponding sample quantum data points.
In an exemplary embodiment, the second training module 1302, includes:
the third acquisition unit is used for measuring first state information of part of the quantum data points obtained after the plurality of local quantum circuits are respectively applied to part of the quantum data points of the sample quantum data points aiming at each sample quantum data point in the training data, inputting the first state information into the classical neural network and acquiring the prediction information corresponding to the sample quantum data points output by the classical neural network;
the second determining unit is used for determining the total difference degree according to the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information respectively belonging to each sample quantum data point;
and the third determining unit is used for determining a loss function according to the total difference degree so as to train the classical neural network based on the loss function.
In an exemplary embodiment, the second determining unit includes:
the calculation subunit is used for calculating the prediction information corresponding to the sample quantum data points and the cross entropy between the first class information to which the sample quantum data points belong aiming at each sample quantum data point in the quantum data training set, and taking the cross entropy as the difference degree between the prediction information corresponding to the sample quantum data points and the first class information to which the sample quantum data points belong;
and the determining subunit is used for determining the total difference degree according to the difference degree between the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information to which the sample quantum data point belongs.
In an exemplary embodiment, the loss function is also used to train a plurality of local quantum circuits.
It should be noted that the foregoing description of the embodiment of the model training method for quantum data classification executed in an electronic device is also applicable to the model training apparatus for quantum data classification provided in the present disclosure, and is not repeated herein.
The model training device for quantum data classification provided by the embodiment of the disclosure acquires training data, wherein the training data includes first class information to which each sample quantum data point in a quantum data training set belongs, and after a plurality of local quantum circuits respectively act on part of quantum bits of each sample quantum data point, first state information of the part of quantum bits is obtained by measurement, wherein the plurality of local quantum circuits and the part of quantum bits of the respectively acting sample quantum data points are determined in a pre-training manner, the quantum bits acting on different local quantum circuits have differences, the training data is used for training a classical neural network, so that the trained classical neural network classifies a quantum data set to be classified, and the problem of quantum data classification is solved by combining quantum computing and a classical neural network technology, the quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and a foundation is laid for improving the precision of quantum data classification.
Next, a quantum data sorting apparatus provided in a quantum device according to the present disclosure will be described with reference to fig. 14. Fig. 14 is a schematic structural diagram of a quantum data sorting apparatus configured in a quantum device according to an eleventh embodiment of the present disclosure.
As shown in fig. 14, the quantum data sorting apparatus 1400 provided by the present disclosure includes: a fifth acquiring module 1401 and a third processing module 1402.
The fifth obtaining module 1401 is configured to obtain a quantum data set to be classified;
the third processing module 1402 is configured to apply the multiple local quantum circuits to partial qubits of the quantum data points in the quantum data set to be classified, respectively, and measure to obtain third state information of the applied partial qubits, so that the trained classical neural network classifies the quantum data set to be classified according to the third state information; the plurality of local quantum circuits and part of the quantum bits of the quantum data points acted on the local quantum circuits are determined in a pre-training mode, and the quantum bits acted on different local quantum circuits are different.
It should be noted that the quantum data classification apparatus 1400 provided in this embodiment may perform the quantum data classification method performed in the quantum device of the foregoing third aspect embodiment, so as to realize accurate classification of quantum data by using as few quantum resources as possible.
It should be noted that the foregoing description of the embodiments of the quantum data classification method performed in the quantum device is also applicable to the quantum data classification apparatus provided in the present disclosure, and is not repeated herein.
The quantum data classification device provided by the embodiment of the disclosure, after acquiring a quantum data set to be classified, respectively applying a plurality of local quantum circuits to a part of quantum bits of quantum data points in the quantum data set to be classified, and measuring to obtain third state information of the applied part of quantum bits, so that a trained classical neural network classifies the quantum data set to be classified according to the third state information; the plurality of local quantum circuits and part of the quantum bits of the quantum data points acted on the local quantum circuits are determined in a pre-training mode, and the quantum bits acted on different local quantum circuits are different. The quantum computing and classical neural network technology are combined to solve the problem of quantum data classification, and the quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and the precision of classification of quantum data sets to be classified is improved.
Next, a quantum data sorting apparatus provided in the electronic device according to the present disclosure will be described with reference to fig. 15.
Fig. 15 is a schematic structural diagram of a quantum data sorting apparatus configured in an electronic device according to a twelfth embodiment of the present disclosure.
As shown in fig. 15, the present disclosure provides a quantum data sorting apparatus 1500 including: a sixth acquisition module 1501 and a fourth processing module 1502.
The sixth obtaining module 1501 is configured to obtain third state information of a part of the quantum bits obtained by measuring after the plurality of local quantum circuits respectively act on part of the quantum bits of the quantum data points in the quantum data set to be classified; the quantum data point pre-training method comprises the following steps that a plurality of local quantum circuits and partial quantum bits of quantum data points acted by the local quantum circuits respectively are determined in a pre-training mode, and the quantum bits acted by different local quantum circuits are different;
the fourth processing module 1502 is configured to input the third state information into the trained classical neural network, so as to obtain prediction information of a category to which a quantum data point in the quantum data set belongs.
It should be noted that the quantum data classification apparatus 1300 provided in this embodiment may perform the quantum data classification method performed in the electronic device of the fourth aspect of the embodiment, so as to realize accurate classification of quantum data by using as few quantum resources as possible.
It should be noted that the foregoing description of the embodiments of the quantum data classification method executed in the electronic device is also applicable to the quantum data classification apparatus provided in the present disclosure, and is not repeated herein.
The quantum data classification device provided by the embodiment of the disclosure obtains third state information of part of quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on part of quantum bits of quantum data points in a quantum data set to be classified; the quantum data classification method comprises the steps that a plurality of local quantum circuits and partial quantum bits of quantum data points which are respectively acted by the local quantum circuits are determined in a pre-training mode, the quantum bits acted by different local quantum circuits are different, third state information is input into a trained classical neural network, prediction information of the class to which the quantum data points belong in a quantum data set is obtained, the quantum data classification problem is solved by combining quantum computing and the classical neural network technology, and the quantum resources used in quantum data classification are saved due to the fact that the number of parametric quantum gates involved in the local quantum circuits is greatly reduced, system noise introduced in the training process can be reduced, and therefore the quantum data classification precision is improved.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 16 shows a schematic block diagram of an example electronic device 1600 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 16, the apparatus 1600 includes a computing unit 1601, which may perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)1602 or a computer program loaded from a storage unit 1608 into a Random Access Memory (RAM) 1603. In the RAM 1603, various programs and data required for the operation of the device 1600 can also be stored. The computing unit 1601, the ROM 1602, and the RAM 1603 are connected to each other by a bus 1604. An input/output (I/O) interface 1605 is also connected to the bus 1604.
Various components in device 1600 connect to I/O interface 1605, including: an input unit 1606 such as a keyboard, a mouse, and the like; an output unit 1607 such as various types of displays, speakers, and the like; a storage unit 1608, such as a magnetic disk, optical disk, or the like; and a communication unit 1609 such as a network card, a modem, a wireless communication transceiver, etc. A communication unit 1609 allows device 1600 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks.
Computing unit 1601 may be a variety of general purpose and/or special purpose processing components with processing and computing capabilities. Some examples of computing unit 1601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 1601 performs the respective methods and processes described above, such as a model training method for quantum data classification or a quantum data classification method. For example, in some embodiments, the model training method for quantum data classification or the quantum data classification method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1608. In some embodiments, part or all of the computer program can be loaded and/or installed onto device 1600 via ROM 1602 and/or communications unit 1609. When a computer program is loaded into RAM 1603 and executed by computing unit 1601, one or more steps of the model training method for quantum data classification or the quantum data classification method described above may be performed. Alternatively, in other embodiments, the computing unit 1601 may be configured to perform a model training method or a quantum data classification method for quantum data classification by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program code, when executed by the processor or controller, causes the functions/acts specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
The embodiment of the disclosure relates to the technical field of artificial intelligence, in particular to the technical field of quantum computation and deep learning.
Among them, Artificial Intelligence (AI) is a subject of studying a computer to simulate some thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.) of a human, and has a hardware level technology and a software level technology. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology mainly comprises computer vision, speech recognition technology, natural language processing technology, machine learning/deep learning, big data processing technology, knowledge map technology and other directions
According to the technical scheme of the embodiment of the disclosure, the quantum device is combined with the electronic device to realize the quantum device, a quantum circuit is arranged in the quantum device, and a classical neural network is arranged in the electronic device. After quantum equipment acquires a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs, a plurality of local quantum circuits are determined in a pre-training mode, partial quantum bits acted by the local quantum circuits are determined for each sample quantum data point, the local quantum circuits are respectively acted on the partial quantum bits of the sample quantum data points, first state information of the acted partial quantum bits is obtained through measurement, wherein the quantum bits acted by different local quantum circuits are different, the first state information and the first class information are used as training data for training a classical neural network to train the classical neural network, and the quantum data sets classified by the classical neural network after training are used for classification. The quantity of the parameterized quantum gates related to the local quantum circuit is greatly reduced, so that quantum resources used in quantum data classification are saved, system noise introduced in the training process can be reduced, and a foundation is laid for improving the precision of quantum data classification.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (22)

1. A model training method for quantum data classification, comprising:
obtaining a quantum data training set and first class information to which each sample quantum data point in the quantum data training set belongs;
determining a plurality of local quantum circuits and partial quantum bits of the sample quantum data points acted on respectively by the local quantum circuits in a pre-training mode;
for each sample quantum data point, respectively applying a plurality of local quantum circuits to the part of the qubits of the sample quantum data point, and measuring to obtain first state information of the applied part of the qubits, wherein different qubits applied by the local quantum circuits have different functions;
using the first state information and the first class information as training data for training a classical neural network, so that the trained classical neural network classifies a quantum data set to be classified;
wherein the determining a plurality of local quantum circuits and the portion of qubits of the sample quantum data points acted on respectively by the local quantum circuits in a pre-training manner comprises:
obtaining a quantum data pre-training set and second category information of each pre-training quantum data point in the quantum data pre-training set;
for each pre-training quantum data point, respectively acting a plurality of candidate local quantum circuits on part of candidate quantum bits of the pre-training quantum data point selected randomly, and measuring to obtain second state information of the acted part of candidate quantum bits, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
and using the second state information and the second category information as pre-training data for pre-training the classical neural network, determining the plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and using partial candidate quantum bits of the pre-training quantum data points as the partial qubits of the corresponding sample quantum data points.
2. The method of claim 1, wherein the plurality of local quantum circuits and the portions of qubits of the sample quantum data points that are respectively acted upon are a plurality of candidate local quantum circuits and the portions of candidate qubits that are respectively acted upon, of the candidate local quantum circuits respectively associated with the parameters of the pre-trained classical neural network, with which the parameters that satisfy a preset condition are associated.
3. The method according to any one of claims 1-2, further comprising:
acquiring a total difference, wherein the total difference is determined according to the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which each sample quantum data point belongs;
training the plurality of local quantum circuits based on the total difference.
4. A model training method for quantum data classification, comprising:
acquiring training data; the training data comprises first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of partial quantum bits obtained by measuring after a plurality of local quantum circuits act on the partial quantum bits of each sample quantum data point respectively; wherein the plurality of local quantum circuits and the portions of qubits of the sample quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ;
training a classical neural network by using the training data so as to enable the trained classical neural network to classify a quantum data set to be classified;
wherein, before acquiring the training data, the method further comprises:
acquiring pre-training data; the pre-training data comprises second category information to which each pre-training quantum data point in a quantum data pre-training set belongs, and second state information of part of candidate quantum bits obtained by measuring after a plurality of candidate local quantum circuits respectively act on part of candidate quantum bits of the pre-training quantum data points selected randomly, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
pre-training the classical neural network by using the pre-training data to determine the plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and using partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding sample quantum data points.
5. The method of claim 4, wherein the determining the plurality of local quantum circuits from the plurality of candidate local quantum circuits and using the partial candidate qubits of the acted pre-training quantum data point as the partial qubits of the corresponding sample quantum data point comprises:
acquiring the candidate local quantum circuits respectively associated with each parameter of the pre-trained classical neural network;
determining a plurality of candidate local quantum circuits associated with parameters meeting preset conditions in the parameters as the plurality of local quantum circuits, and using partial candidate quantum bits of the pre-training quantum data points which act respectively as the partial quantum bits of the corresponding sample quantum data points.
6. The method of any of claims 4-5, wherein the training a classical neural network with the training data comprises:
for each sample quantum data point in the training data, after the plurality of local quantum circuits are respectively applied to partial quantum bits of the sample quantum data point, measuring first state information of the partial quantum bits, inputting the first state information into the classical neural network, and acquiring prediction information corresponding to the sample quantum data point output by the classical neural network;
determining a total difference degree according to the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information respectively belonging to each sample quantum data point;
and determining a loss function according to the total difference degree so as to train the classical neural network based on the loss function.
7. The method of claim 6, wherein the determining the total difference according to the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which each sample quantum data point belongs comprises:
calculating, for each sample quantum data point in the training set of quantum data, a cross entropy between the prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs, and taking the cross entropy as a difference between the prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs;
and determining the total difference according to the difference between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which the sample quantum data point belongs.
8. The method of claim 6, wherein the loss function is further used to train the plurality of local quantum circuits.
9. A method of quantum data classification, comprising:
obtaining a quantum data set to be classified;
respectively acting a plurality of local quantum circuits on partial quantum bits of quantum data points in the quantum data set to be classified, and measuring to obtain third state information of the acted partial quantum bits, so that the trained classical neural network classifies the quantum data set to be classified according to the third state information; wherein the plurality of local quantum circuits and the part of qubits of the quantum data points acted on by the local quantum circuits respectively are determined in a pre-training manner, and the qubits acted on different local quantum circuits have differences;
wherein determining the plurality of local quantum circuits and the portion of qubits of the quantum data points acted upon, respectively, by the pre-training manner comprises:
acquiring a quantum data pre-training set and second class information to which each pre-training quantum data point in the quantum data pre-training set belongs;
for each pre-training quantum data point, respectively applying a plurality of candidate local quantum circuits to part of candidate quantum bits of the pre-training quantum data point selected randomly, and measuring to obtain second state information of the applied part of candidate quantum bits, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
and using the second state information and the second category information as pre-training data for pre-training the classical neural network, determining the plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and using partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding quantum data points.
10. A method of quantum data classification, comprising:
obtaining third state information of partial quantum bits obtained by measuring after a plurality of local quantum circuits respectively act on partial quantum bits of quantum data points in a quantum data set to be classified; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ;
inputting the third state information into a trained classical neural network to obtain prediction information of the class to which the quantum data points in the quantum data set belong;
wherein determining the plurality of local quantum circuits and the portion of qubits of the quantum data points acted upon, respectively, by a pre-training manner comprises:
acquiring pre-training data; the pre-training data comprises second category information to which each pre-training quantum data point in a quantum data pre-training set belongs, and second state information of part of candidate quantum bits obtained by measuring after a plurality of candidate local quantum circuits respectively act on part of candidate quantum bits of the pre-training quantum data points selected randomly, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
pre-training the classical neural network by using the pre-training data to determine the plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and taking partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding quantum data points.
11. A model training apparatus for quantum data classification, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a quantum data training set and first class information of each sample quantum data point in the quantum data training set;
the determining module is used for determining a plurality of local quantum circuits and partial quantum bits of the sample quantum data points acted by the local quantum circuits respectively in a pre-training mode;
the first processing module is used for respectively acting a plurality of local quantum circuits on the part of the qubits of the sample quantum data points aiming at each sample quantum data point, and measuring to obtain first state information of the acted part of the qubits, wherein the qubits acted by different local quantum circuits have differences;
the second processing module is used for taking the first state information and the first class information as training data for training a classical neural network so as to enable the trained classical neural network to classify a quantum data set to be classified;
wherein the determining module comprises:
the quantum data pre-training device comprises a first acquisition unit, a second acquisition unit and a control unit, wherein the first acquisition unit is used for acquiring a quantum data pre-training set and second category information to which each pre-training quantum data point in the quantum data pre-training set belongs;
the first processing unit is used for respectively acting a plurality of candidate local quantum circuits on part of candidate quantum bits of the pre-training quantum data points selected randomly aiming at each pre-training quantum data point, and measuring to obtain second state information of the acted part of candidate quantum bits, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
a second processing unit, configured to use the second state information and the second class information as pre-training data for pre-training the classical neural network, determine the multiple local quantum circuits from the multiple candidate local quantum circuits according to parameters of the pre-trained classical neural network, and use partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding sample quantum data points.
12. The apparatus of claim 11, wherein the plurality of local quantum circuits and the portions of qubits of the sample quantum data points that are respectively acted upon are a plurality of candidate local quantum circuits and the portions of qubits that are respectively acted upon, of the candidate local quantum circuits respectively associated with the parameters of the pre-trained classical neural network, to which parameters that satisfy a preset condition are associated.
13. The apparatus of any of claims 11-12, further comprising:
a second obtaining module, configured to obtain a total difference, where the total difference is determined according to prediction information corresponding to each sample quantum data point in the quantum data training set and first class information to which the sample quantum data point belongs;
a first training module to train the plurality of local quantum circuits based on the total difference.
14. A model training apparatus for quantum data classification, comprising:
the third acquisition module is used for acquiring training data; the training data comprises first class information to which each sample quantum data point in a quantum data training set belongs, and first state information of partial quantum bits obtained by measuring after a plurality of local quantum circuits act on the partial quantum bits of each sample quantum data point respectively; wherein the plurality of local quantum circuits and the portions of qubits of the sample quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ;
the second training module is used for training a classical neural network by using the training data so as to enable the trained classical neural network to classify the quantum data set to be classified;
the fourth acquisition module is used for acquiring pre-training data; the pre-training data comprises second class information to which each pre-training quantum data point in a quantum data pre-training set belongs, and second state information of part of candidate quantum bits obtained by measuring after a plurality of candidate local quantum circuits respectively act on part of candidate quantum bits of the pre-training quantum data points selected randomly, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
a third training module, configured to pre-train the classical neural network with the pre-training data, to determine the multiple local quantum circuits from the multiple candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and use partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding sample quantum data points.
15. The apparatus of claim 14, wherein the third training module comprises:
the second acquisition unit is used for acquiring the candidate local quantum circuits respectively associated with the parameters of the pre-trained classical neural network;
a first determining unit, configured to determine, as the plurality of local quantum circuits, the plurality of candidate local quantum circuits associated with the parameter that satisfies a preset condition among the parameters, and use partial candidate quantum bits of the pre-training quantum data points that act respectively as the partial quantum bits of the corresponding sample quantum data point.
16. The apparatus of any of claims 14-15, wherein the second training module comprises:
a third obtaining unit, configured to apply the multiple local quantum circuits to partial qubits of the sample quantum data points, respectively, for each sample quantum data point in the training data, measure first state information of the partial qubits, input the first state information to the classical neural network, and obtain prediction information corresponding to the sample quantum data point output by the classical neural network;
the second determining unit is used for determining the total difference degree according to the prediction information respectively corresponding to each sample quantum data point in the quantum data training set and the first class information respectively belonging to each sample quantum data point;
and the third determining unit is used for determining a loss function according to the total difference degree so as to train the classical neural network based on the loss function.
17. The apparatus of claim 16, wherein the second determining unit comprises:
a computing subunit, configured to compute, for each sample quantum data point in the quantum data training set, a cross entropy between the prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs, and use the cross entropy as a difference between the prediction information corresponding to the sample quantum data point and the first class information to which the sample quantum data point belongs;
a determining subunit, configured to determine the total difference according to a difference between the prediction information corresponding to each sample quantum data point in the quantum data training set and the first class information to which the sample quantum data point belongs.
18. The apparatus of claim 16, wherein the loss function is further to train the plurality of local quantum circuits.
19. A quantum data sorting apparatus comprising:
a fifth obtaining module, configured to obtain a quantum data set to be classified;
the third processing module is used for respectively acting the plurality of local quantum circuits on partial quantum bits of quantum data points in the quantum data set to be classified and measuring to obtain third state information of the acted partial quantum bits so that the trained classical neural network classifies the quantum data set to be classified according to the third state information; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ;
wherein determining the plurality of local quantum circuits and the portion of qubits of the quantum data points acted upon, respectively, by the pre-training manner comprises:
acquiring a quantum data pre-training set and second class information to which each pre-training quantum data point in the quantum data pre-training set belongs;
for each pre-training quantum data point, respectively applying a plurality of candidate local quantum circuits to part of candidate quantum bits of the pre-training quantum data point selected randomly, and measuring to obtain second state information of the applied part of candidate quantum bits, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
and using the second state information and the second category information as pre-training data for pre-training the classical neural network, determining the plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and using partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding quantum data points.
20. A quantum data sorting apparatus comprising:
the sixth acquisition module is used for acquiring third state information of partial quantum bits obtained by measuring after the plurality of local quantum circuits respectively act on the partial quantum bits of the quantum data points in the quantum data sets to be classified; wherein the plurality of local quantum circuits and the portions of qubits of the quantum data points acted upon respectively are determined in a pre-training manner, and the qubits acted upon by different ones of the local quantum circuits differ;
the fourth processing module is used for inputting the third state information into the trained classical neural network to obtain the prediction information of the class to which the quantum data point in the quantum data set belongs;
wherein determining the plurality of local quantum circuits and the portion of qubits of the quantum data points acted upon, respectively, by a pre-training manner comprises:
acquiring pre-training data; the pre-training data comprises second category information to which each pre-training quantum data point in a quantum data pre-training set belongs, and second state information of part of candidate quantum bits obtained by measuring after a plurality of candidate local quantum circuits respectively act on part of candidate quantum bits of the pre-training quantum data points selected randomly, wherein the part of candidate quantum bits acted by different candidate local quantum circuits have differences;
pre-training the classical neural network by using the pre-training data to determine the plurality of local quantum circuits from the plurality of candidate local quantum circuits according to each parameter of the pre-trained classical neural network, and taking partial candidate quantum bits of the pre-training quantum data points as the partial quantum bits of the corresponding quantum data points.
21. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 4-8 or to perform the method of claim 10.
22. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 4-8 or the method of claim 10.
CN202110649751.6A 2021-06-10 2021-06-10 Model training method for quantum data classification and quantum data classification method Active CN113379059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110649751.6A CN113379059B (en) 2021-06-10 2021-06-10 Model training method for quantum data classification and quantum data classification method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110649751.6A CN113379059B (en) 2021-06-10 2021-06-10 Model training method for quantum data classification and quantum data classification method

Publications (2)

Publication Number Publication Date
CN113379059A CN113379059A (en) 2021-09-10
CN113379059B true CN113379059B (en) 2022-09-23

Family

ID=77573776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110649751.6A Active CN113379059B (en) 2021-06-10 2021-06-10 Model training method for quantum data classification and quantum data classification method

Country Status (1)

Country Link
CN (1) CN113379059B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023125857A1 (en) * 2021-12-30 2023-07-06 本源量子计算科技(合肥)股份有限公司 Model training method based on machine learning framework system and related device
CN116432764B (en) * 2021-12-30 2024-06-14 本源量子计算科技(合肥)股份有限公司 Machine learning frame
CN114372539B (en) * 2022-03-22 2022-07-15 合肥本源量子计算科技有限责任公司 Machine learning framework-based classification method and related equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109643710A (en) * 2016-09-29 2019-04-16 英特尔公司 On piece control logic for quantum bit
CN109858628A (en) * 2019-02-28 2019-06-07 北京百度网讯科技有限公司 Compile method, apparatus, equipment and the computer readable storage medium of quantum circuit
CN111510157A (en) * 2020-04-15 2020-08-07 腾讯科技(深圳)有限公司 Quantum error correction decoding method, device and chip based on neural network
CN112381233A (en) * 2020-11-20 2021-02-19 北京百度网讯科技有限公司 Data compression method and device, electronic equipment and storage medium
CN112418387A (en) * 2020-11-18 2021-02-26 北京百度网讯科技有限公司 Quantum data processing method and apparatus
CN112446432A (en) * 2020-11-30 2021-03-05 西安电子科技大学 Handwritten picture classification method based on quantum self-learning self-training network
CN112529198A (en) * 2020-12-23 2021-03-19 北京百度网讯科技有限公司 Quantum entanglement state processing method, device, equipment, storage medium and product
CN112529202A (en) * 2020-12-23 2021-03-19 北京百度网讯科技有限公司 Quantum entanglement state distribution method, device, equipment, storage medium and product
CN112561069A (en) * 2020-12-23 2021-03-26 北京百度网讯科技有限公司 Model processing method, device, equipment, storage medium and product

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109272115A (en) * 2018-09-05 2019-01-25 宽凳(北京)科技有限公司 A kind of neural network training method and device, equipment, medium
US11157827B2 (en) * 2019-10-30 2021-10-26 Zapata Computing, Inc. Hybrid quantum-classical computer system for parameter-efficient circuit training
CN111242158A (en) * 2019-12-05 2020-06-05 北京迈格威科技有限公司 Neural network training method, image processing method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109643710A (en) * 2016-09-29 2019-04-16 英特尔公司 On piece control logic for quantum bit
CN109858628A (en) * 2019-02-28 2019-06-07 北京百度网讯科技有限公司 Compile method, apparatus, equipment and the computer readable storage medium of quantum circuit
CN111510157A (en) * 2020-04-15 2020-08-07 腾讯科技(深圳)有限公司 Quantum error correction decoding method, device and chip based on neural network
CN112418387A (en) * 2020-11-18 2021-02-26 北京百度网讯科技有限公司 Quantum data processing method and apparatus
CN112381233A (en) * 2020-11-20 2021-02-19 北京百度网讯科技有限公司 Data compression method and device, electronic equipment and storage medium
CN112446432A (en) * 2020-11-30 2021-03-05 西安电子科技大学 Handwritten picture classification method based on quantum self-learning self-training network
CN112529198A (en) * 2020-12-23 2021-03-19 北京百度网讯科技有限公司 Quantum entanglement state processing method, device, equipment, storage medium and product
CN112529202A (en) * 2020-12-23 2021-03-19 北京百度网讯科技有限公司 Quantum entanglement state distribution method, device, equipment, storage medium and product
CN112561069A (en) * 2020-12-23 2021-03-26 北京百度网讯科技有限公司 Model processing method, device, equipment, storage medium and product

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
Layerwise learning for quantum neural networks;Andrea Skolik等;《Quantum Machine Intelligence volume》;20210125;1-11 *
Multi-Spectral Image Classification with Quantum Neural Network;Piotr Gawron等;《IGARSS 2020 - 2020 IEEE International Geoscience and Remote Sensing Symposium》;20210217;3513-3516 *
Quantum Neural Networks Learning Algorithm Based on a Global Search;Fernando Maciano de Paula Neto等;《2019 8th Brazilian Conference on Intelligent Systems (BRACIS)》;20191205;842-847 *
混合量子优化算法理论及应用研究;杨佳;《中国博士学位论文全文数据库 信息科技辑》;20091215;第2009年卷(第12期);I138-5 *
量子网络中量子神经元电路设计与耦合腔系统物理特性研究;郑昱;《中国优秀硕士学位论文全文数据库 基础科学辑》;20200415;第2020年卷(第4期);A005-5 *
针对若干数据挖掘问题的量子算法研究;吁超华;《中国博士学位论文全文数据库 基础科学辑》;20190815;第2019年卷(第8期);A005-11 *

Also Published As

Publication number Publication date
CN113379059A (en) 2021-09-10

Similar Documents

Publication Publication Date Title
CN113657465B (en) Pre-training model generation method and device, electronic equipment and storage medium
CN113379059B (en) Model training method for quantum data classification and quantum data classification method
CN113326764B (en) Method and device for training image recognition model and image recognition
CN112906502A (en) Training method, device and equipment of target detection model and storage medium
CN113642431B (en) Training method and device of target detection model, electronic equipment and storage medium
CN112784778B (en) Method, apparatus, device and medium for generating model and identifying age and sex
CN112561082A (en) Method, device, equipment and storage medium for generating model
CN112580733B (en) Classification model training method, device, equipment and storage medium
CN113705628B (en) Determination method and device of pre-training model, electronic equipment and storage medium
CN114861886B (en) Quantification method and device of neural network model
CN112418387A (en) Quantum data processing method and apparatus
CN113449778B (en) Model training method for quantum data classification and quantum data classification method
CN113657483A (en) Model training method, target detection method, device, equipment and storage medium
CN112560985A (en) Neural network searching method and device and electronic equipment
CN112650885A (en) Video classification method, device, equipment and medium
CN113902010A (en) Training method of classification model, image classification method, device, equipment and medium
CN113420792A (en) Training method of image model, electronic equipment, road side equipment and cloud control platform
CN114882315A (en) Sample generation method, model training method, device, equipment and medium
CN113657538A (en) Model training method, data classification method, device, equipment, storage medium and product
CN115294405B (en) Method, device, equipment and medium for constructing crop disease classification model
CN113961765B (en) Searching method, searching device, searching equipment and searching medium based on neural network model
CN115359322A (en) Target detection model training method, device, equipment and storage medium
CN114548307A (en) Classification model training method and device, and classification method and device
CN113989562A (en) Model training and image classification method and device
CN113190154A (en) Model training method, entry classification method, device, apparatus, storage medium, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant