CN111311000B - User consumption behavior prediction model training method, device, equipment and storage medium - Google Patents

User consumption behavior prediction model training method, device, equipment and storage medium Download PDF

Info

Publication number
CN111311000B
CN111311000B CN202010093642.6A CN202010093642A CN111311000B CN 111311000 B CN111311000 B CN 111311000B CN 202010093642 A CN202010093642 A CN 202010093642A CN 111311000 B CN111311000 B CN 111311000B
Authority
CN
China
Prior art keywords
weight vector
quantum
training
training data
inner product
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
CN202010093642.6A
Other languages
Chinese (zh)
Other versions
CN111311000A (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 CN202010093642.6A priority Critical patent/CN111311000B/en
Publication of CN111311000A publication Critical patent/CN111311000A/en
Application granted granted Critical
Publication of CN111311000B publication Critical patent/CN111311000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • 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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Business, Economics & Management (AREA)
  • Artificial Intelligence (AREA)
  • Strategic Management (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Human Resources & Organizations (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Economics (AREA)
  • Tourism & Hospitality (AREA)
  • Operations Research (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Business, Economics & Management (AREA)
  • Game Theory and Decision Science (AREA)
  • Medical Informatics (AREA)
  • Quality & Reliability (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Computational Mathematics (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a user consumption behavior prediction model training method, device, equipment and storage medium, and relates to the technical field of machine learning model training. Training data and testing data are obtained from a database and are mapped into quantum states; for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model; and testing the quantum state of the weight vector obtained by each training data by adopting a quantum computing processor according to the test data to obtain a prediction model of the consumption behavior of the trained user. By applying quantum computation to the training process of the generalized linear model, the model training efficiency is improved, and the model accuracy is ensured, so that the generalized linear model can effectively predict the user consumption behavior.

Description

User consumption behavior prediction model training method, device, equipment and storage medium
Technical Field
The application relates to the technical field of computers, in particular to the technical field of machine learning model training.
Background
The Generalized Linear Model (GLM) is a flexible-application linear regression model, which is a very basic and widely-applied method in machine learning. The generalized linear model relates mathematical expected values of random variables measured by an experimenter to linear combinations of predicted variables by a link function. The model assumes that the output y and each input vector x are linearly related after the action-linking function, i.e., y ═ g (w · x), where g is the inverse linking function (i.e., the inverse of the linking function), and w · x is the inner product of the weight vector w and the input vector x. The core of the technical problem of the generalized linear model learning is to design an efficient scheme to learn the weight vector w through data in a training set under the condition that the inverse connection function g is known, so that the error is as small as possible.
The generalized linear model has wide application in data analysis and financial modeling, for example, the generalized linear model can be applied to a scene of predicting user consumption behaviors, and after user attribute features and/or target item attribute features are obtained, the user attribute features and/or the target item attribute features can be input into the trained generalized linear model, so that a prediction result of the user consumption behaviors is obtained. For the training of the generalized linear model, a sparse subgraph method (sparse subgraph) or a GLMtron method is generally adopted, wherein the sparse subgraph method is a machine learning algorithm based on a multiplication weighting algorithm (multiplicative weights algorithm), and the GLMtron method is an efficient learning method using an additive update rule (additive update rules).
The existing sparse sub-method is low in running speed, the training efficiency of the generalized linear model is seriously influenced, and particularly when the generalized linear model is adopted to predict the consumption behaviors of users, the input data dimension is high, the training speed is low, and the time consumption of the training process is long; the GLMtron method is not optimal in sampling complexity (sample complexity), and requires more samples than the sparse sub-method, i.e. a larger training set, to achieve the same accuracy.
Disclosure of Invention
The application provides a user consumption behavior prediction model training method, device, equipment and storage medium, so that training efficiency of a generalized linear model is improved, and model accuracy is guaranteed, and the generalized linear model can be applied to a scene of predicting user consumption behaviors to effectively predict the user consumption behaviors.
In a first aspect, the present application provides a method for training a predictive model of user consumption behavior, where the predictive model is a generalized linear model, and the method includes:
acquiring training data and testing data from a database to form a training set and a testing set, and mapping the training data and the testing data into quantum states through a quantum random access memory, wherein any one of the training data and the testing data comprises a multi-dimensional input feature vector and corresponding marking information of user consumption behaviors, and the multi-dimensional input feature comprises a user attribute feature and/or a target article attribute feature;
for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model;
and for the quantum state of the weight vector obtained by each training data, testing by adopting a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values.
In one possible design, for any training data, training the prediction model using a quantum computation processor to obtain quantum states of weight vectors of the prediction model includes:
acquiring an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function and a learning rate parameter of the prediction model;
and for any training data, updating the loss function value and the quantum state of the weight vector by adopting a quantum computation processor according to the weight vector, the loss function value, the inverse connection function, the learning rate parameter and the loss quantum gate.
In one possible design, the updating, with a quantum computation processor, the loss function value and the quantum state of the weight vector according to the weight vector, the loss function value, the inverse join function, the learning rate parameter, and the loss quantum gate includes:
according to the weight vector, the loss function value and the learning rate parameter, a quantum computation processor is adopted to obtain a first inner product between the weight vector and a multi-dimensional input feature vector of training data;
and updating a loss function value according to the first inner product, the inverse connection function, the learning rate parameter and the marking information of the training data, inputting the loss function value into the loss quantum gate, and updating the quantum state of the weight vector.
In one possible design, the obtaining, with a quantum computation processor, a first inner product between a weight vector and a multidimensional input feature vector of training data according to the weight vector, the loss function value, and the learning rate parameter includes:
obtaining a maximum weight vector according to historical loss function values;
calculating an intermediate variable related to a first inner product by adopting a quantum calculation processor according to the training data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring the first inner product according to the intermediate variable related to the first inner product.
In a possible design, the performing, by using a quantum computation processor, a test on the quantum state of the weight vector obtained for each piece of training data according to the test data to obtain a risk value corresponding to the quantum state of the weight vector obtained for each piece of training data includes:
calculating a second inner product between the weight vector and a multi-dimensional input feature vector in the test data by adopting a quantum calculation processor according to the quantum state of the weight vector obtained by each training data, the current weight vector, the maximum weight vector and the learning rate parameter in the test set;
and obtaining a risk value corresponding to the quantum state of the weight vector according to the second inner product, the inverse connection function and the labeling information of the test data.
In one possible design, the computing, with a quantum computation processor, a second inner product between a weight vector and a multidimensional input feature vector in test data according to each test data in the test set, a current weight vector, the maximum weight vector, and the learning rate parameter, includes:
calculating an intermediate variable related to a second inner product by adopting a quantum calculation processor according to the test data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring an inner product between the weight vector and the multi-dimensional input feature vector in the training data according to the intermediate variable related to the second inner product.
In a possible design, the obtaining a prediction model of the trained user consumption behavior according to the quantum state of the weight vector corresponding to the minimum value of all risk values includes:
and mapping the quantum state of the weight vector corresponding to the minimum value in all the risk values into the weight vector, and obtaining a prediction model of the consumption behavior of the trained user according to the weight vector.
In a second aspect, the present application provides an apparatus for training a predictive model of user consumption behavior, where the predictive model is a generalized linear model, and the apparatus includes:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring training data and test data from a database to form a training set and a test set, and mapping the training data and the test data into quantum states through a quantum random access memory, any one of the training data and the test data comprises a multi-dimensional input feature vector and corresponding marking information of user consumption behaviors, and the multi-dimensional input feature comprises a user attribute feature and/or a target article attribute feature;
the training module is used for training the prediction model by adopting a quantum computation processor for any training data to obtain the quantum state of the weight vector of the prediction model;
and the test module is used for testing the quantum state of the weight vector obtained by each training data by adopting a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values.
In one possible design, the training module, when training the prediction model with a quantum computation processor for any training data to obtain the quantum state of the weight vector of the prediction model, is configured to:
acquiring an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function and a learning rate parameter of the prediction model;
and for any training data, updating the loss function value and the quantum state of the weight vector by adopting a quantum computation processor according to the weight vector, the loss function value, the inverse connection function, the learning rate parameter and the loss quantum gate.
In one possible design, the training module, when updating the loss function value and the quantum state of the weight vector with the quantum computation processor according to the weight vector, the loss function value, the inverse join function, the learning rate parameter, and the loss quantum gate, is to:
according to the weight vector, the loss function value and the learning rate parameter, a quantum computation processor is adopted to obtain a first inner product between the weight vector and a multi-dimensional input feature vector of training data;
and updating a loss function value according to the first inner product, the inverse connection function, the learning rate parameter and the marking information of the training data, inputting the loss function value into the loss quantum gate, and updating the quantum state of the weight vector.
In one possible design, the training module, when obtaining, with a quantum computation processor, a first inner product between a weight vector and a multidimensional input feature vector of training data based on the weight vector, the loss function value, and the learning rate parameter, is to:
obtaining a maximum weight vector according to historical loss function values;
calculating an intermediate variable related to a first inner product by adopting a quantum calculation processor according to the training data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring the first inner product according to the intermediate variable related to the first inner product.
In a possible design, the test module is configured to, when performing a test on a quantum state of a weight vector obtained for each piece of training data by using a quantum computing processor according to the test data to obtain a risk value corresponding to the quantum state of the weight vector obtained for each piece of training data,:
calculating a second inner product between the weight vector and a multi-dimensional input feature vector in the test data by adopting a quantum calculation processor according to the quantum state of the weight vector obtained by each training data, the current weight vector, the maximum weight vector and the learning rate parameter in the test set;
and obtaining a risk value corresponding to the quantum state of the weight vector according to the second inner product, the inverse connection function and the labeling information of the test data.
In one possible design, the test module, when computing a second inner product between the weight vector and the multi-dimensional input feature vector in the test data using the quantum computation processor according to each test data in the test set, the current weight vector, the maximum weight vector, and the learning rate parameter, is configured to:
calculating an intermediate variable related to a second inner product by adopting a quantum calculation processor according to the test data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring an inner product between the weight vector and the multi-dimensional input feature vector in the training data according to the intermediate variable related to the second inner product.
In one possible design, when the testing module obtains the trained predictive model of the user consumption behavior according to the quantum state of the weight vector corresponding to the minimum value among all the risk values, the testing module is configured to:
and mapping the quantum state of the weight vector corresponding to the minimum value in all the risk values into the weight vector, and obtaining a prediction model of the consumption behavior of the trained user according to the weight vector.
A third aspect of the present application provides 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 the first aspect.
A fourth aspect of the present application provides a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of the first aspect.
A fifth aspect of the application provides a computer program comprising program code for performing the method according to the first aspect when the computer program is run by a computer.
One embodiment in the above application has the following advantages or benefits: training data and testing data are obtained from a database to form a training set and a testing set, and the training data and the testing data are mapped into quantum states through a quantum random access memory; for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model; and for the quantum state of the weight vector obtained by each training data, testing by using a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values.
In the embodiment, quantum computation is applied to the training process of the generalized linear model, the model training efficiency can be effectively improved through quantum acceleration, the quantum acceleration effect is better when the input vector dimension is larger, the model accuracy can be ensured, and the learning error is within an allowable range, so that the generalized linear model can be applied to effectively predicting the user consumption behavior in a scene of predicting the user consumption behavior.
Other effects of the above-described alternative will be described below with reference to specific embodiments.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a schematic diagram of a communication system of a method for training a predictive model of user consumption behavior according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for training a predictive model of user consumption behavior according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for training a predictive model of user consumption behavior according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for training a predictive model of user consumption behavior according to an embodiment of the present application;
FIG. 5 is a flowchart of a method for training a predictive model of user consumption behavior according to an embodiment of the present application;
FIG. 6 is a block diagram of a training apparatus for predictive models of user consumption behavior according to an embodiment of the present application;
FIG. 7 is a block diagram of an electronic device for implementing a method for training a predictive model of user consumption behavior according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. 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 application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Training of the generalized linear model generally adopts a sparse subgraph method (sparse subgraph) or a GLMtron method, wherein the sparse subgraph method is a machine learning algorithm based on a multiplication weighting algorithm (multiplicative weights algorithm), and the GLMtron method is an efficient learning method using an additive update rule (additive update rules).
The sparse sub-method is a machine learning scheme based on a multiplicative weighting algorithm. Specifically, consider a training set of size T and a test set of size M, all sampled from the following true distributions: the training set and the test set consist of feature vectors with N-dimensional elements between-1 and labels between 0 and 1. And sets parameters on the learning rate. The sparse sub-method mainly comprises two cycles, wherein the first cycle traverses all training data in a training set, and then generates a prediction vector for each training data. Then according to the prediction vector, calculating a prediction label by calculating an inner product and a connection function, and performing minimum optimization on the deviation degree of the prediction label and a real label in the cycle; the second loop will empirically calculate the error of the test set for validating the quality of each prediction vector. And finally, outputting the prediction vector which runs best on the test set, and obtaining an optimal generalized linear model according to the prediction vector.
The GLMtron method is an efficient learning method that utilizes additive update rules. However, this method has a disadvantage that because the sampling complexity (sample complexity) is not optimal, there is a space for increasing the number of samples required to achieve a certain accuracy in the training process, and the number of samples required is more than that of the sparse sub-method, i.e., a larger training set is required.
For sparse sub-methods, since the running time depends on the dimension of the parameter data, and the accuracy also has a space for improvement, for example, the running speed of a high-dimensional data set is reduced, and a long time is consumed. The steps at the core of this method involve inner product calculation and product update (iterative update), both of which are linear in runtime. However, for these two steps, it is possible to potentially boost them, resulting in a more efficient solution. Therefore, a new generalized linear model is used in this applicationThe learning scheme, called Quantum sparse method, performs the input of training set and test set by Quantum Random Access Memory (QRAM), and inputs the classical vector
Figure BDA0002384541230000081
Mapping to a quantum state | v>Further, the quantum computing processor is used to train the generalized linear model, and in the present embodiment, an amplitude amplification and estimation method (amplitude amplification and estimation algorithms) is used to efficiently find the optimal value in the weight vector designed in the sparse sub-method. The model training efficiency can be effectively improved through quantum acceleration, the larger the input vector dimension is, the better the quantum acceleration effect is, the model accuracy can be ensured, and the learning error is within an allowable range, so that the generalized linear model can be applied to effectively predicting the user consumption behaviors in a scene of predicting the user consumption behaviors.
The training method of the prediction model of the user consumption behavior provided by the embodiment of the application is applied to a communication system shown in fig. 1, where the communication system includes a server 10 and a database 11, where the database 11 may be used to store training data and test data, where the training data and the test data may include multidimensional input features and corresponding labeled information of the user consumption behavior, and the multidimensional input features include user attribute features and/or target item attribute features. And the server 10 can obtain the training data and the test data from the database 11 and perform the training process of the predictive model of the user consumption behavior.
The following describes in detail a training process of the predictive model of user consumption behavior according to the present application with reference to specific embodiments.
An embodiment of the present application provides a training method for a prediction model of a user consumption behavior, and fig. 2 is a flowchart of a training method for a prediction model of a user consumption behavior provided in an embodiment of the present invention. The execution subject may be a server, the prediction model is a generalized linear model, and as shown in fig. 2, the training method of the prediction model of the user consumption behavior includes the following specific steps:
s101, acquiring training data and testing data from a database to form a training set and a testing set, and mapping the training data and the testing data into quantum states through a quantum random access memory;
any one of the training data and the test data comprises a multi-dimensional input feature vector and corresponding labeling information of user consumption behaviors, and the multi-dimensional input feature comprises a user attribute feature and/or a target item attribute feature.
In this embodiment, the database stores, in advance, historical consumption behavior data of the user, which may specifically include attributes such as gender, age, and region of the user, behavior attributes such as time and number of times the user browses the target item, attribute characteristics of the target item such as a value and sales of the target item, and a consumption behavior (as mark information of the consumption behavior of the user) of whether the user finally purchases the target item. In this embodiment, historical consumption behavior data of a user may be acquired from a database, multidimensional input features are extracted to form a multidimensional input feature vector, and corresponding consumption behavior marking information of the user is extracted at the same time, where the multidimensional input features include user attribute features and/or target item attribute features, and a part of the acquired data is used as training data to form a training set, and another part is used as test data to form a test set.
Further, QRAMs (Quantum Random Access memories) are used for recording the training set and the test set, wherein the Quantum Random Access Memory is used for recording a classical vector
Figure BDA0002384541230000091
Mapping to a quantum state | v >. Here, quantum state refers to the state of a quantum system, and a state vector can be used to represent quantum states abstractly, and we represent the state vector by dirac notation. In this embodiment, a quantum random access memory allows quantum state | j to be transferred by quantum operation>|0...0>Is mapped into
Figure BDA0002384541230000092
For theEach training vector x(t)And any j, such a mapping may be at each phase j>Upper entry training vector x(t)The jth element of (1).
More specifically, in the present embodiment, each training data in the training set a can be represented as (x)(t),y(t))∈[-1,1]NX {0,1}, T is from 1 to T, T is the number of training data in training set A, x(t)Multidimensional input feature vector, y, representing the t-th training data(t)Marking information of user consumption behaviors representing the t-th training data, wherein N is the dimension of the multi-dimensional input feature;
each test data in test set B is represented as (a)(m),b(m))∈[-1,1]NX {0,1}, M from 1 to M, M is the number of test data in test set B, a(m)Multidimensional input feature vector representing the mth test data, b(m)And marking information representing the consumption behavior of the user of the mth test data.
And S102, for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model.
In this embodiment, in the training process of applying quantum computation to the generalized linear model, the quantum state of the weight vector is obtained by means of the quantum computation processor, and the model training efficiency can be effectively improved by quantum acceleration.
Specifically, as shown in fig. 3, the training of the prediction model by using a quantum computation processor for any training data to obtain the quantum state of the weight vector of the prediction model includes:
s201, acquiring an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function and a learning rate parameter of the prediction model.
In this embodiment, the prediction model of the user consumption behavior adopts a generalized linear model, and before training the prediction model, an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function, and a learning rate parameter are obtained first.
Specifically, the initialized weight vector is
Figure BDA0002384541230000101
Wherein
Figure BDA0002384541230000102
Is an N-dimensional unit vector;
initializing a loss function value, and initializing the loss function value of the jth element for j 1
Figure BDA0002384541230000103
The loss quantum gate is
Figure BDA0002384541230000104
It has the following properties:
Figure BDA0002384541230000105
initialization loss quantum gate
Figure BDA0002384541230000106
The preset inverse connection function is g, and the learning rate parameters comprise beta and lambda.
And S202, for any training data, updating the loss function value and the quantum state of the weight vector by adopting a quantum computation processor according to the weight vector, the loss function value, the inverse connection function, the learning rate parameter and the loss quantum gate.
In this embodiment, the training process is a continuous iteration process, each iteration training is performed by using one training data in the training set, and the loss function value and the quantum state of the weight vector are finally updated, for example, iteration may be performed in the order of t from 1 to N.
Further, as shown in fig. 4, the updating, in S202, the loss function value and the quantum state of the weight vector by using a quantum computation processor according to the weight vector, the loss function value, the inverse connection function, the learning rate parameter, and the loss quantum gate specifically includes:
s2021, according to the weight vector, the loss function value and the learning rate parameter, a quantum computation processor is adopted to obtain a first inner product between the weight vector and a multi-dimensional input feature vector of training data.
In this embodiment, a first inner product between the weight vector and the multidimensional input feature vector of the training data may be obtained by the quantum computing processor, so that the inner product obtaining process is accelerated.
More specifically, in the t-th iterative training, the t-th training data is selected from the training set.
Firstly, acquiring a maximum weight vector according to historical loss function values;
specifically, the historical loss function value (the loss function value of the training element j from the 0 th to the t-1 st iteration) is used for solving
Figure BDA0002384541230000111
Its solution is L, and let each element in the weight vector
Figure BDA0002384541230000112
Thereby obtaining the maximum weight vector
Figure BDA0002384541230000113
Then, according to the training data, the current weight vector, the maximum weight vector and the learning rate parameter, calculating an intermediate variable related to a first inner product by adopting a quantum calculation processor;
specifically, the quantum computing processor is used to compute the intermediate variables associated with the first inner product as follows:
estimating norm with quantum computing processor
Figure BDA0002384541230000114
Estimating a first intermediate variable with a quantum computing processor
Figure BDA0002384541230000115
Computing a second intermediate variable using a quantum computing processor
Figure BDA0002384541230000116
Finally, the first inner product h is obtained according to the intermediate variable related to the first inner product(t)
Figure BDA0002384541230000117
S2022, updating a loss function value according to the first inner product, the inverse connection function, the learning rate parameter and the labeling information of the training data, inputting the loss function value into the loss quantum gate, and updating the quantum state of the weight vector.
Specifically, according to the first inner product h obtained in the above step(t)And the inverse connection function g, the learning rate parameter lambda and the labeling information y of the training data(t)Updating the current penalty function
Figure BDA0002384541230000118
Further, the updated loss function value is input into a loss quantum gate
Figure BDA0002384541230000119
Updating quantum states of weight vectors
Figure BDA00023845412300001110
S103, for the quantum state of the weight vector obtained by each training data, testing by adopting a quantum computing processor according to the test data to obtain a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values.
In this embodiment, for the quantum state of the weight vector obtained by each iterative training, the test data in the test set is used for testing to obtain a corresponding risk value of the prediction model, and a minimum value is found from all the risk values, and the quantum state of the weight vector corresponding to the minimum value is the optimal quantum state of the weight vector, so that the prediction model of the consumption behavior of the trained user can be obtained according to the quantum state of the weight vector.
More specifically, in this embodiment, a quantum state of the weight vector corresponding to the minimum value of all risk values may be mapped to a weight vector, and a prediction model of the consumption behavior of the trained user may be obtained according to the weight vector. That is, the optimal quantum state of the weight vector is remapped to the classical vector form, so that the trained user consumption behavior prediction model is obtained as y ═ g (w · x), and the trained user consumption behavior prediction model can be used for predicting the user consumption behavior. Specifically, the predicting of the user consumption behavior may be that, firstly, multi-dimensional input features of a target user are obtained, the multi-dimensional input features include user attribute features and/or target article attribute features, and the multi-dimensional input features are input into a trained prediction model of the user consumption behavior, so that a prediction result of the user consumption behavior is obtained, and the accuracy of the prediction result is high.
It should be noted that, in this embodiment, when obtaining the predicted model risk value, the calculation of the risk value may be performed once for the quantum state of the weight vector obtained by each iterative training after each iterative training is finished, or the calculation of the model risk value may be performed uniformly for the quantum state of the weight vector obtained by each iterative training after all iterative training is finished.
Further, as shown in fig. 5, the step of testing the quantum state of the weight vector obtained from each piece of training data by using a quantum computing processor according to the test data to obtain a risk value corresponding to the quantum state of the weight vector obtained from each piece of training data specifically includes:
s301, calculating a second inner product between the weight vector and a multi-dimensional input feature vector in the test data by adopting a quantum calculation processor according to the quantum state of the weight vector obtained by each training data, the current weight vector, the maximum weight vector and the learning rate parameter in the test set.
In this embodiment, for the quantum state of the weight vector obtained by the t-th iterative training, test data is sequentially taken from the test set, for example, M is from 1 to M, and the following operations are performed one by one:
firstly, according to the test data, the current weight vector, the maximum weight vector and the learning rate parameter, calculating an intermediate variable related to a second inner product by adopting a quantum calculation processor;
in particular, the third intermediate variable is estimated by means of a quantum processor
Figure BDA0002384541230000121
Calculating a fourth intermediate variable with a quantum processor
Figure BDA0002384541230000122
Then, acquiring an inner product z between the weight vector and the multi-dimensional input feature vector in the training data according to the intermediate variable related to the second inner product(t,m)
In particular, calculating
Figure BDA0002384541230000131
S302, obtaining a risk value corresponding to the quantum state of the weight vector according to the second inner product, the inverse connection function and the labeling information of the test data.
Specifically, according to the second inner product z obtained in the above step(t,m)And the inverse connection function g, the learning rate parameter lambda and the marking information b of the test data(m)Calculating the risk value
Figure BDA0002384541230000132
Figure BDA0002384541230000133
Obtaining the quantum state corresponding risk value eta of the weight vector obtained by each iterative training(t)Then, find out all eta(t)Is the minimum value of (1), and the corresponding t is denoted as tminAnd recording the related parameters
Figure BDA0002384541230000134
Preparation of eta using the above parameters(t)Quantum state of the weight vector corresponding to the minimum value in (1)
Figure BDA0002384541230000135
Wherein
Figure BDA0002384541230000136
qmax=maxj qj
Furthermore, the quantum state of the weight vector corresponding to the minimum risk value is mapped into the weight vector, and a prediction model of the consumption behavior of the trained user can be obtained according to the weight vector.
In the training method of the prediction model of the user consumption behavior provided in the above embodiment, the training data and the test data are obtained from the database to form a training set and a test set, and the training data and the test data are mapped into quantum states by the quantum random access memory; for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model; and for the quantum state of the weight vector obtained by each training data, testing by using a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values. In the embodiment, quantum computation is applied to the training process of the generalized linear model, the model training efficiency can be effectively improved through quantum acceleration, the quantum acceleration effect is better when the input vector dimension is larger, the model accuracy can be ensured, and the learning error is within an allowable range, so that the generalized linear model can be applied to effectively predicting the user consumption behavior in a scene of predicting the user consumption behavior.
It should be noted that the training method for the generalized linear model in this embodiment may not be limited to be applied to a scene of user consumption behavior prediction, but may also be applied to aspects of big data fitting inspection, inference, diagnosis, and the like, and may also complete learning of an undirected graph, where the undirected graph model has important application scenes in directions of computer vision and natural language processing, such as image compression in computer vision and part-of-speech tagging in natural language processing.
An embodiment of the present application provides a training apparatus for a prediction model of user consumption behaviors, and fig. 6 is a structural diagram of a training apparatus for a prediction model of user consumption behaviors provided in an embodiment of the present invention. Wherein the predictive model is a generalized linear model. As shown in fig. 6, the training apparatus 400 for the prediction model of the user consumption behavior specifically includes: an acquisition module 401, a training module 402 and a test module 403.
An obtaining module 401, configured to obtain training data and test data from a database to form a training set and a test set, and map the training data and the test data into quantum states through a quantum random access memory, where any one of the training data and the test data includes a multidimensional input feature vector and corresponding labeling information of a user consumption behavior, and the multidimensional input feature includes a user attribute feature and/or a target item attribute feature;
a training module 402, configured to train the prediction model with a quantum computation processor for any training data, to obtain a quantum state of a weight vector of the prediction model;
the testing module 403 is configured to, for the quantum state of the weight vector obtained by each piece of training data, perform testing by using a quantum computing processor according to the testing data, obtain a risk value corresponding to the quantum state of the weight vector obtained by each piece of training data, and obtain a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value among all the risk values.
In one possible design, the training module 402, when training the prediction model with a quantum computation processor for any training data to obtain the quantum state of the weight vector of the prediction model, is configured to:
acquiring an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function and a learning rate parameter of the prediction model;
and for any training data, updating the loss function value and the quantum state of the weight vector by adopting a quantum computation processor according to the weight vector, the loss function value, the inverse connection function, the learning rate parameter and the loss quantum gate.
In one possible design, the training module 402, when updating the loss function value and the quantum state of the weight vector with the quantum computation processor according to the weight vector, the loss function value, the inverse join function, the learning rate parameter, and the loss quantum gate, is configured to:
according to the weight vector, the loss function value and the learning rate parameter, a quantum computation processor is adopted to obtain a first inner product between the weight vector and a multi-dimensional input feature vector of training data;
and updating a loss function value according to the first inner product, the inverse connection function, the learning rate parameter and the marking information of the training data, inputting the loss function value into the loss quantum gate, and updating the quantum state of the weight vector.
In one possible design, the training module 402, when obtaining, with a quantum computation processor, a first inner product between a weight vector and a multidimensional input feature vector of training data according to the weight vector, the loss function value, and the learning rate parameter, is configured to:
obtaining a maximum weight vector according to historical loss function values;
calculating an intermediate variable related to a first inner product by adopting a quantum calculation processor according to the training data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring the first inner product according to the intermediate variable related to the first inner product.
In a possible design, the testing module 403, when performing a test on the quantum state of the weight vector obtained from each training data by using a quantum computing processor according to the test data, and obtaining a risk value corresponding to the quantum state of the weight vector obtained from each training data, is configured to:
calculating a second inner product between the weight vector and a multi-dimensional input feature vector in the test data by adopting a quantum calculation processor according to the quantum state of the weight vector obtained by each training data, the current weight vector, the maximum weight vector and the learning rate parameter in the test set;
and obtaining a risk value corresponding to the quantum state of the weight vector according to the second inner product, the inverse connection function and the labeling information of the test data.
In one possible design, the test module 403, when computing a second inner product between the weight vector and the multi-dimensional input feature vector in the test data using the quantum computation processor according to each test data in the test set, the current weight vector, the maximum weight vector, and the learning rate parameter, is configured to:
calculating an intermediate variable related to a second inner product by adopting a quantum calculation processor according to the test data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring an inner product between the weight vector and the multi-dimensional input feature vector in the training data according to the intermediate variable related to the second inner product.
In one possible design, the testing module 403, when obtaining the trained predictive model of the user consumption behavior according to the quantum state of the weight vector corresponding to the minimum value of all risk values, is configured to:
and mapping the quantum state of the weight vector corresponding to the minimum value in all the risk values into the weight vector, and obtaining a prediction model of the consumption behavior of the trained user according to the weight vector.
The training device for the prediction model of the user consumption behavior provided in this embodiment may be specifically used in an embodiment of a training method for executing the prediction model of the user consumption behavior provided in the foregoing figures, and specific functions are not described herein again.
In the training device of the prediction model of the user consumption behavior provided by this embodiment, a training set and a test set are formed by acquiring training data and test data from a database, and the training data and the test data are mapped into quantum states by a quantum random access memory; for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model; and for the quantum state of the weight vector obtained by each training data, testing by using a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values. In the embodiment, quantum computation is applied to the training process of the generalized linear model, the model training efficiency can be effectively improved through quantum acceleration, the quantum acceleration effect is better when the input vector dimension is larger, the model accuracy can be ensured, and the learning error is within an allowable range, so that the generalized linear model can be applied to effectively predicting the user consumption behavior in a scene of predicting the user consumption behavior.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 7 is a block diagram of an electronic device according to an embodiment of the present application, illustrating a method for training a predictive model of user consumption behavior. 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 assistants, cellular telephones, 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 present application that are described and/or claimed herein.
As shown in fig. 7, the electronic apparatus includes: one or more processors 501, memory 502, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 7 illustrates an example of a processor 501.
Memory 502 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the method of training a predictive model of user consumption behavior as provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the training method of the predictive model of user consumption behavior provided by the present application.
Memory 502, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the training method of the predictive model of user consumption behavior in the embodiments of the present application (e.g., acquisition module 401, training module 402, and testing module 403 shown in fig. 6). The processor 501 executes various functional applications of the server and data processing by running non-transitory software programs, instructions and modules stored in the memory 502, namely, implementing the training method of the predictive model of user consumption behavior in the above method embodiment.
The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created from use of the electronic device of the training method of the predictive model of the user consumption behavior, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 502 may optionally include memory located remotely from the processor 501, and these remote memories may be connected over a network to an electronic device of a training method of predictive models of user consumption behavior. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the training method of the predictive model of user consumption behavior may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected by a bus or other means, and fig. 7 illustrates the connection by a bus as an example.
The input device 503 may receive input numeric or character information and key signal inputs related to user settings and function control of the electronic device that generates the training method of the predictive model of user consumption behavior, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or other input devices. The output devices 504 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), 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.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
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), and the Internet.
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.
According to the technical scheme of the embodiment of the application, a training set and a testing set are formed by acquiring training data and testing data from a database, and the training data and the testing data are mapped into quantum states through a quantum random access memory; for any training data, training the prediction model by adopting a quantum computation processor to obtain the quantum state of the weight vector of the prediction model; and for the quantum state of the weight vector obtained by each training data, testing by using a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values. In the embodiment, quantum computation is applied to the training process of the generalized linear model, the model training efficiency can be effectively improved through quantum acceleration, the quantum acceleration effect is better when the input vector dimension is larger, the model accuracy can be ensured, and the learning error is within an allowable range, so that the generalized linear model can be applied to effectively predicting the user consumption behavior in a scene of predicting the user consumption behavior.
The present application further provides a computer program comprising a program code for performing the method for training a predictive model of user consumption behavior as described in the above embodiments, when the computer program is run by a computer.
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 application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (16)

1. A method for training a predictive model of user consumption behavior, wherein the predictive model is a generalized linear model, the method comprising:
acquiring training data and testing data from a database to form a training set and a testing set, and mapping the training data and the testing data into quantum states through a quantum random access memory, wherein any one of the training data and the testing data comprises a multi-dimensional input feature vector and corresponding marking information of user consumption behaviors, and the multi-dimensional input feature comprises a user attribute feature and/or a target article attribute feature;
for any training data, updating a loss function value and a quantum state of a weight vector by adopting a quantum computing processor according to a preset inverse connection function, a learning rate parameter and a loss quantum gate corresponding to the current training times so as to obtain the quantum state of the weight vector of the prediction model;
and for the quantum state of the weight vector obtained by each training data, testing by adopting a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values.
2. The method according to claim 1, wherein before updating the loss function value and the quantum state of the weight vector by using a quantum computation processor according to a preset inverse connection function and a learning rate parameter and a loss quantum gate corresponding to a current training time to obtain the quantum state of the weight vector of the prediction model, the method further comprises:
and acquiring an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function and a learning rate parameter of the prediction model.
3. The method of claim 2, wherein the updating the current value of the loss function and the quantum state of the weight vector by using a quantum computation processor according to a preset inverse connection function and a learning rate parameter and a loss quantum gate corresponding to the current training times comprises:
according to the current weight vector, the historical loss function value and the learning rate parameter, a quantum computing processor is adopted to obtain a first inner product between the weight vector and a multi-dimensional input feature vector of training data;
and updating a loss function value according to the first inner product, the inverse connection function, the learning rate parameter and the marking information of the training data, inputting the loss function value into a loss quantum gate corresponding to the current training times, and updating the quantum state of the weight vector.
4. The method of claim 3, wherein obtaining a first inner product between a weight vector and a multidimensional input feature vector of training data using a quantum computation processor based on a current weight vector, a historical loss function value, and the learning rate parameter comprises:
obtaining a maximum weight vector according to historical loss function values;
calculating an intermediate variable related to a first inner product by adopting a quantum calculation processor according to the training data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring the first inner product according to the intermediate variable related to the first inner product.
5. The method according to claim 4, wherein the obtaining the risk value corresponding to the quantum state of the weight vector obtained from each training data by performing a test with a quantum computation processor according to the test data comprises:
calculating a second inner product between the weight vector and a multi-dimensional input feature vector in the test data by adopting a quantum calculation processor according to the quantum state of the weight vector obtained by each training data, the current weight vector, the maximum weight vector and the learning rate parameter in the test set;
and obtaining a risk value corresponding to the quantum state of the weight vector according to the second inner product, the inverse connection function and the labeling information of the test data.
6. The method of claim 5, wherein computing, with a quantum computation processor, a second inner product between a weight vector and a multidimensional input feature vector in test data based on each test data in the test set, a current weight vector, the maximum weight vector, and the learning rate parameter comprises:
calculating an intermediate variable related to a second inner product by adopting a quantum calculation processor according to the test data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring an inner product between the weight vector and the multi-dimensional input feature vector in the training data according to the intermediate variable related to the second inner product.
7. The method according to any one of claims 1 to 6, wherein the obtaining of the trained predictive model of the consumption behavior of the user according to the quantum state of the weight vector corresponding to the minimum value of all risk values comprises:
and mapping the quantum state of the weight vector corresponding to the minimum value in all the risk values into the weight vector, and obtaining a prediction model of the consumption behavior of the trained user according to the weight vector.
8. An apparatus for training a predictive model of user consumption behavior, the predictive model being a generalized linear model, the apparatus comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring training data and test data from a database to form a training set and a test set, and mapping the training data and the test data into quantum states through a quantum random access memory, any one of the training data and the test data comprises a multi-dimensional input feature vector and corresponding marking information of user consumption behaviors, and the multi-dimensional input feature comprises a user attribute feature and/or a target article attribute feature;
the training module is used for updating the loss function value and the quantum state of the weight vector by adopting a quantum computing processor according to a preset inverse connection function, a learning rate parameter and a loss quantum gate corresponding to the current training times for any training data so as to obtain the quantum state of the weight vector of the prediction model;
and the test module is used for testing the quantum state of the weight vector obtained by each training data by adopting a quantum computing processor according to the test data, obtaining a risk value corresponding to the quantum state of the weight vector obtained by each training data, and obtaining a prediction model of the consumption behavior of the trained user according to the quantum state of the weight vector corresponding to the minimum value in all the risk values.
9. The apparatus of claim 8, wherein the training module, before updating the current loss function value and the quantum state of the weight vector by using a quantum computation processor according to a preset inverse connection function and a learning rate parameter and a loss quantum gate corresponding to the current training number to obtain the quantum state of the weight vector of the prediction model, is further configured to:
and acquiring an initialized weight vector, an initialized loss function value, an initialized loss quantum gate, a preset inverse connection function and a learning rate parameter of the prediction model.
10. The apparatus of claim 9, wherein the training module, when updating the loss function value and the quantum state of the weight vector by using the quantum computing processor according to the preset inverse connection function and the learning rate parameter and the loss quantum gate corresponding to the current training times, is configured to:
according to the current weight vector, the historical loss function value and the learning rate parameter, a quantum computing processor is adopted to obtain a first inner product between the weight vector and a multi-dimensional input feature vector of training data;
and updating a loss function value according to the first inner product, the inverse connection function, the learning rate parameter and the marking information of the training data, inputting the loss function value into a loss quantum gate corresponding to the current training times, and updating the quantum state of the weight vector.
11. The apparatus of claim 10, wherein the training module, when employing the quantum computation processor to obtain the first inner product between the weight vector and the multidimensional input feature vector of the training data based on the current weight vector, the historical loss function value, and the learning rate parameter, is configured to:
obtaining a maximum weight vector according to historical loss function values;
calculating an intermediate variable related to a first inner product by adopting a quantum calculation processor according to the training data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring the first inner product according to the intermediate variable related to the first inner product.
12. The apparatus of claim 11, wherein the testing module, when performing a test on the quantum state of the weight vector obtained for each training data according to the test data by using a quantum computing processor to obtain the risk value corresponding to the quantum state of the weight vector obtained for each training data, is configured to:
calculating a second inner product between the weight vector and a multi-dimensional input feature vector in the test data by adopting a quantum calculation processor according to the quantum state of the weight vector obtained by each training data, the current weight vector, the maximum weight vector and the learning rate parameter in the test set;
and obtaining a risk value corresponding to the quantum state of the weight vector according to the second inner product, the inverse connection function and the labeling information of the test data.
13. The apparatus of claim 12, wherein the test module, when computing a second inner product between a weight vector and a multidimensional input feature vector in test data using a quantum computation processor based on each test data in the test set, a current weight vector, the maximum weight vector, and the learning rate parameter, is configured to:
calculating an intermediate variable related to a second inner product by adopting a quantum calculation processor according to the test data, the current weight vector, the maximum weight vector and the learning rate parameter;
and acquiring an inner product between the weight vector and the multi-dimensional input feature vector in the training data according to the intermediate variable related to the second inner product.
14. The apparatus of any one of claims 8-13, wherein the testing module, when obtaining the trained predictive model of user consumption behavior based on the quantum state of the weight vector corresponding to the minimum of all risk values, is configured to:
and mapping the quantum state of the weight vector corresponding to the minimum value in all the risk values into the weight vector, and obtaining a prediction model of the consumption behavior of the trained user according to the weight vector.
15. 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 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
CN202010093642.6A 2020-02-14 2020-02-14 User consumption behavior prediction model training method, device, equipment and storage medium Active CN111311000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010093642.6A CN111311000B (en) 2020-02-14 2020-02-14 User consumption behavior prediction model training method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010093642.6A CN111311000B (en) 2020-02-14 2020-02-14 User consumption behavior prediction model training method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111311000A CN111311000A (en) 2020-06-19
CN111311000B true CN111311000B (en) 2021-09-28

Family

ID=71159305

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010093642.6A Active CN111311000B (en) 2020-02-14 2020-02-14 User consumption behavior prediction model training method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111311000B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113052317B (en) * 2021-03-09 2023-10-13 本源量子计算科技(合肥)股份有限公司 Quantum state information acquisition method and device, quantum measurement and control system and computer
CN113592095B (en) * 2021-08-04 2024-01-16 北京量子信息科学研究院 Model training method and device based on quantum computation

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107292528A (en) * 2017-06-30 2017-10-24 阿里巴巴集团控股有限公司 Vehicle insurance Risk Forecast Method, device and server
CN109242223A (en) * 2018-11-26 2019-01-18 武汉理工光科股份有限公司 The quantum support vector machines of city Public Buildings Fire Risk is assessed and prediction technique
CN109586909A (en) * 2019-01-21 2019-04-05 成都信息工程大学 Based on Bell state quantal data library access control and Bidirectional identity authentication method
CN110414555A (en) * 2019-06-20 2019-11-05 阿里巴巴集团控股有限公司 Detect the method and device of exceptional sample

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106548210B (en) * 2016-10-31 2021-02-05 腾讯科技(深圳)有限公司 Credit user classification method and device based on machine learning model training

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107292528A (en) * 2017-06-30 2017-10-24 阿里巴巴集团控股有限公司 Vehicle insurance Risk Forecast Method, device and server
CN109242223A (en) * 2018-11-26 2019-01-18 武汉理工光科股份有限公司 The quantum support vector machines of city Public Buildings Fire Risk is assessed and prediction technique
CN109586909A (en) * 2019-01-21 2019-04-05 成都信息工程大学 Based on Bell state quantal data library access control and Bidirectional identity authentication method
CN110414555A (en) * 2019-06-20 2019-11-05 阿里巴巴集团控股有限公司 Detect the method and device of exceptional sample

Also Published As

Publication number Publication date
CN111311000A (en) 2020-06-19

Similar Documents

Publication Publication Date Title
CN111311321B (en) User consumption behavior prediction model training method, device, equipment and storage medium
CN111428008B (en) Method, apparatus, device and storage medium for training a model
CN111639710B (en) Image recognition model training method, device, equipment and storage medium
CN111737995B (en) Method, device, equipment and medium for training language model based on multiple word vectors
KR102484617B1 (en) Method and apparatus for generating model for representing heterogeneous graph node, electronic device, storage medium and program
CN111737994B (en) Method, device, equipment and storage medium for obtaining word vector based on language model
CN111737996B (en) Method, device, equipment and storage medium for obtaining word vector based on language model
CN111079442B (en) Vectorization representation method and device of document and computer equipment
US20210224879A1 (en) Method, electronic device and storage medium for item recommendation
JP7113097B2 (en) Sense description processing method, device and equipment for text entities
CN111783981A (en) Model training method and device, electronic equipment and readable storage medium
JP7262539B2 (en) Conversation recommendation method, device and equipment
CN111582479B (en) Distillation method and device for neural network model
CN111709252B (en) Model improvement method and device based on pre-trained semantic model
CN111311000B (en) User consumption behavior prediction model training method, device, equipment and storage medium
CN111611808B (en) Method and apparatus for generating natural language model
CN114141317A (en) Compound property prediction model training method, device, equipment and storage medium
CN111241838B (en) Semantic relation processing method, device and equipment for text entity
CN114386503A (en) Method and apparatus for training a model
CN112288483A (en) Method and device for training model and method and device for generating information
CN111563198A (en) Material recall method, device, equipment and storage medium
US11830207B2 (en) Method, apparatus, electronic device and readable storage medium for point cloud data processing
CN114707070A (en) User behavior prediction method and related equipment thereof
CN112508599B (en) Information feedback method and device
US20240104403A1 (en) Method for training click rate prediction model

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