CN115482111A - QSVM-based multi-factor stock selection method and related device - Google Patents

QSVM-based multi-factor stock selection method and related device Download PDF

Info

Publication number
CN115482111A
CN115482111A CN202211313790.XA CN202211313790A CN115482111A CN 115482111 A CN115482111 A CN 115482111A CN 202211313790 A CN202211313790 A CN 202211313790A CN 115482111 A CN115482111 A CN 115482111A
Authority
CN
China
Prior art keywords
data
sample data
processed
sample
circuit
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.)
Pending
Application number
CN202211313790.XA
Other languages
Chinese (zh)
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.)
Origin Quantum Computing Technology Co Ltd
Original Assignee
Origin Quantum Computing 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 Origin Quantum Computing Technology Co Ltd filed Critical Origin Quantum Computing Technology Co Ltd
Priority to CN202211313790.XA priority Critical patent/CN115482111A/en
Publication of CN115482111A publication Critical patent/CN115482111A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/60Quantum algorithms, e.g. based on quantum optimisation, quantum Fourier or Hadamard transforms

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Marketing (AREA)
  • Data Mining & Analysis (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Mathematics (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Technology Law (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Complex Calculations (AREA)

Abstract

The embodiment of the invention provides a QSVM-based multi-factor stock selection method and a related device, and relates to the field of financial analysis. Acquiring data to be processed, sample data and a kernel matrix of the sample data; the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks; and inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit, and determining a strand selection strategy according to a processing result of the strand selection quantum circuit on the data to be processed and the sample data. By the method, the data to be processed can be reasonably analyzed, and the error of the processing result is reduced, so that the user can accurately select the stocks worth buying.

Description

QSVM-based multi-factor stock selection method and related device
Technical Field
The invention relates to the field of financial analysis, in particular to a QSVM-based multi-factor stock selection method and a related device.
Background
At present, in a stock market, a user is often required to analyze various data of stocks through experience of the user so as to select stocks to be bought, but since the stock rise and fall are often influenced by various complex factors, the user often cannot reasonably analyze the stocks based on various data, so that the result error is large, and the stocks to be bought cannot be accurately selected.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a QSVM-based multi-factor stock selection method and a related apparatus, so as to solve the problems that in the prior art, a user cannot reasonably analyze based on various stocks, resulting errors are large, and the stocks worth buying cannot be selected more accurately.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, the present invention provides a QSVM-based multi-factor stock selection method, including:
acquiring data to be processed, sample data and a kernel matrix of the sample data; the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks;
and inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit, and determining a strand selection strategy according to a processing result of the strand selection quantum circuit on the data to be processed and the sample data.
In an optional embodiment, the candidate quantum wire includes a to-be-processed data analysis module and a sample data processing module;
the inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit comprises:
inputting the data to be processed to the data analysis module to be processed, and inputting the sample data and the kernel matrix to the sample data processing module; the sample data processing module is used for carrying out amplitude coding on the sample data and extracting characteristic values of the sample data subjected to amplitude coding and the kernel matrix, and the to-be-processed data analysis module is used for analyzing the to-be-processed data.
In an optional implementation manner, the sample data processing module includes a first amplitude encoding circuit and a feature value extracting circuit, where the first amplitude encoding circuit is configured to perform amplitude encoding on the sample data and encode the amplitude-encoded sample data to the feature value extracting circuit, and the feature value extracting circuit is configured to perform feature value extraction on the amplitude-encoded sample data and the kernel matrix.
In an optional embodiment, the to-be-processed data analysis module includes a second amplitude coding circuit and a data analysis circuit, the second amplitude coding circuit is configured to perform amplitude coding on the to-be-processed data, and code the amplitude-coded to-be-processed data to the data analysis circuit, and the data analysis circuit is configured to analyze the amplitude-coded to-be-processed data.
In an optional embodiment, the sample data is a plurality of samples, and the method further includes:
combining the plurality of sample data pairwise to obtain a plurality of combined sample data;
inputting one combined sample data to a preset similarity obtaining circuit each time, and obtaining the similarity between two sample data in each combined sample data through the similarity obtaining circuit;
and generating the kernel matrix according to a plurality of the similarities.
In an optional embodiment, the data to be processed is obtained by adding a first auxiliary feature to initial data to be processed and performing normalization processing on the initial data to be processed to which the auxiliary feature is added; the sample data is obtained by adding a second assistant feature to the initial sample data and carrying out normalization processing on the initial sample data added with the assistant feature;
wherein the first and second assist features are for equaling a sum of squares of the data to be processed and a sum of squares of the sample data.
In an optional implementation manner, the determining, according to the result of processing the to-be-processed data and the sample data by the stock selection quantum line, a stock selection policy includes:
running the strand-selected quantum wire and measuring an auxiliary control bit of the strand-selected quantum wire;
if the auxiliary control bit meets a preset condition, measuring the control bit of the strand selection quantum line;
if the probability that the control bit is in the target state is greater than or equal to the preset probability, determining stock selection;
and if the probability that the control bit is in the target state is smaller than the preset probability, determining that no stock is selected.
In a second aspect, the present invention provides a QSVM-based multi-factor stock selection apparatus, including:
the acquisition module is used for acquiring data to be processed, sample data and a kernel matrix of the sample data; the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks;
and the determining module is used for inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum line and determining a strand selection strategy according to a processing result of the strand selection quantum line on the data to be processed and the sample data.
In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program capable of being executed by the processor, and the processor can execute the computer program to implement the method of any one of the foregoing embodiments.
In a fourth aspect, the invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of the preceding embodiments.
The QSVM-based multi-factor stock selection method and the related device provided by the embodiment of the invention are used for acquiring the data to be processed, the sample data and the kernel matrix of the sample data, then inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset stock selection quantum line, and determining a stock selection strategy according to the processing result of the data to be processed and the sample data of the stock selection quantum line, wherein the data to be processed comprises the influence factor data of the stock to be analyzed, and the sample data comprises the influence factor data of the sample stock and the rise-fall tag. The method processes the data to be processed, the sample data and the core matrix of the sample data through the preset stock selection quantum circuit, and determines the corresponding stock selection strategy according to the processing result of the data to be processed and the sample data, so that the data to be processed can be reasonably analyzed, the error of the processing result is reduced, and the user can accurately select the stock worth buying.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a block diagram of an electronic device provided by an embodiment of the invention;
FIG. 2 is a flow chart illustrating a QSVM-based multi-factor stock-selection method according to an embodiment of the present invention;
FIG. 3 is another flow chart diagram illustrating a QSVM-based multi-factor stock-selection method according to an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of a similarity acquisition line;
fig. 5 shows a schematic diagram of a structure of a selective quantum wire;
fig. 6 shows a schematic of the structure of a HHL line;
fig. 7 is a schematic flowchart of another QSVM-based multi-factor stock selection method according to an embodiment of the present application;
fig. 8 is a functional block diagram of a QSVM-based multi-factor stock selection apparatus according to an embodiment of the present invention.
Icon: 10-an electronic device; 100-a memory; 110-a processor; 120-a communication module; 20-a to-be-processed data analysis module; 200-a second amplitude encoding circuit; 201-data analysis line; 21-sample data processing module; 210-a first amplitude encoding line; 211-eigenvalue extraction circuit; 300-a phase estimation module; 310-a phase rotation module; 320-an inverse phase estimation module; 400-an acquisition module; 410-determination module.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
Fig. 1 is a block diagram of an electronic device 10 according to an embodiment of the present disclosure. The electronic device 10 includes a memory 100, a processor 110, and a communication module 120. The elements of the memory 100, the processor 110 and the communication module 120 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 100 is used for storing programs or data. The Memory 100 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Read Only Memory (EPROM), an electrically Erasable Read Only Memory (EEPROM), and the like.
The processor 110 is used to read/write data or programs stored in the memory and perform corresponding functions.
The communication module 120 is configured to establish a communication connection between the server and another communication terminal through the network, and to transceive data through the network.
It should be understood that the configuration shown in fig. 1 is merely a schematic diagram of the configuration of the electronic device 10, and that the electronic device 10 may include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, can implement the QSVM-based multi-factor stock selection method provided in the embodiments of the present application.
Next, taking the electronic device 10 in fig. 1 as an execution subject, an exemplary description is given of the QSVM-based multi-factor stock selection method according to the embodiment of the present application, with reference to a flowchart. Specifically, fig. 2 is a schematic flow chart of a QSVM-based multi-factor stock selection method according to an embodiment of the present application, please refer to fig. 2, where the method includes:
s20, acquiring data to be processed, sample data and a kernel matrix of the sample data;
the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks;
optionally, the stock to be analyzed is a stock in an unknown situation of rise and fall, and the sample stock is a stock in a known situation of rise and fall.
It can be understood that the fluctuation label of the sample stock is used for representing the fluctuation condition of the sample stock. In one possible implementation, the fluctuation tag may be in the form of "+1", "-1", or the like.
Alternatively, the impact factor data of a stock may be data that can affect the rise and fall of a stock. Since the stock fluctuation is influenced by the operation condition of the company, for example, a company with better financial condition, strong profitability and less debt has a higher stock fluctuation trend, the profit data, the operation data, the debt data, etc. of the company can be selected as the influence factor data of the stock of the company.
Optionally, each value in the kernel matrix of the sample data represents an inner product between the sample data, wherein a diagonal of the kernel matrix is the inner product of each sample data with itself.
And S21, inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit, and determining a strand selection strategy according to a processing result of the strand selection quantum circuit on the data to be processed and the sample data.
Optionally, the preset optional quantum wire may be set in the electronic device in advance, and is configured to process the sample data, the kernel matrix of the sample data, and the data to be processed at the same time, so as to obtain a processing result.
Alternatively, the stock-selection strategy may be whether to suggest a buy. In one example, the electronic device may output a stock selection policy of "suggest buy" or "not suggest buy" based on the processing result, or may directly characterize the suggest buy by "+1" and the suggest buy by "+ 1".
In this embodiment, after obtaining the data to be processed, the sample data, and the kernel matrix of the sample data, the electronic device may process the data to be processed, the sample data, and the kernel matrix of the sample data through a preset strand selection quantum line by using a preset input value of the kernel matrix of the obtained data to be processed, the sample data, and the sample data, so as to obtain a processing result, and determine a strand selection policy according to the result.
The QSVM-based multi-factor stock selection method and the related device provided by the embodiment of the invention have the advantages that the kernel matrix of the data to be processed, the sample data and the sample data is obtained, then the kernel matrix of the data to be processed, the sample data and the sample data is input into a preset stock selection quantum line, and a stock selection strategy is determined according to the processing result of the data to be processed and the sample data of the stock selection quantum line, wherein the data to be processed comprises the influence factor data of the stock to be analyzed, and the sample data comprises the influence factor data of the sample stock and the rise-fall label. The method processes the data to be processed, the sample data and the core matrix of the sample data through the preset stock selection quantum circuit, and determines the corresponding stock selection strategy according to the processing result of the data to be processed and the sample data, so that the data to be processed can be reasonably analyzed, the error of the processing result is reduced, and the user can accurately select the stock worth buying.
Optionally, based on the characteristics of the quantum computer, the data input into the preset strand selection quantum line needs to be normalized in advance, and meanwhile, considering that the data may lose one dimension after being normalized, so as to cause feature loss, an auxiliary feature needs to be added to the data to supplement the lost dimension, so as to reduce the influence caused by the feature loss.
Specifically, the data to be processed can be obtained by adding a first assistant feature to the initial data to be processed and performing normalization processing on the initial data to be processed to which the first assistant feature is added; the sample data is obtained by adding a second assistant feature to the initial sample data and performing normalization processing on the initial sample data added with the second assistant feature;
wherein the first and second assistant features are used to make the sum of squares of the data to be processed equal to the sum of squares of the sample data.
Optionally, the initial data to be processed and the initial sample data refer to data that is obtained initially by the electronic device and has not been processed.
In this embodiment, the electronic device may add a corresponding first auxiliary feature for each piece of data to be processed, and add a corresponding second auxiliary feature for each piece of sample data.
It will be appreciated that the sum of squares of each of the data to be processed to which the first assist feature is added, and the sum of squares of each of the sample data to which the second assist feature is added, are both equal.
In a possible implementation manner, the electronic device may determine, according to a plurality of data to be processed and a plurality of sample data, data in which a sum of squares is maximum, determine that an assist feature corresponding to the data is 0, and add, with reference to the sum of squares of the data, a first assist feature and a second assist feature corresponding to other data to be processed and sample data, respectively.
In one example, if the data to be processed and the sample data are two-dimensional data, and the data to be processed includes (1, 2), (3, 4), and the sample data includes (1, 3), (2, 3), where the data with the largest sum of squares is the data to be processed (3, 4), and the sum of squares thereof is 25, it may be determined that the first assistant feature corresponding to the data to be processed is 0, that is, (3, 4, 0), and at the same time, the first assistant feature may be added to other data to be processed and a second assistant feature may be added to the sample data with reference to 25.
In the present example, the data to be processed to which the first assist feature is added is
Figure BDA0003908158570000081
(3, 4, 0); the sample data to which the second assistant feature is added may be
Figure BDA0003908158570000082
Optionally, the electronic device may further include a similarity obtaining line, and the electronic device may obtain a kernel matrix of the sample data according to the plurality of sample data and the similarity obtaining line.
Specifically, on the basis of fig. 2, fig. 3 is another schematic flow chart of a QSVM-based multi-factor stock selection method according to an embodiment of the present application, please refer to fig. 3, where the method further includes:
s10, combining the multiple sample data pairwise to obtain multiple combined sample data;
step S11, inputting one combined sample data to a preset similarity obtaining line each time, and obtaining the similarity between two sample data in each combined sample data through the similarity obtaining line;
optionally, the electronic device may combine, for each sample data, the sample data with other sample data two by two, so as to obtain a plurality of combined sample data.
In this embodiment, the electronic device may input one combined sample data to a preset similarity obtaining line each time, and process two sample data in the combined sample data through the similarity obtaining line, so as to obtain a similarity between the two sample data.
In one possible implementation, the similarity obtaining line may be a swap-test line. Specifically, fig. 4 is a schematic structural diagram of the similarity obtaining circuit, please refer to fig. 4, where the similarity obtaining circuit includes three qubits q-0, q-1 and q-2, and the circuit may include two H (Hadamard ) gates, a controlled SWAP gate and a measurement module M.
It should be noted that quantum logic gates can be generally used to process quantum bits, and the quantum logic gates can be the basis for the quantum state evolution and the formation of quantum circuits. Quantum logic gates include single bit quantum logic gates (single gate), two bit quantum logic gates (double gate), and multi-bit quantum logic gates (multi gate). In this embodiment, the H gate is one of the single gates and the controlled SWAP gate is one of the double gates.
In addition, the quantum state is a logical state of a qubit, and in a quantum algorithm (or quantum program), a binary representation is adopted for the quantum state of a group of qubits included in a quantum circuit, for example, a group of qubits is q1, q2, and q3, representing the 1 st, 2 nd, and 3 rd qubits, and the qubits are ordered from the high bit to the low bit in the binary representation as q3, q2, and q1, and the quantum states corresponding to the group of qubits have 2 quanta total number of powers, that is, 8 eigenstates (determined states): the method comprises the following steps of |000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>, the bit of each quantum state corresponds to the quantum bit, for example, |001> state, 001 corresponds to q3q2q1 from high position to low position, and | is a Dirac symbol.
Stated with a single qubit, the logic state of a single qubit may be in a superposition of |0> state, |1> state, |0> state and |1> state (indeterminate state), which may be specifically represented as = a |0> + b |1>, where a and b are complex numbers representing the amplitude (magnitude of probability) of the quantum state, the square of the modulus of the amplitude represents the probability, | a |2, | b |2 represent the probability that the logic state is |0> state, |1> state, | a |2+ | b |2=1, respectively. In short, a quantum state is a superposition state of the eigenstates, and is in a uniquely determined eigenstate when the probability of other states is 0.
Optionally, in the similarity obtaining circuit, an H gate is used to convert the prepared quantum state into a superposition state; the steered SWAP gate is used to exchange quantum states on the q-1 and q-2 qubits; the measurement module M is used to measure the quantum states on the q-0 qubits.
In this embodiment, the electronic device may prepare two sample data in one combined sample data to the q-1 and q-2 qubits of the similarity obtaining line, process the two sample data through the H gate, the controlled SWAP gate, and the H gate, and finally measure the quantum state on the q-0 qubit through the measurement module M, thereby obtaining the similarity between the two sample data in the combined sample data.
Optionally, the quantum state obtained after the first H-gate treatment
Figure BDA0003908158570000101
This can be obtained by the following formula:
Figure BDA0003908158570000102
where |0, a, b >, |1, a, b > characterize the quantum state after passing through the H-gate.
Optionally, quantum states obtained after controlled SWAP gates
Figure BDA0003908158570000103
This can be obtained by the following formula:
Figure BDA0003908158570000104
optionally, the quantum state obtained after a second H-gate
Figure BDA0003908158570000105
This can be obtained by the following formula:
Figure BDA0003908158570000111
on this basis, the probability P (| 0 >) that the line is measured as |0> state can be obtained by the following formula:
Figure BDA0003908158570000112
wherein, | a>Characterizing the quantum state at the q-1 qubit, | b>Characterizing quantum states, noncircular colors, on q-2 qubits<a|b>| 2 Characterization | a>And | b>I.e. the similarity between two sample data in the combined sample data.
And S12, generating a kernel matrix according to the plurality of similarities.
Optionally, the electronic device may obtain a similarity between two sample data in each combined sample data, and then generate a corresponding kernel matrix according to the multiple similarities.
Alternatively, if the dimension of sample data is n, an n × n kernel matrix may be generated, and 0 may be supplemented to the nearest 2 exponentiation power matrix to satisfy the quantum state.
Optionally, fig. 5 is a schematic structural diagram of a strand-selecting quantum circuit, please refer to fig. 5, the strand-selecting quantum circuit includes two H gates, a to-be-processed data analysis module 20, and a sample data processing module 21, where the to-be-processed data analysis module 20 is configured to process data to be processed, and the sample data processing module 21 is configured to process sample data and a kernel matrix.
Optionally, an H-gate is used to convert the prepared quantum state into a stacked state. It will be appreciated that the selected quantum wire is a variation of the swap-test wire described above.
Alternatively, a diagonal line in front of each of the selected quantum wires may be used to indicate that the wire may have more than one qubit, i.e., the wire may be made up of multiple wires.
On the basis, the electronic equipment can respectively input the data to be processed, the sample data and the core matrix of the sample data into the modules for corresponding processing.
Specifically, on the basis of fig. 2, the inputting of the data to be processed, the sample data, and the kernel matrix of the sample data into the preset strand selection quantum line in step S21 may further be implemented by the following steps:
inputting data to be processed to a data analysis module to be processed, and inputting sample data and a kernel matrix to a sample data processing module;
the data analysis module to be processed is used for analyzing the data to be processed.
In this embodiment, the sample data processing module 21 can obtain the quantum state | φ after processing 1 >After the to-be-processed data analysis module 20 processes the data, a quantum state | phi can be obtained 2 >As can be appreciated, the quantum state | φ 1 >Contains sample data information, quantum state | phi 2 >Contains the information of data to be processed, and the quantum state | phi 1 >And quantum state | phi 2 >Can be expressed by the following formulas respectively:
Figure BDA0003908158570000121
Figure BDA0003908158570000122
wherein N is 1 Normalized parameter, N, characterizing sample data 2 The normalization parameter representing the data to be processed, b representing the obtained offset phase, d representing the number of sample data, psi j Characterise the jth sample data, # 0 Characterizing the data to be processed, α j And characterizing the obtained weight coefficient.
Optionally, referring to fig. 5 again, the to-be-processed data analysis module 20 may include a second amplitude encoding circuit 200 and a data analysis circuit 201, where the second amplitude encoding circuit 200 is configured to perform amplitude encoding on to-be-processed data and encode the to-be-processed data after amplitude encoding to the data analysis circuit; the data analysis circuit 201 is used for analyzing the amplitude-encoded data to be processed.
Optionally, the amplitude encoding process U of the second amplitude encoding circuit 200 0 Can be expressed by the following formula:
U 0 |0>=|ψ 0 >
wherein, | ψ 0 >And characterizing the quantum state of the data to be classified.
Optionally, referring to fig. 5 again, the sample data processing module 21 further includes a first amplitude encoding circuit 210 and a characteristic value extracting circuit 211.
The first amplitude encoding circuit 210 is configured to perform amplitude encoding on sample data, and encode the amplitude-encoded sample data to the characteristic value extracting circuit; the eigenvalue extraction circuit 211 is configured to extract eigenvalues of the amplitude-encoded sample data and the kernel matrix.
Optionally, the amplitude encoding process U of the first amplitude encoding circuit 210 i Can be expressed by the following formula:
Figure BDA0003908158570000131
where j represents the input of the jth data, | j><j | characterization encodes only the j-th data, d characterizes the number of normalized data, | ψ j >And characterizing the quantum state of the data to be processed.
Alternatively, the first amplitude encoding line 210 may be constituted by a plurality of quantum lines.
Specifically, fig. 6 is a schematic structural diagram of the HHL circuit, please refer to fig. 6, which includes a phase estimation module 300, a phase rotation module 310 and an inverse phase estimation module 320.
Wherein the phase estimation module 300 is configured to transfer eigenvalues of the kernel matrix into basis vectors; the phase rotation module 310 is used to transfer the eigenvalues from the basis vectors to amplitudes; the inverse phase estimation block 320 is used to output the resulting quantum states.
Alternatively, the phase estimation process may employ QPE quantum wires, and specifically, QPE operation may be expressed as the following equation:
Figure BDA0003908158570000132
wherein,
Figure BDA0003908158570000133
characterizing the data input to be processed, λ j The value of the characteristic feature is characterized,
Figure BDA0003908158570000134
characteristic eigenvalue lambda j Is a function of the number of the approximate integers of (c),
Figure BDA0003908158570000135
characterizing basis vectors, b j Characterization of the expansion coefficient, | u j >A spectral decomposition base characterizing the matrix A; n represents the dimension of the matrix; j represents the corresponding sequence number.
Alternatively, the phase rotation module 310 may utilize a controlled rotation gate to transfer the characteristic value, and specifically, the controlled rotation process CR (k) may be expressed as the following formula:
Figure BDA0003908158570000141
wherein C is
Figure BDA0003908158570000142
Normalized coefficient of (a) and
Figure BDA0003908158570000143
on the basis of this, for
Figure BDA0003908158570000144
After the operation of traversing rotation quanta, the following can be obtained:
Figure BDA0003908158570000145
wherein,
Figure BDA0003908158570000146
characterizing the ergodic rotation of the sub-gate operation.
Alternatively, although theoretically, the quantum state after controlled rotation can already be measured to obtain a solution quantum state | x>But to avoid the occurrence of | u | j >The results are the same but
Figure BDA0003908158570000147
Different quantum states to be combined
Figure BDA0003908158570000148
The inverse QPE operation should be chosen to obtain the shape
Figure BDA0003908158570000149
On the basis of the resulting quantum states, the above rotation result may be subjected to inverse QPE by the inverse phase estimation module 320, and specifically, the inverse QPE process may be expressed as the following formula:
Figure BDA00039081585700001410
wherein,
Figure BDA00039081585700001411
characterize the inverse QPE. Characterization of
In this embodiment, the eigenvalue extraction circuit 211 may process the kernel matrix and the fluctuation label of the sample data to obtain the corresponding quantum state
Figure BDA00039081585700001412
b, and the quantum state is input to a first amplitude encoding circuit 210, an
Figure BDA00039081585700001413
b satisfies the following formula:
Figure BDA00039081585700001414
wherein, -1 and 1 represent the fluctuation label corresponding to the sample data, K represents the nuclear matrix, and gamma represents the preset probability threshold.
Optionally, with continued reference to fig. 5, a first line of the selected quantum line is a control bit, and fourth and fifth lines of the selected quantum line are auxiliary control bits, and for the characteristic value extraction line 211, it is only determined that the line successfully operates if the measurement result of the auxiliary bit position meets a preset condition, so that the quantum state of the auxiliary control bit of the fourth line may be measured first, and the quantum state of the control bit of the first line is measured again if the quantum state of the auxiliary control bit meets the preset condition, on this basis, the processing result of the selected quantum line on the data and the sample data includes a probability that the control bit is in the target state.
Specifically, on the basis of fig. 2, fig. 7 is another schematic flow chart of the multi-factor stock selection method based on the QSVM according to the embodiment of the present application, please refer to fig. 7, where the determining of the stock selection policy according to the processing result of the to-be-processed data and the sample data in the step S21 may be further implemented by the following steps:
step S21-1, operating the strand selection quantum circuit and measuring an auxiliary control bit of the strand selection quantum circuit;
step S21-2, if the auxiliary control bit meets the preset condition, measuring the control bit of the strand selection quantum circuit;
alternatively, the predetermined condition may be that the quantum state of the auxiliary control bit is a |1> state.
Alternatively, the electronic device may re-run the selected quantum wire if the quantum state of the auxiliary control bit does not satisfy the preset condition.
S21-3, if the probability that the control bit is in the target state is greater than or equal to the preset probability, determining stock selection;
and S21-4, if the probability that the control bit is in the target state is smaller than the preset probability, determining that no stock is selected.
Alternatively, the target state may be the |1> state; the preset probability may be one-half.
It will be appreciated that since the selected quantum wire is a variant of the swap-test wire described above, the control bit is |1>Probability of (2)
Figure BDA0003908158570000151
Wherein, | phi 1 >For the quantum states, | φ, generated by the sample data processing module 21 2 >The quantum states generated by the data analysis module 20 to be processed.
In this embodiment, the electronic device may first measure the quantum state of the auxiliary control bit, if the quantum state meets a preset condition, the electronic device may continue to measure the control bit of the stock selection quantum line, if the probability that the quantum state of the control bit is the target state is greater than or equal to a preset probability, it may be determined that the stock selection policy for the stock is stock selection, and if the probability that the quantum state of the control bit is the target state is less than the preset probability, it may be determined that the stock selection policy for the stock is stock non-selection.
In addition, through theoretical analysis, the error of the processing result is about 30%, and the error is small.
In order to execute the corresponding steps in the above embodiments and various possible manners, an implementation manner of the QSVM-based multi-factor stock selection apparatus is given below, and optionally, the QSVM-based multi-factor stock selection apparatus may adopt the device structure of the electronic device shown in fig. 1. Further, referring to fig. 8, fig. 8 is a functional block diagram of a multi-factor stock selection apparatus based on QSVM according to an embodiment of the present invention.
It should be noted that the basic principle and the generated technical effect of the multi-factor stock selecting device based on QSVM provided in this embodiment are the same as those of the above embodiment, and for the sake of brief description, no matter what this embodiment partially mentions, reference may be made to the corresponding contents in the above embodiment. The QSVM-based multi-factor stock selection device comprises: an acquisition module 400 and a determination module 410.
The obtaining module 400 is configured to obtain data to be processed, sample data, and a kernel matrix of the sample data; the data to be processed comprises the influence factor data of the stock to be analyzed, and the sample data comprises the influence factor data and the fluctuation label of the sample stock;
it is understood that the obtaining module 400 may also execute the step S20;
the determining module 410 is configured to input the data to be processed, the sample data, and the kernel matrix of the sample data into a preset strand selection quantum circuit, and determine a strand selection policy according to a processing result of the strand selection quantum circuit on the data to be processed and the sample data.
It is understood that the determining module 410 may also perform the step S21.
Optionally, the determining module 410 is further configured to input the data to be processed to the to-be-processed data analyzing module, and input the sample data and the kernel matrix to the sample data processing module.
Optionally, the obtaining module 400 is further configured to combine the multiple sample data pairwise to obtain multiple combined sample data; inputting one combined sample data to a preset similarity obtaining circuit each time, and obtaining the similarity between two sample data in each combined sample data through the similarity obtaining circuit; and generating a kernel matrix according to the plurality of similarities.
It is understood that the obtaining module 400 can also execute the steps S10 to S12.
Optionally, the determining module 410 is further configured to run the selected quantum wire and measure the auxiliary control bit of the selected quantum wire; if the auxiliary control bit meets the preset condition, measuring the control bit of the strand selection quantum line; if the probability that the control bit is in the target state is greater than or equal to the preset probability, determining stock selection; and if the probability of the control bit as the target state is smaller than the preset probability, determining that no stock is selected.
It is understood that the determining module 410 may also perform the steps S21-1 to S21-4.
The QSVM-based multi-factor stock selection device obtains data to be processed, sample data and a kernel matrix of the sample data through an obtaining module; the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks; and inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit through a determining module, and determining a strand selection strategy according to a processing result of the strand selection quantum circuit on the data to be processed and the sample data. The data to be processed, the sample data and the core matrix of the sample data are processed through the preset stock selection quantum circuit, and the corresponding stock selection strategy is determined according to the processing result of the data to be processed and the sample data, so that the data to be processed can be reasonably analyzed, the error of the processing result is reduced, and the stock worth buying can be accurately selected by a user.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A QSVM-based multi-factor stock selection method, the method comprising:
acquiring data to be processed, sample data and a kernel matrix of the sample data; the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks;
and inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit, and determining a strand selection strategy according to a processing result of the strand selection quantum circuit on the data to be processed and the sample data.
2. The method of claim 1, wherein the candidate quantum wires comprise a to-be-processed data analysis module and a sample data processing module; the inputting the data to be processed, the sample data and the kernel matrix of the sample data into a preset strand selection quantum circuit comprises:
inputting the data to be processed to the data analysis module to be processed, and inputting the sample data and the kernel matrix to the sample data processing module;
the sample data processing module is used for carrying out amplitude coding on the sample data and extracting characteristic values of the sample data subjected to amplitude coding and the kernel matrix, and the to-be-processed data analysis module is used for analyzing the to-be-processed data.
3. The method according to claim 2, wherein the sample data processing module comprises a first amplitude encoding circuit and a characteristic value extracting circuit, wherein the first amplitude encoding circuit is configured to amplitude encode the sample data, and encode the amplitude encoded sample data to the characteristic value extracting circuit; the eigenvalue extraction circuit is used for extracting eigenvalues of the sample data after amplitude coding and the kernel matrix.
4. The method according to claim 2 or 3, wherein the to-be-processed data analysis module comprises a second amplitude coding circuit and a data analysis circuit, the second amplitude coding circuit is used for amplitude coding the to-be-processed data and coding the amplitude-coded to-be-processed data to the data analysis circuit, and the data analysis circuit is used for analyzing the amplitude-coded to-be-processed data.
5. The method of claim 1, wherein the sample data is a plurality of samples, the method further comprising:
combining the plurality of sample data pairwise to obtain a plurality of combined sample data;
inputting one combined sample data to a preset similarity obtaining circuit each time, and obtaining the similarity between two sample data in each combined sample data through the similarity obtaining circuit;
and generating the kernel matrix according to a plurality of the similarities.
6. The method according to claim 1, wherein the data to be processed is obtained by adding a first assistant feature to initial data to be processed and performing normalization processing on the initial data to be processed to which the assistant feature is added; the sample data is obtained by adding a second assistant feature to the initial sample data and carrying out normalization processing on the initial sample data added with the assistant feature;
wherein the first and second assist features are for equaling a sum of squares of the data to be processed and a sum of squares of the sample data.
7. The method according to claim 1, wherein the processing result includes a probability that the control bit is in a target state, and the determining the stock selection policy according to the processing result of the stock selection quantum wire on the data to be processed and the sample data includes:
running the selected quantum wire and measuring an auxiliary control bit of the selected quantum wire;
if the auxiliary control bit meets a preset condition, measuring the control bit of the strand selection quantum line;
if the probability that the control bit is in the target state is greater than or equal to the preset probability, determining stock selection;
and if the probability that the control bit is in the target state is smaller than the preset probability, determining that no stock is selected.
8. A QSVM-based multi-factor stock selection apparatus, the apparatus comprising:
the acquisition module is used for acquiring data to be processed, sample data and a kernel matrix of the sample data; the data to be processed comprises influence factor data of the stocks to be analyzed, and the sample data comprises the influence factor data and the fluctuation labels of the sample stocks;
and the determining module is used for inputting the data to be processed, the sample data and the core matrix of the sample data into a preset strand selection quantum circuit, and determining a strand selection strategy according to the processing result of the strand selection quantum circuit on the data to be processed and the sample data.
9. An electronic device comprising a processor and a memory, the memory storing a computer program executable by the processor, the processor being configured to execute the computer program to implement the method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202211313790.XA 2022-10-25 2022-10-25 QSVM-based multi-factor stock selection method and related device Pending CN115482111A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211313790.XA CN115482111A (en) 2022-10-25 2022-10-25 QSVM-based multi-factor stock selection method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211313790.XA CN115482111A (en) 2022-10-25 2022-10-25 QSVM-based multi-factor stock selection method and related device

Publications (1)

Publication Number Publication Date
CN115482111A true CN115482111A (en) 2022-12-16

Family

ID=84395149

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211313790.XA Pending CN115482111A (en) 2022-10-25 2022-10-25 QSVM-based multi-factor stock selection method and related device

Country Status (1)

Country Link
CN (1) CN115482111A (en)

Similar Documents

Publication Publication Date Title
CN112561069B (en) Model processing method, device, equipment and storage medium
Sarkar et al. Finite time LTI system identification
CN113011593B (en) Method and system for eliminating quantum measurement noise, electronic device and medium
WO2021189844A1 (en) Detection method and apparatus for multivariate kpi time series, and device and storage medium
CN110674303B (en) Event statement processing method and device, computer equipment and readable storage medium
Sottinen et al. Generalized Gaussian bridges
US20240005184A1 (en) Boosting quantum artificial intelligence models
CN114580643B (en) Determination method, model processing method, device, equipment and storage medium
CN112529024A (en) Sample data generation method and device and computer readable storage medium
CN112651467A (en) Training method and system and prediction method and system of convolutional neural network
CN114358216A (en) Quantum clustering method based on machine learning framework and related device
CN113762294B (en) Feature vector dimension compression method, device, equipment and medium
CN113408731A (en) K-near quantum circuit realizing method
CN115482111A (en) QSVM-based multi-factor stock selection method and related device
CN117035416A (en) Enterprise risk assessment method, enterprise risk assessment device, equipment and storage medium
Chen et al. High-dimensional elliptical sliced inverse regression in non-Gaussian distributions
Kyrillidis et al. Scalable sparse covariance estimation via self-concordance
Kim et al. Goodness-of-fit tests for binomial AR (1) processes
CN116136968B (en) Quantum circuit optimization method of Grover algorithm and related device
CN116258167A (en) Data detection method, device, electronic equipment and medium
CN115238645A (en) Asset data identification method and device, electronic equipment and computer storage medium
CN114862079A (en) Risk value estimation method, device, medium, and electronic device based on quantum line
Zhao et al. Genetic simulated annealing-based kernel vector quantization algorithm
Johnson et al. On path restoration for censored outcomes
CN113760407A (en) Information processing method, device, equipment and storage medium

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