Model training and article recommendation method and device, electronic equipment, storage medium and computer program product
By building a quantum model through quantum neural network and matrix decomposition technology, the nonlinear interaction relationship between users and items is captured, which solves the problem of insufficient recommendation accuracy in existing recommendation schemes and achieves higher recommendation accuracy and personalization.
Patent Information
- Application Number
- CN202511256086.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-09-04
AI Technical Summary
Existing recommendation schemes cannot fully consider the complex nonlinear interactions between users and items in highly personalized scenarios, resulting in insufficient recommendation accuracy.
By obtaining sample data on users' preferences for implicit features and the degree of correlation between items and implicit features, and using quantum neural network and matrix decomposition technology, a quantum model is constructed to capture the nonlinear interaction between users and items and make item recommendations.
It improves the accuracy and personalization of item recommendations and can better learn the deep interactive patterns of user preferences and item associations.
Smart Images

Figure CN120744246A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum computing, and in particular to a model training and item recommendation method, device, electronic device, storage medium, and computer program product. Background Art
[0002] Recommendation technology is a type of information filtering technology that analyzes factors such as user history, interests, and social connections to better understand user needs and provide personalized item recommendations. In this context, recommendation technology not only helps users quickly find content of interest within massive amounts of data but also helps merchants and platforms understand user needs, thereby driving business growth.
[0003] However, related recommendation schemes have the problem of low recommendation accuracy. Summary of the Invention
[0004] To solve related technical problems, the embodiments of the present application provide a model training and item recommendation method, device, electronic device, storage medium and computer program product.
[0005] The technical solution of the embodiment of the present application is implemented as follows: The present invention provides a model training method, including: Obtaining first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; The first sample data and the second sample data are used to train a first quantum model, where the first quantum model can at least capture the nonlinear interaction relationship between users and items. The first quantum model is used to recommend items to users to be recommended.
[0006] This embodiment of the present application provides an item recommendation method, including: Acquire first data, wherein the first data includes a plurality of candidate items associated with a user to be recommended; One or more items are recommended to the user to be recommended using the first data and a first quantum model, where the first quantum model is obtained according to any of the above model training methods.
[0007] The present application also provides a model training device, including: a first acquisition unit, configured to acquire first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; A training unit is used to train a first quantum model using the first sample data and the second sample data, where the first quantum model can at least capture the nonlinear interaction relationship between the user and the item, and the first quantum model is used to recommend items to the user to be recommended.
[0008] The present application also provides an item recommendation device, including: a second acquiring unit, configured to acquire first data, wherein the first data includes a plurality of candidate items associated with the user to be recommended; A recommendation unit is configured to recommend one or more items to the user to be recommended using the first data and a first quantum model, wherein the first quantum model is obtained according to any of the above-mentioned model training methods.
[0009] An embodiment of the present application further provides an electronic device, comprising: a processor and a memory for storing a computer program that can be run on the processor, In which, when the processor is used to run the computer program, it implements the steps of any of the above-mentioned model training methods, or implements the steps of any of the above-mentioned item recommendation methods.
[0010] An embodiment of the present application also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-mentioned model training methods, or implements the steps of any of the above-mentioned item recommendation methods.
[0011] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned model training methods, or implements the steps of any of the above-mentioned item recommendation methods.
[0012] The model training and item recommendation methods, devices, electronic devices, storage media, and computer program products provided in the embodiments of the present application include: obtaining first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes classification features associated with user behavior; using the first sample data and the second sample data, training a first quantum model, wherein the first quantum model is capable of at least capturing the nonlinear interaction between users and items, and the first quantum model is used to recommend items to the user to be recommended. The technical solution provided in the embodiments of the present application, through the data mining capability of the quantum model, captures the complex interaction between users and items, so that the quantum model can better learn the deep interactive pattern of user preferences and item associations, thereby effectively improving the accuracy of item recommendation using the quantum model. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A flow chart of a model training method according to an embodiment of the present application; Figure 2 This is a structural diagram of a matrix decomposition embodiment of the present application; Figure 3 This is a schematic diagram of the structure of a quantum circuit according to an embodiment of the present application; Figure 4 This is a flow chart of an item recommendation method according to an embodiment of the present application; Figure 5 This is a flowchart of the first model training process for this application example; Figure 6 This is a flowchart of the second model training process for this application example; Figure 7 A flowchart illustrating a model reasoning method used in this application; Figure 8 This is a schematic diagram of the structure of the model training device according to an embodiment of the present application; Figure 9 This is a schematic diagram of the structure of the item recommendation device according to an embodiment of the present application; Figure 10 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0014] The present application will be described in further detail below with reference to the accompanying drawings and embodiments.
[0015] In related technologies, one recommendation solution is based on matrix decomposition to analyze users' potential interests and item features. However, this approach is based on the assumption of linear interaction between users and items, and does not fully consider the complex nonlinear interactions that commonly exist between users and items. Therefore, in recommendation scenarios facing complex users, the above solution still has room for improvement in recommendation accuracy. Another recommendation solution uses quantum parallelism to accelerate singular value decomposition to recommend items to users. However, this approach is also based on the assumption of linear interaction between users and items, ignoring the complex nonlinear interactions between users and items.
[0016] In summary, in highly personalized scenarios, related recommendation schemes cannot provide users with accurate item recommendations.
[0017] Based on this, in various embodiments of the present application, during the model training process, based on data mining capabilities, the quantum model can capture the data patterns between the implicit semantic data of items and users, thereby mining the deep interactive relationship between users and items. In this way, the accuracy and personalization level of item recommendations using the quantum model can be greatly improved.
[0018] The present application embodiment provides a model training method, which is applied to electronic devices, such as Figure 1 As shown, the method includes: Step 101: Obtain first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; Step 102: Use the first sample data and the second sample data to train a first quantum model, where the first quantum model can at least capture the nonlinear interaction relationship between users and items. The first quantum model is used to recommend items to the user to be recommended.
[0019] In actual application, the electronic device may include a device capable of executing steps 101 to 102, such as a server, a laptop, a tablet computer, or a desktop computer. The embodiment of the present application does not limit the type of electronic device, as long as its function is achieved. In addition, the first quantum model may include a model based on a quantum neural network. The first quantum model can realize data encoding and mining in the quantum feature space based on the superposition and entanglement properties in quantum mechanics, thereby capturing the interaction relationship or data pattern between data. The embodiment of the present application does not limit the type of the first quantum model, as long as its function is achieved.
[0020] In actual application, since the sample data that interacts with users and items (such as video, audio, application software or commodities, etc., the embodiment of this application does not limit the type of items) may have data sparsity problems, the electronic device can combine the inherent advantages of matrix decomposition technology to split the sample data to obtain the first sample data and the second sample data.
[0021] Specifically, in one embodiment, obtaining the first sample data and the second sample data includes: Acquire seventh sample data, where the seventh sample data represents the actual preference of the one or more users for the one or more items; Matrix decomposition processing is performed on the seventh sample data to obtain the first sample data and the second sample data.
[0022] In actual application, the seventh sample data may include a real rating matrix of the one or more users on the one or more items, and the rating matrix can reflect whether the user likes the one or more items, that is, the user's preference for the items. In actual application, for the seventh sample data, the electronic device may obtain historical interaction data between the user and the object from the network, and obtain the seventh sample data based on the obtained historical interaction data.
[0023] For example, the electronic device can collect historical movie ratings from users online, with ratings ranging from 1 to 5. In this case, the electronic device can mark data with a rating greater than 3 as 1 to indicate that the user likes the movie, mark data with a rating less than or equal to 3 as 0 to indicate that the user dislikes the movie, and mark the remaining data (such as unrated data) as -1 to indicate that the user's preference for the movie is unknown. In this way, a seventh sample data matrix of size m*n can be obtained, where m represents the number of users and n represents the number of items.
[0024] Then, based on matrix decomposition technology, the electronic device can split the seventh sample data into the first sample data and the second sample data; wherein, the seventh sample data can be expressed as the product of the first sample data and the second sample data, the first sample data can include a user latent semantic matrix, the user latent semantic matrix can include user latent semantic vectors corresponding to multiple users, the second sample data can include an item latent semantic matrix, the item latent semantic matrix can include item latent semantic vectors corresponding to multiple items, and the embodiment of the present application does not limit the types of the first sample data and the second sample data, as long as their functions are realized. In addition, the latent features can be understood as potential classification features learned or mined based on the user behavior reflected by the seventh sample data during the matrix decomposition process, such as music classification, director style, etc.
[0025] For example, Figure 2 As shown, when the seventh sample data includes a score matrix of size m*n, the electronic device can approximate the score matrix as the product of two low-rank matrices (which can also be understood as low-dimensional matrices) based on a preset parameter k (k can be expressed as the rank of matrix decomposition); wherein, it can be expressed by the following formula: (1) in, Expressed as a scoring matrix, i.e. the seventh sample data; Represented as a user latent semantic matrix of size k*m, that is, the first sample data; It is represented as a k*n item latent semantic matrix, i.e., the second sample data. The value of k is usually much smaller than the number of users m or the number of items n. It can be set according to the data distribution in the recommendation scenario, for example, to 8. Represented as an approximate rating matrix.
[0026] In actual application, it can be seen from formula (1) that for the user among the one or more users u , for items i The rating vector It can be expressed as: (2) in, Can be represented as a user u The preference for implicit features (which can also be understood as the user u latent semantic vector of Can be represented as an item i The degree of correlation between the implicit features (which can also be understood as the item i latent semantic vector of ).
[0027] It can be understood that through matrix decomposition technology, the historical interaction data between users and items (i.e., the seventh sample data) can be decomposed into lower-dimensional user-related data (i.e., the first sample data) and item-related data (i.e., the second sample data), thereby effectively revealing the user's potential interest preferences and item characteristics, so that the subsequent quantum model can learn the interactive relationship between interest preferences and item characteristics.
[0028] In actual application, in step 102, after obtaining the first sample data and the second sample data, the electronic device can combine quantum neural network technology to deeply explore the interactive relationship between the first sample data and the second sample data to perform model training.
[0029] Specifically, in one embodiment, the first quantum model includes a quantum circuit, and the training of the first quantum model using the first sample data and the second sample data includes: Encoding the first sample data and the second sample data to obtain third sample data, where the third sample data includes a quantum state of N quantum bits, where N is an integer greater than or equal to 1; Inputting the third sample data into the quantum circuit to obtain fourth sample data, where the fourth sample data represents a nonlinear interaction relationship between the one or more users and the one or more objects; The fourth sample data is used to adjust parameters of the quantum circuit so that the loss function of the quantum circuit converges.
[0030] In practical applications, the third sample data can be understood as quantum initial data (also known as quantum initial state) in the quantum feature space. Furthermore, the first quantum model can include the quantum circuit (also known as quantum circuit). That is, the electronic device can construct the first quantum model using the quantum circuit.
[0031] Here, the electronic device can convert the first sample data and the second sample data (also called classical data) in the non-quantum feature space into the third sample data in the quantum feature space based on relevant coding technology (such as amplitude coding or angle coding).
[0032] Specifically, in one embodiment, encoding the first sample data and the second sample data to obtain third sample data includes: performing splicing processing on the first sample data and the second sample data to obtain fifth sample data; Based on the amplitude coding technology, the fifth sample data is encoded to obtain the third sample data, and the value of N is determined based on the dimension of the fifth sample data.
[0033] The fifth sample data can be understood as the sample data obtained after the splicing process, and the dimension of the fifth sample data can be determined based on the dimension of the first sample data and the dimension of the second sample data. For example, assuming that the user in the first sample data u The size of the corresponding latent semantic vector is 8*1. The items in the second sample data are i The size of the corresponding latent semantic vector is 8*1, so the size of the latent semantic vector after splicing in the fifth sample data is 16*1, that is, the dimension of the latent semantic vector after splicing is 16. In actual application, for the fifth sample data, the electronic device may, based on the amplitude coding technology, sequentially encode the latent semantic vector after the splicing process into a quantum state of N qubits, thereby obtaining the third sample data; wherein, when the dimension of the latent semantic vector after the splicing process is Q, the value of N can be expressed as: In addition, the quantum state of N quantum bits It can be expressed as: , It is represented as a set of computational bases in Hilbert space, and x is represented as the latent semantic vector after concatenation.
[0034] It should be noted that before amplitude encoding is performed on the latent semantic vector after the splicing process, since the latent semantic vector after the splicing process constitutes the amplitude of a quantum state, the electronic device may first normalize the latent semantic vector after the splicing process so that the latent semantic vector after the splicing process satisfies the normalization condition; wherein the normalization condition may be: .
[0035] For example, suppose x is represented by The electronic device can encode a 2-bit quantum state based on amplitude coding technology. (Right now ).
[0036] In actual application, when the first quantum model is constructed through the quantum circuit, the electronic device can evolve the third sample data through the quantum circuit, so that the computational advantages of quantum computing in high-dimensional feature space can be effectively utilized for data mining.
[0037] Here, before evolving the third sample data, the electronic device needs to construct the quantum circuit.
[0038] Based on this, in one embodiment, before inputting the third sample data into the quantum circuit to obtain the fourth sample data, the method may further include: Determining the number of quantum bits using the third sample data; The quantum circuit is constructed using the number of quantum bits and the type of logic gates, where the type of logic gates at least includes a rotation gate and a controlled NOT gate.
[0039] Among them, the types of the logic gates may include a rotation gate, a controlled NOT gate, etc. The rotation gate is used to rotate the quantum bit, and the controlled NOT gate is used to achieve quantum entanglement between the user and the object. This embodiment of the application does not limit this.
[0040] In actual application, the electronic device can use the third sample data to determine the number of quantum bits, that is, the value of N; then, the quantum circuit is constructed using the number of quantum bits and the type of preset logic gates.
[0041] For example, assuming the number of quantum bits is 4, Figure 3 As shown, the electronic device can construct the quantum circuit; wherein RZ can be understood as a rotating gate that can rotate the quantum bit along the Z axis Angle, RZ can be expressed as: RY can be understood as a revolving door that can rotate the quantum bit along the Y axis The angle, RY, can be expressed as: CX can be understood as a controlled NOT gate. CX can be expressed as: .
[0042] In actual application, after constructing the quantum circuit, the electronic device can input the third sample data into the quantum circuit for data evolution; during the evolution process, due to quantum entanglement and quantum superposition, the electronic device can obtain the fourth sample data output by the quantum circuit. The fourth sample data can be understood as the evolved quantum output data (also called quantum output state) in the quantum feature space, which can reflect the data pattern between the user and the object; wherein, the dimension of the fourth sample data is the same as that of the third sample data.
[0043] For example, for users u The latent semantic vector and items i The electronic device obtains an N-bit quantum state based on the amplitude coding technology (which can be expressed as ) after passing through the quantum circuit (which can be expressed as ) Evolve the quantum state of N bits and obtain the user u and items i The nonlinear interaction relationship between u and items i Nonlinear interactions between It can be determined by the following formula: (3) In actual application, for the fourth sample data, the electronic device may convert the fourth sample data into a predicted preference degree between the user and the item, so as to iterate the parameters of the quantum circuit using the converted predicted preference degree.
[0044] Specifically, in one embodiment, adjusting the parameters of the quantum circuit using the fourth sample data includes: performing measurement processing and post-processing on the fourth sample data in sequence to obtain sixth sample data, where the sixth sample data represents the predicted preference of the one or more users for the one or more items; The sixth sample data and the seventh sample data are used to adjust the parameters of the quantum circuit, wherein the seventh sample data represents the actual preference of the one or more users for the one or more items.
[0045] The sixth sample data can be understood as the quantum circuit's prediction of the preference between the user and the item, for example, the user's predicted rating for the item (which can also be understood as a predicted probability). If the user's predicted rating for the item is greater than or equal to a preset threshold, the user's predicted preference for the item is high; if the user's predicted rating for the item is less than the preset threshold, the user's predicted preference for the item is low.
[0046] In actual application, during the measurement process, the electronic device can measure the Pauli Z The expected value of the operator corresponding to any one of the N qubits. Since the entanglement relationship between the N qubits is established in the quantum circuit, the electronic device can obtain the overall measurement result by measuring one qubit. The measurement result can be in the range of [-1, 1]. The measurement result can be determined by the following formula: (4) in, Pauli Z Operator, It can be expressed as: ; is the identity matrix, It can be expressed as .
[0047] In actual application, after obtaining the measurement result, the electronic device may perform post-processing on the measurement result to map the range of the measurement result to [0, 1], thereby obtaining the sixth sample data; wherein the sixth sample data can be obtained by the following formula: (5) in, Represented as the sixth sample data, The value of .
[0048] Here, in order to implement training of the first quantum model, the electronic device may construct a loss function based on the sixth sample data (which may also be understood as a predicted label) and the seventh sample data (which may also be understood as a true label), so as to iteratively optimize the parameters of the quantum circuit based on the loss function; wherein the loss function may be expressed as: (6) in, Represents the user whose true preference is known in the seventh sample data u and items i a collection of pairs; Represented as the seventh sample data.
[0049] It can be understood that during the iterative process, the electronic device can use the difference between the sixth sample data and the seventh sample data to calculate the squared difference loss value corresponding to the loss function through formula (6); then, based on the gradient optimization technology, the electronic device can adjust the parameters of the quantum circuit and the first and second sample data to minimize the loss function. In this way, the first quantum model can be trained so that the first quantum model fully learns the nonlinear interaction pattern between the user and the object.
[0050] In addition, by introducing gradient optimization technology, the parameters of the quantum circuit can be dynamically adjusted, providing more flexible model tuning capabilities. In this way, the first quantum model can be compatible with other models based on machine learning technology, making the first quantum model better adapted to different recommendation scenarios and having wider applicability and scalability.
[0051] The present application also provides an item recommendation method, which is applied to electronic devices, such as Figure 4 As shown, the following steps are included: Step 401: Acquire first data, wherein the first data includes a plurality of candidate items associated with a user to be recommended; Step 402: Recommend one or more items to the user to be recommended using the first data and a first quantum model, where the first quantum model is obtained according to the model training method provided in an embodiment of the present application.
[0052] In actual application, the electronic device may further include a device capable of executing steps 401 to 402.
[0053] In actual application, the electronic device may obtain the first data from the network, or may receive the first data input manually. The embodiment of the present application does not limit the method for obtaining the first data.
[0054] Here, the electronic device inputs the first data into the first quantum model, so that the first quantum model can predict the preference of the user to be recommended to the multiple candidate items; then, the electronic device can sort the multiple candidate items from high to low based on the preference level, and select one or more items from the multiple candidate items (the number of items can be set as needed, and this embodiment of the present application is not limited to this) to recommend items to the user to be recommended.
[0055] For example, for the user to be recommended u 1. If the first data contains 5 candidate items, they are represented as i 1, i 2, i 3. i 4 and i 5, the electronic device can obtain the user's u 1 respectively for the preference degree of the 5 items; then, based on the preference degree, 3 items are selected from the 5 items, and the items are recommended to the user to be recommended.
[0056] The model training and item recommendation method provided in the embodiments of the present application includes: obtaining first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; using the first sample data and the second sample data, training a first quantum model, wherein the first quantum model is capable of at least capturing the nonlinear interaction between users and items, and the first quantum model is used to recommend items to the user to be recommended. The technical solution provided in the embodiments of the present application, through the data mining capability of the quantum model, captures the complex interaction between users and items, so that the quantum model can better learn the deep interactive pattern of user preferences and item associations, thereby effectively improving the accuracy of item recommendation using the quantum model.
[0057] The present application is described in further detail below with reference to application examples.
[0058] In this application example, a personalized recommendation solution based on quantum neural networks is proposed. Specifically, during the training process, the quantum neural network is used to explore the deep interaction patterns between users and items, so as to provide better recommendations for users in the subsequent reasoning process.
[0059] Specifically, if Figure 5 As shown in Figure 2, the training process based on quantum neural network includes the following steps: Step 501: Collect historical interaction information between users and items, and generate a user and item rating matrix (i.e., the seventh sample data mentioned above); Step 502: Initialize the user latent semantic matrix (i.e., the first sample data mentioned above), the item latent semantic matrix (i.e., the second sample data mentioned above), and the parameters of the parameterized quantum circuit (i.e., the quantum circuit mentioned above); Among them, quantum neural networks are realized through parameterized quantum circuits.
[0060] Step 503: Map the user and item indexes to the corresponding latent semantic matrices to decompose and obtain the latent semantic vectors of the users and items; Here, when the size of the user latent semantic matrix is k*m, m users are encoded using one-hot encoding to convert the user u Mapped to the user's latent semantic matrix, we get the user u The hidden semantic vector of the item; when the size of the item hidden semantic matrix is k*n, the n items are uniquely encoded to separate the items i Mapped to the item latent semantic matrix, we get the item i The latent semantic vector of .
[0061] Step 504: Concatenate the latent semantic vectors of the user and the item (i.e., the fifth sample data mentioned above), and use amplitude coding to generate the quantum initial state (i.e., the third sample data mentioned above); Step 505: Evolving the quantum initial state through the parameterized quantum circuit to obtain the quantum output state (i.e., the fourth sample data mentioned above); Step 506: Measure the quantum output state and obtain a prediction result (i.e., the sixth sample data mentioned above) through post-processing. Step 507: Construct a loss function based on the predicted results and the true labels, and optimize it using the gradient descent method; It is understandable that if Figure 6 As shown in the figure, during the training process, after the embedding layer constructs the user latent semantic vector and the item latent semantic vector based on the user and item rating matrices, the user latent semantic vector and the item latent semantic vector are input into the parameterized quantum circuit in the quantum neural network after amplitude encoding. This allows the parameterized quantum circuit to capture the data pattern between the two vectors based on the superposition and entanglement properties in quantum mechanics, thereby exploring the deep interactive relationship between users and items.
[0062] Step 508: Save the trained quantum model (ie, the first quantum model mentioned above).
[0063] Among them, the quantum model includes a model based on quantum neural network, which is used to recommend personalized items to users. Specifically, if Figure 7 As shown in Figure 2, the reasoning process based on quantum neural networks includes the following steps: Step 701: Input a list of users and items (i.e., the first data mentioned above); Among them, the user and item lists contain users u 1 corresponds to multiple candidate item identifiers (such as identity identification codes (ID)), such as i 1. i 2nd level.
[0064] Step 702: Predicting the user's preference for the item using a quantum model; Step 703: Sort the items in the item list from largest to smallest according to the degree of preference; Step 704: Select the first P items to recommend to the user, where P is an integer greater than or equal to 1, and the value of P can be set as needed.
[0065] In the application example of this application, first, by using quantum neural network technology, the implicit semantic features of users and items are encoded into quantum circuits, which can effectively capture and utilize the nonlinear interaction information between the implicit semantic features of users and items, thereby significantly improving the quantum model's understanding of complex user preferences and item associations, and thus improving the accuracy of item recommendations using quantum models.
[0066] Secondly, by combining quantum neural networks and matrix decomposition, the processing capabilities of sparse data are optimized. This enhances the robustness of the quantum model and expands its application scope, enabling the quantum model to better adapt to diverse recommendation scenarios, such as e-commerce, social media, and content recommendation.
[0067] Third, by introducing gradient optimization technology, the parameters of parameterized quantum circuits can be dynamically adjusted, providing more flexible model tuning capabilities. This ensures that quantum models can be seamlessly integrated with other machine learning-based models, providing wider applicability and scalability.
[0068] In order to implement the model training method of the embodiment of the present application, the embodiment of the present application also provides a model training device, which is set on an electronic device, such as Figure 8 As shown, the device includes: A first acquisition unit 801 is configured to acquire first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; The training unit 802 is used to train a first quantum model using the first sample data and the second sample data. The first quantum model can at least capture the nonlinear interaction relationship between users and items. The first quantum model is used to recommend items to the user to be recommended.
[0069] In one embodiment, the first quantum model includes a quantum circuit, and the training unit 802 is used to encode the first sample data and the second sample data to obtain third sample data, where the third sample data includes a quantum state of N quantum bits, where N is an integer greater than or equal to 1; input the third sample data into the quantum circuit to obtain fourth sample data, where the fourth sample data represents a nonlinear interaction relationship between the one or more users and the one or more items; and use the fourth sample data to adjust the parameters of the quantum circuit so that the loss function of the quantum circuit converges.
[0070] In one embodiment, the training unit 802 is used to concatenate the first sample data and the second sample data to obtain fifth sample data; based on the amplitude coding technology, the fifth sample data is encoded to obtain the third sample data, and the value of N is determined based on the dimension of the fifth sample data.
[0071] In one embodiment, the training unit 802 is configured to perform measurement processing and post-processing on the fourth sample data in sequence to obtain sixth sample data, where the sixth sample data represents the predicted preference of the one or more users for the one or more items; and adjust the parameters of the quantum circuit using the sixth sample data and the seventh sample data, where the seventh sample data represents the actual preference of the one or more users for the one or more items.
[0072] In one embodiment, before inputting the third sample data into the quantum circuit to obtain the fourth sample data, the training unit 802 is further used to use the third sample data to determine the number of quantum bits; and construct the quantum circuit using the number of quantum bits and the type of logic gates, where the type of logic gates includes at least a rotation gate and a controlled NOT gate.
[0073] In one embodiment, the first acquisition unit 801 is used to obtain seventh sample data, where the seventh sample data represents the true preference of the one or more users for the one or more items; and perform matrix decomposition processing on the seventh sample data to obtain the first sample data and the second sample data respectively.
[0074] In actual application, the first acquisition unit 801 can be implemented by a communication interface in the model training device in combination with a processor, and the training unit 802 can be implemented by a processor in the model training device.
[0075] It should be noted that the model training device provided in the above embodiment only uses the division of the above program units as an example when performing model training. In actual applications, the above processing can be assigned to different program units as needed, that is, the internal structure of the device can be divided into different program units to complete all or part of the processing described above. In addition, the model training device provided in the above embodiment and the model training method embodiment are of the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0076] In order to implement the item recommendation method of the embodiment of the present application, the embodiment of the present application also provides an item recommendation device, which is set on an electronic device, such as Figure 9 As shown, the device includes: A second acquiring unit 901 is configured to acquire first data, where the first data includes a plurality of candidate items associated with a user to be recommended; The recommendation unit 902 is used to recommend one or more items to the user to be recommended using the first data and the first quantum model, where the first quantum model is obtained based on the model training method provided in the embodiment of the present application.
[0077] In actual application, the second acquisition unit 901 can be implemented by a communication interface in the item recommendation device; and the recommendation unit 902 can be implemented by a processor in the item recommendation device.
[0078] It should be noted that the item recommendation device provided in the above embodiment only uses the division of the aforementioned program units as an example to illustrate item recommendations. In actual applications, the aforementioned processing can be assigned to different program units as needed, that is, the internal structure of the device can be divided into different program units to complete all or part of the aforementioned processing. In addition, the item recommendation device provided in the above embodiment and the item recommendation method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0079] Based on the hardware implementation of the above program modules, and in order to implement the method of model training and item recommendation in the embodiment of the present application, the embodiment of the present application also provides an electronic device, such as Figure 10 As shown, the electronic device 1000 includes: Communication interface 1001, capable of interacting with other devices; A processor 1002 is connected to the communication interface 1001 to interact with other devices and is used to execute the methods provided by one or more of the above technical solutions when running a computer program; The computer program is stored in the memory 1003 .
[0080] Specifically, in the model training method provided in the embodiment of the present application, the processor 1002 is used to obtain first sample data and second sample data through the communication interface 1001, wherein the first sample data represents the preference of one or more users for the implicit feature, and the second sample data represents the degree of association between one or more items and the implicit feature, and the implicit feature includes a classification feature associated with user behavior; the first quantum model is trained using the first sample data and the second sample data, and the first quantum model can at least capture the nonlinear interaction relationship between users and items, and the first quantum model is used to recommend items to the user to be recommended.
[0081] In one embodiment, the first quantum model includes a quantum circuit, and the processor 1002 is configured to encode the first sample data and the second sample data to obtain third sample data, where the third sample data includes a quantum state of N quantum bits, where N is an integer greater than or equal to 1; input the third sample data into the quantum circuit to obtain fourth sample data, where the fourth sample data represents a nonlinear interaction relationship between the one or more users and the one or more items; and use the fourth sample data to adjust parameters of the quantum circuit so that a loss function of the quantum circuit converges.
[0082] In one embodiment, the processor 1002 is configured to concatenate the first sample data and the second sample data to obtain fifth sample data; and encode the fifth sample data based on amplitude coding technology to obtain the third sample data, where the value of N is determined based on the dimension of the fifth sample data.
[0083] In one embodiment, the processor 1002 is configured to perform measurement processing and post-processing on the fourth sample data in sequence to obtain sixth sample data, where the sixth sample data represents the predicted preference of the one or more users for the one or more items; and adjust the parameters of the quantum circuit using the sixth sample data and the seventh sample data, where the seventh sample data represents the actual preference of the one or more users for the one or more items.
[0084] In one embodiment, before inputting the third sample data into the quantum circuit to obtain the fourth sample data, the processor 1002 is further configured to use the third sample data to determine the number of quantum bits; and construct the quantum circuit using the number of quantum bits and the type of logic gates, where the type of logic gates includes at least a rotation gate and a controlled NOT gate.
[0085] In one embodiment, the processor 1002 is further used to obtain seventh sample data through the communication interface 1001, where the seventh sample data represents the actual preference of the one or more users for the one or more items; and perform matrix decomposition processing on the seventh sample data to obtain the first sample data and the second sample data respectively.
[0086] In the item recommendation method provided in an embodiment of the present application, the processor 1002 is used to obtain first data through the communication interface, where the first data includes multiple candidate items associated with the user to be recommended; and use the first data and a first quantum model to recommend one or more items to the user to be recommended, where the first quantum model is obtained based on the model training method provided in an embodiment of the present application.
[0087] It should be noted that the specific processing process of the communication interface 1001 and the processor 1002 can be understood by referring to the above method.
[0088] Of course, in actual application, the various components in the electronic device 1000 are coupled together through the bus system 1004. It can be understood that the bus system 1004 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1004 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 10 Various buses are labeled as bus system 1004.
[0089] The memory 1003 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 1000. Examples of such data include: any computer program used to operate on the electronic device 1000.
[0090] The methods disclosed in the above embodiments of the present application can be applied to or implemented by the processor 1002. The processor 1002 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the processor 1002. The processor 1002 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. The processor 1002 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium located in the memory 1003. The processor 1002 reads the information in the memory 1003 and, in conjunction with its hardware, completes the steps of the above method.
[0091] In an exemplary embodiment, the electronic device 1000 may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.
[0092] It is understood that the memory (memory 1003) in the embodiment of the present application can be volatile memory or non-volatile memory, or can include both volatile and non-volatile memory. Among them, non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface storage, optical disk, or compact disc read-only memory (CD-ROM); magnetic surface storage can be magnetic disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memories described in the embodiments of this application are intended to include, but are not limited to, these and any other suitable types of memories.
[0093] In an exemplary embodiment, the present application also provides a storage medium, namely, a computer storage medium, specifically, a computer-readable storage medium, such as a memory 1003 storing a computer program. The computer program can be executed by the processor 1002 of the electronic device 1000 to complete the steps of the aforementioned model training method or the steps of the aforementioned item recommendation method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.
[0094] In an exemplary embodiment, the embodiment of the present application also provides a computer program product, including a computer program, which can be executed by the processor 1002 of the electronic device 1000 to complete the steps of the aforementioned model training method, or complete the steps of the aforementioned item recommendation method.
[0095] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0096] In addition, the technical solutions described in the embodiments of the present application can be arbitrarily combined without conflict.
[0097] The above description is merely a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application.
Claims
1. A model training method, characterized in that: The method comprises: Obtaining first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; The first sample data and the second sample data are used to train a first quantum model, where the first quantum model can at least capture the nonlinear interaction relationship between users and items. The first quantum model is used to recommend items to users to be recommended.
2. The method according to claim 1, characterized in that The first quantum model includes a quantum circuit, and the training of the first quantum model using the first sample data and the second sample data includes: Encoding the first sample data and the second sample data to obtain third sample data, where the third sample data includes a quantum state of N quantum bits, where N is an integer greater than or equal to 1; Inputting the third sample data into the quantum circuit to obtain fourth sample data, where the fourth sample data represents a nonlinear interaction relationship between the one or more users and the one or more objects; The fourth sample data is used to adjust parameters of the quantum circuit so that the loss function of the quantum circuit converges.
3. The method according to claim 2, characterized in that The encoding process of the first sample data and the second sample data to obtain third sample data includes: performing splicing processing on the first sample data and the second sample data to obtain fifth sample data; Based on the amplitude coding technology, the fifth sample data is encoded to obtain the third sample data, and the value of N is determined based on the dimension of the fifth sample data.
4. The method according to claim 2, characterized in that The adjusting the parameters of the quantum circuit using the fourth sample data includes: performing measurement processing and post-processing on the fourth sample data in sequence to obtain sixth sample data, where the sixth sample data represents the predicted preference of the one or more users for the one or more items; The sixth sample data and the seventh sample data are used to adjust the parameters of the quantum circuit, wherein the seventh sample data represents the actual preference of the one or more users for the one or more items.
5. The method according to claim 2, characterized in that Before inputting the third sample data into the quantum circuit to obtain fourth sample data, the method further includes: Determining the number of quantum bits using the third sample data; The quantum circuit is constructed using the number of quantum bits and the type of logic gates, where the type of logic gates at least includes a rotation gate and a controlled NOT gate.
6. The method according to any one of claims 1 to 5, characterized in that The obtaining of the first sample data and the second sample data includes: Acquire seventh sample data, where the seventh sample data represents the actual preference of the one or more users for the one or more items; Perform matrix decomposition processing on the seventh sample data to obtain the first sample data and the second sample data.
7. An item recommendation method, characterized in that: The method comprises: Acquire first data, wherein the first data includes a plurality of candidate items associated with a user to be recommended; One or more items are recommended to the user to be recommended using the first data and a first quantum model, wherein the first quantum model is obtained according to the method according to any one of claims 1 to 6.
8. A model training device, characterized in that: The device comprises: a first acquisition unit, configured to acquire first sample data and second sample data, wherein the first sample data represents the preference of one or more users for an implicit feature, and the second sample data represents the association between one or more items and the implicit feature, wherein the implicit feature includes a classification feature associated with user behavior; A training unit is used to train a first quantum model using the first sample data and the second sample data, where the first quantum model can at least capture the nonlinear interaction relationship between the user and the item, and the first quantum model is used to recommend items to the user to be recommended.
9. An item recommendation device, characterized in that: The device comprises: a second acquiring unit, configured to acquire first data, wherein the first data includes a plurality of candidate items associated with the user to be recommended; A recommendation unit is configured to recommend one or more items to the user to be recommended using the first data and a first quantum model, wherein the first quantum model is obtained according to the method according to any one of claims 1 to 6.
10. An electronic device, characterized in that: include: a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 6, or implements the steps of the method described in claim 7.
11. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6, or implements the steps of the method according to claim 7.
12. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6, or implements the steps of the method according to claim 7.
Citation Information
Patent Citations
Method and device for performing preference prediction demonstration by using quantum circuit
CN112132614A
Quantum recommendation method, device and system based on parallel quantum intrinsic solver
CN113988303A
Article recommendation model training method and device, electronic equipment and storage medium
CN115841366A
Article recommendation method and device and storage medium
CN116010684A
Quantum recommendation system
US20200372388A1