A recommendation system triple verification method, device, medium and electronic device
By using a combination of quantum variational convolutional layers and fully connected layers in the triplet validation of the recommender system, the problem of not being able to obtain tail entity features and interaction features in the existing technology is solved, and higher validation accuracy is achieved.
Patent Information
- Application Number
- CN202311088163.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2043-08-25
AI Technical Summary
Existing recommendation system triple verification networks are based on classic convolutional neural networks, which cannot obtain the features of tail entities and the interaction features between the components of triples, resulting in low verification accuracy.
A quantum variational convolutional layer is used to extract features from the reconstructed matrix, and a fully connected layer is used for confidence measurement. The superposition and entanglement properties of quantum computing are used to improve the verification accuracy.
Quantum computing can be used to obtain the latent features of triples more comprehensively, significantly improving the verification accuracy of triples in recommendation systems.
Smart Images

Figure CN117196049B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of quantum computing technology, and in particular to a method, apparatus, medium and electronic device for verifying triples in a recommendation system. Background Technology
[0002] A quantum computer is a physical device that performs high-speed mathematical and logical operations, stores and processes quantum information in accordance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Because of its ability to process mathematical problems more efficiently than ordinary computers—for example, reducing the time to crack RSA keys from hundreds of years to hours—quantum computers have become a key technology under research.
[0003] Existing triple verification networks in recommender systems mostly employ classic convolutional neural networks. However, due to limitations in the processing power of classical computers, they only predict the correctness of triples based on the head entity vector and relation vector. They cannot obtain the features of the tail entity, nor can they obtain the interaction features between the components of the triple (head entity, relation, and tail entity). As a result, the network performance is poor, and the verification accuracy of triples in recommender systems is low.
[0004] Application content
[0005] The purpose of this application is to provide a method, apparatus, medium, and electronic device for verifying triples in a recommendation system, aiming to improve the verification accuracy of triples in a recommendation system.
[0006] One embodiment of this application provides a method for verifying triples in a recommendation system, the method comprising:
[0007] From the head entity vector, relation vector, and tail entity vector of the recommender system triple, select any two vectors to obtain C3. 2 Each combination method, and a reconstruction matrix determined for each combination method;
[0008] The reconstructed matrix is used to extract features using a quantum variational convolutional layer to obtain a feature matrix, and the feature matrix is then reduced in dimensionality to obtain a feature vector.
[0009] The confidence of the feature vector is measured using a fully connected layer to obtain the triple confidence.
[0010] The system determines whether the triples in the recommendation system are correct based on the confidence level of the triples.
[0011] Optionally, the quantum circuit corresponding to the quantum variational convolutional layer includes an encoding circuit, an entanglement circuit, and a variational circuit. The encoding circuit is used to load the reconstruction matrix onto the qubits, the variational circuit is used to establish entanglement between the loaded qubits, and the variational circuit is used to perform variational quantum encoding on the entangled qubits.
[0012] Optionally, the encoding circuit includes a first single quantum logic gate and a second single quantum logic gate acting on each qubit, the entanglement circuit includes a multi-quantum logic gate acting on multiple qubits, and the variational circuit includes a third single quantum logic gate acting on each qubit. The parameters of the first and second single quantum logic gates are determined based on the reconstruction matrix, and the parameters of the third single quantum logic gate are determined based on training.
[0013] Optionally, C3 is obtained by selecting any two vectors from the head entity vector, relation vector, and tail entity vector. 2 There are several combination methods, and a reconstruction matrix is determined for each combination method, including:
[0014] From the head entity vector, relation vector, and tail entity vector: select the head entity vector and relation vector to obtain the first combination method; select the head entity vector and tail entity vector to obtain the second combination method; select the relation vector and tail entity vector to obtain the third combination method.
[0015] The first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix are determined based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method.
[0016] Optionally, determining the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method includes:
[0017] The elements in the head entity vector, relation vector, and tail entity vector are randomly arranged to obtain the corresponding recombined head entity vector, recombined relation vector, and recombined tail entity vector.
[0018] The recombined head entity vector, recombined relation vector, and recombined tail entity vector are each equally divided to obtain the corresponding sub-head entity vector group, sub-relation vector group, and sub-tail entity vector group.
[0019] The vectors in the sub-head entity vector group and the sub-relation vector group are used as one-dimensional vectors in the first reconstruction matrix, the vectors in the sub-head entity vector group and the sub-tail entity vector group are used as one-dimensional vectors in the second reconstruction matrix, and the vectors in the sub-relation vector group and the sub-tail entity vector group are used as one-dimensional vectors in the third reconstruction matrix, such that any two adjacent one-dimensional vectors in the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix belong to different vector groups.
[0020] Optionally, the feature matrix includes a first feature matrix, a second feature matrix, and a third feature matrix. The step of using a quantum variational convolutional layer to extract features from the reconstructed matrix to obtain the feature matrix includes:
[0021] Quantum variational convolutional layers are used to extract features from the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix, respectively, to obtain a first feature matrix corresponding to the first reconstruction matrix, a second feature matrix corresponding to the second reconstruction matrix, and a third feature matrix corresponding to the third reconstruction matrix.
[0022] Optionally, the feature vector includes a first feature vector, a second feature vector, and a third feature vector, and the dimensionality reduction of the feature matrix to obtain the feature vector includes:
[0023] The dimensions of the first feature matrix, the second feature matrix, and the third feature matrix are reduced respectively to obtain the first feature vector corresponding to the first feature matrix, the second feature vector corresponding to the second feature matrix, and the third feature vector corresponding to the third feature matrix.
[0024] Optionally, the step of using a fully connected layer to measure the confidence level of the feature vector includes:
[0025] The first feature vector, the second feature vector, and the third feature vector are concatenated to obtain the confidence measurement vector. The confidence measurement vector is then input into the fully connected layer, and the fully connected layer is run.
[0026] Optionally, determining whether the triples in the recommendation system are correct based on the triple confidence score includes:
[0027] If the confidence value of the triple is within a preset range, then the triple of the recommendation system is correct;
[0028] Otherwise, the recommendation system has a triplet error.
[0029] Another embodiment of this application provides a verification device for triples in a recommendation system, the device comprising:
[0030] The reconstruction module is used to select any two vectors from the head entity vector, relation vector, and tail entity vector of the recommender system triples to obtain... Each combination method, and a reconstruction matrix determined for each combination method;
[0031] The feature extraction and dimensionality reduction module is used to extract features from the reconstructed matrix using a quantum variational convolutional layer to obtain a feature matrix, and to reduce the dimensionality of the feature matrix to obtain a feature vector.
[0032] The confidence measurement module is used to measure the confidence of the feature vector using a fully connected layer to obtain the confidence of the triples;
[0033] The confirmation module is used to determine whether the triples in the recommendation system are correct based on the confidence level of the triples.
[0034] Another embodiment of this application provides a method for expanding the knowledge graph of a recommendation system, the method comprising:
[0035] Get the triples to be expanded;
[0036] Verify whether the triplet to be expanded is correct according to the method provided in the above embodiments of this application;
[0037] If the triple to be expanded is correct, the triple to be expanded is added to the knowledge graph of the recommendation system.
[0038] Another embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.
[0039] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.
[0040] This application verifies the correctness of recommender system triples using quantum computers, overcoming the limitations of classical computers. It reconstructs the head entity vector, relation vector, and tail entity vector of the recommender system triples. The resulting reconstructed matrix contains features of both the tail entity and the interaction features between the triple components. A quantum convolutional neural network is used to extract features from the reconstructed matrix, fully capturing the latent features of the triples and enhancing the verification capability. Furthermore, this application constructs the logic gates in the recommender system triple verification network based on a variable quantum algorithm. Benefiting from the quantum superposition and quantum entanglement properties of quantum states, it provides more powerful computational capabilities compared to traditional methods and utilizes quantum optimization techniques to optimize the network parameters. Compared to existing recommender system triple verification networks, the recommender system triple verification method provided by this invention significantly improves the verification accuracy of recommender system triples. Attached Figure Description
[0041] Figure 1 A hardware structure block diagram of a computer terminal for a triplet verification method for a recommendation system provided in an embodiment of this application;
[0042] Figure 2 A flowchart illustrating a triplet verification method for a recommendation system provided in this application embodiment;
[0043] Figure 3 An exemplary schematic diagram of a quantum variational convolution circuit provided in an embodiment of this application;
[0044] Figure 4 A flowchart illustrating another method for verifying triples in a recommendation system provided in this application embodiment;
[0045] Figure 5 A flowchart illustrating another method for verifying triples in a recommendation system provided in this application embodiment;
[0046] Figure 6 A schematic diagram of the structure of a triplet verification device for a recommendation system provided in this application embodiment;
[0047] Figure 7 This is a flowchart illustrating a method for expanding a knowledge graph in a recommendation system, as provided in an embodiment of this application. Detailed Implementation
[0048] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0049] Figure 1This is a network block diagram of a recommendation system triple verification system provided in an embodiment of this application. The recommendation system triple verification system may include a network 110, a server 120, a wireless device 130, a client 140, storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memory, a classical processor, a quantum processor, and other devices (not shown).
[0050] Network 110 is a medium used to provide communication links between various devices and computers connected together within the recommendation system triplet verification system, including but not limited to the Internet, corporate intranets, local area networks, mobile communication networks and combinations thereof, and the connection method can be wired, wireless communication links or fiber optic cables, etc.
[0051] Server 120, wireless device 130, and client 140 are conventional data processing systems that may contain data and application programs or software tools that perform conventional computational processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.
[0052] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application program 163 (application program 173). The application program 163 (application program 173) may be used to implement the quantum algorithm compiled according to the recommendation system triplet verification method provided in the embodiments of this application.
[0053] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0054] It should be noted that a true quantum computer has a hybrid structure, which includes at least... Figure 1 The system consists of two main parts: the classical computing unit 160, which is responsible for performing classical calculations and control; and the quantum computing unit 170, which is responsible for running quantum programs to achieve quantum computing.
[0055] The aforementioned classical computing unit 160 and quantum computing unit 170 can be integrated into a single device or distributed across two different devices. For example, a first device including the classical computing unit 160 runs a classical computer operating system, providing quantum application development tools and services, as well as the storage and network services required for quantum applications. Users develop quantum programs using the quantum application development tools and services on the second device, and send these quantum programs to a second device including the quantum computing unit 170 via the network services. The second device runs a quantum computer operating system, which parses and compiles the quantum program's code into instructions that the quantum processor 170 can recognize and execute. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on these instructions.
[0056] The computing units of the classic processor 161 within the classic computing unit 160 are based on CMOS transistors on a silicon chip. These computing units are not limited by time or coherence; that is, they are available at any time without time constraints. Furthermore, the number of such computing units in a silicon chip is sufficient; currently, a single classic processor 161 contains tens of thousands of computing units. Given this sufficient number and the fixed selectable computing logic of the CMOS transistors (e.g., AND logic), computational performance is achieved by combining a large number of CMOS transistors with a limited set of logic functions during operation.
[0057] In the quantum computing unit 170, the basic computing unit of the quantum processor 171 is the qubit. The input of a qubit is limited by coherence and coherence time; that is, a qubit is limited by its usage time and is not always available. Making full use of qubits within their available usage time is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is one of the representative indicators of its performance. Each qubit performs computational functions through on-demand configured logical functions. Given the limited number of qubits and the diverse logical functions available in quantum computing, such as Hadamard gates (H gates), Pauli-X gates (X gates), Pauli-Y gates (Y gates), Pauli-Z gates (Z gates), X gates, RY gates, RZ gates, CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc., quantum computing requires combining a limited number of qubits with diverse logical function combinations to achieve computational effects.
[0058] Based on these differences, the design of classical logic functions applied to CMOS transistors and the design of quantum logic functions applied to qubits are significantly and fundamentally different. The design of classical logic functions applied to CMOS transistors does not need to consider the individuality of CMOS transistors. For example, the representation of a CMOS transistor in a silicon chip is its individual identifier, location, and usable time of each CMOS transistor. Therefore, classical algorithms composed of classical logic functions only express the operational relationship of the algorithm, not the algorithm's dependence on individual CMOS transistors.
[0059] Quantum logic functions applied to qubits need to consider the individuality of each qubit, such as its position within the quantum chip, its relationship with surrounding qubits, and the duration of its usable time. Therefore, quantum algorithms composed of quantum logic functions not only express the computational relationships within the algorithm but also its dependence on the individual qubits.
[0060] For example:
[0061] Quantum Algorithm 1: H1, H2, CNOT(1,3), H3, CNOT(2,3);
[0062] Quantum Algorithm 2: H1, H2, CNOT(1,2), H3, CNOT(2,3);
[0063] Where 1 / 2 / 3 represent three sequentially connected qubits Q1, Q2, Q3 or interconnected qubits Q1, Q2, Q3, respectively;
[0064] An exemplary explanation of how quantum algorithms are affected by the coherence time of qubits is as follows:
[0065] Define the execution time of a single-qubit logic gate as t, and the execution time of two single-qubit logic gates operating on adjacent qubits as 2t; then:
[0066] When Q1, Q2, and Q3 are interconnected, the computation of Quantum Algorithm 1 requires 6t, which is divided into 4 time periods. The duration of each time period is t, 2t, t, and 2t, respectively. The operations performed in each time period are: H1, H2; CNOT(1,3); H3; CNOT(2,3);
[0067] The computation of Quantum Algorithm 1 requires 5t, which is divided into 3 time periods. The duration of each time period is t, 2t, and 2t respectively. The operations performed in each time period are: H1, H2, H3; CNOT(1,2); CNOT(2,3);
[0068] When Q1, Q2, and Q3 are connected sequentially, Quantum Algorithm 1 needs to be equivalent to: H1, H2; swap(1,2), CNOT(2,3), swap(1,2); H3; CNOT(2,3). The computation of the equivalent Quantum Algorithm 1 requires 10t, divided into 4 time periods, with each time period requiring durations of t, 6t, t, and 2t respectively. The operations performed in each time period are: H1, H2; swap(1,2), CNOT(2,3), swap(1,2); H3; CNOT(2,3).
[0069] Therefore, the application of quantum logic functions in the design of qubits (including the design of whether qubits are used and the design of the efficiency of each qubit) is key to improving the computational performance of quantum computers and requires special design. This is the unique characteristic of quantum algorithms implemented based on quantum logic functions, and is fundamentally and significantly different from classical algorithms implemented based on classical logic functions. The aforementioned design of qubits is a technical problem that ordinary computing devices do not need to consider or address. Based on this, this application proposes a method and related apparatus for verifying recommender system triples in quantum computing, aiming to improve the accuracy of recommender system triple verification.
[0070] See Figure 2 , Figure 2 A flowchart illustrating a triplet verification method for a recommendation system provided in this application embodiment may include the following steps:
[0071] S201, select any two vectors from the head entity vector, relation vector, and tail entity vector of the recommender system triples to obtain C3. 2 Each combination method, and a reconstruction matrix determined for each combination method;
[0072] Recommender systems are systems that use users' historical behavior data, personal interests, and preferences to provide personalized content recommendations. They are widely used in e-commerce, social media, and other fields. Their purpose is to predict content that users might be interested in by analyzing their behavioral patterns and interests, and then recommend that content to them.
[0073] A knowledge graph is a structured data model used to describe and organize knowledge, constructing a semantically rich knowledge network in the form of triples. A triple in a knowledge graph is a basic unit consisting of a head entity, a relation, and a tail entity, describing the relationships and attributes between entities.
[0074] A head entity represents an entity or concept, which can be a person, item, attribute, etc. A relation represents the semantic association or connection between the head and tail entities, describing their interaction or dependency. A tail entity represents an entity or attribute value associated with the head entity.
[0075] In recommender systems, a knowledge graph is a semantic knowledge base used to store and represent the knowledge required by the system. It contains several triples that describe and organize the domain knowledge needed by the recommender system. For example, in a movie recommender system, the knowledge graph might contain the following triple: head entity "User A", relation "like", and tail entity "Movie B". This triple represents User A's preference for movie B. The recommender system can leverage the relations and connections between entities in the knowledge graph to provide personalized recommendations to users; for example, it can recommend movie C, which is similar to movie B, to User A.
[0076] Validating the triples in a recommender system can help identify and correct potential data errors or inconsistencies, provide a basis for recommendation explanations, help the recommender system better model the relationships between entities, or discover missing relationships or undiscovered entities, supplementing the information in the knowledge graph, thereby ensuring the accuracy and reliability of the knowledge graph, and improving the performance of the recommender system and user satisfaction.
[0077] In recommender systems, head entity vectors, tail entity vectors, and relation vectors are mathematical vectors used to represent triples in a knowledge graph. The head entity vector represents the head entity, the tail entity vector represents the tail entity, and the relation vector represents the relation.
[0078] For example, taking the triplet provided in the embodiments of this application as an example, the head entity vector corresponding to the head entity "User A" can be |0.2 -0.3 0.5 0.8 -0.1 0.6 -0.4 0.9|, the relation vector corresponding to the relation "like" can be |0.7 0.9 0.3 -0.2 0.6 -0.5 0.1 -0.8|, and the tail entity vector corresponding to the tail entity "Movie B" can be |0.4 -0.6 0.8 -0.1 0.3 -0.9 0.7 0.2|.
[0079] Head entity vectors, tail entity vectors, and relation vectors can be generated using various tools, such as Word2Vec, GloVe, and BERT. These tools can map head entities, relations, and tail entities to a low-dimensional vector space, transforming the features of these entities into corresponding numerical vector representations. This application does not impose specific restrictions on the methods used to obtain head entity vectors, relation vectors, and tail entity vectors based on head entities, relations, and tail entities; the appropriate method should be chosen based on actual needs.
[0080] The reconstruction matrix will be described below.
[0081] S202, use a quantum variational convolutional layer to extract features from the reconstructed matrix to obtain a feature matrix, and reduce the dimensionality of the feature matrix to obtain a feature vector;
[0082] A convolutional layer is a neural network layer used to extract features from input data. It filters the input data by applying convolution operations to obtain feature maps with spatial locality. In the field of quantum computing, a quantum variational convolutional layer is a quantum neural network layer based on variational quantum circuits. It applies quantum gates with variable parameters to perform convolution operations on the input data, and the parameters in the logic gates can be optimized through iterative training to improve the performance of the convolutional layer. The specific structure of the quantum circuit corresponding to the quantum variational convolutional layer will be described in detail below.
[0083] Feature extraction refers to extracting representative features from data that are helpful in solving a specific task and generating a feature matrix. Its aim is to reduce the dimensionality of the data while retaining information useful for the task. Through feature extraction, the impact of redundant information and noise can be reduced, improving the model's generalization ability and performance.
[0084] A feature matrix is a two-dimensional matrix that represents the features of a sample after feature extraction. Each row represents a sample, and each column represents a feature; alternatively, each column represents a sample, and each row represents a feature. Each element of the feature matrix represents the value of the corresponding sample for that feature. Features in the feature matrix can be attributes from the data, calculated statistical features, etc.
[0085] The method for extracting features from the reconstructed matrix using quantum variational convolutional layers will be described below.
[0086] Dimensionality reduction refers to the process of converting high-dimensional data into low-dimensional data, which simplifies data representation and processing and extracts the most important features. In the embodiments of this application, dimensionality reduction refers to converting a two-dimensional feature matrix into a one-dimensional feature vector, which can be done in various ways, such as averaging, summing, and concatenation. This application does not impose specific limitations on the method of dimensionality reduction of the feature matrix; it should be selected according to actual needs.
[0087] An eigenvector is a one-dimensional vector obtained by dimensionality reduction of a feature matrix. It represents the value or weight of a sample in the dimensionality-reduced feature space. The eigenvector contains the eigenvalues after dimensionality reduction.
[0088] S203, use a fully connected layer to measure the confidence of the feature vector to obtain the triple confidence;
[0089] A fully connected layer is a type of layer in a neural network where each neuron is connected to all neurons in the previous layer. The input to a fully connected layer is a vector (or matrix), where each element represents the output of a neuron in the previous layer. For each neuron, the fully connected layer performs a weighted sum of its input and corresponding weights, and then applies a non-linear transformation through an activation function to obtain the neuron's output.
[0090] Confidence levels and triplet confidence levels will be explained below.
[0091] In one embodiment of this application, the fully connected layer includes an input layer, a weight matrix, a bias vector, an activation function, and an output layer. The input layer receives the output of the previous layer as input, the weight matrix contains the weights of each connection, the bias vector is used to adjust the activation threshold of neurons, the activation function is used to perform a nonlinear transformation on the weighted summation result, and the output layer takes the output of the activation function as its output and passes it to the next fully connected layer.
[0092] In one embodiment of this application, the method for measuring the confidence of the feature vector using a fully connected layer to obtain the triple confidence can be as follows: The feature vector is standardized, and the standardized result is input into the fully connected layer for processing to obtain the output of the fully connected layer. Then, the output of the fully connected layer is added to the input of the fully connected layer and standardized, and the triple confidence is obtained based on the sum and standardization results.
[0093] In one embodiment of this application, the fully connected layer includes a corresponding quantum variational fully connected circuit. The quantum variational fully connected circuit includes a fourth single quantum logic gate and a fifth single quantum logic gate acting on each qubit, a second multi-quantum logic gate acting on multiple qubits, and a measurement layer acting on each qubit. The parameters of the fourth single quantum logic gate are determined based on the eigenvector, and the parameters of the fifth single quantum logic gate are determined based on training.
[0094] S204, determine whether the triplet in the recommendation system is correct based on the confidence level of the triplet.
[0095] The method for determining the correctness of triples in a recommendation system based on triple confidence will be explained in detail below.
[0096] In one embodiment of this application, the quantum circuit corresponding to the quantum variational convolutional layer includes an encoding circuit, an entanglement circuit, and a variational circuit. The encoding circuit is used to load the reconstruction matrix onto the qubits, the variational circuit is used to establish entanglement between the loaded qubits, and the variational circuit is used to perform variational quantum encoding on the entangled qubits.
[0097] Variable quantum coding refers to the use of variable quantum circuits to encode the quantum states of loaded qubits. A variable quantum circuit is a quantum circuit composed of parameterized quantum logic gates. When solving a problem, the solution space is represented by a variable quantum circuit, and the variables of the problem are represented by the parameters of the quantum logic gates. By adjusting the parameters of these quantum logic gates, a highly tunable quantum circuit is constructed, allowing the circuit to transform the input data in different ways, thus handling various different problems. Furthermore, unlike traditional quantum circuits, variable quantum circuits use variational optimization algorithms to find the optimal parameters that minimize the problem's loss, thereby obtaining an approximate solution to the problem and significantly improving computational efficiency.
[0098] In quantum computing, the states of qubits can be altered by applying specific quantum gate operations, thus establishing entanglement between multiple qubits. For example, multi-qubit control gates such as CNOT, SWAP, and Tofoli gates can be used to transform the quantum states of multiple qubits and establish entanglement between them.
[0099] For ease of explanation, the quantum circuit corresponding to the quantum variational convolution layer in this application embodiment is referred to as a quantum variational convolution circuit.
[0100] The structure, operation, and parameters of the logic gates of the quantum variational convolution circuit will be described below.
[0101] In one embodiment of this application, the encoding circuit includes a first single quantum logic gate and a second single quantum logic gate acting on each qubit, the entanglement circuit includes a multi-quantum logic gate acting on multiple qubits, and the variational circuit includes a third single quantum logic gate acting on each qubit. The parameters of the first single quantum logic gate and the second single quantum logic gate are determined based on the reconstruction matrix, and the parameters of the third single quantum logic gate are determined based on training.
[0102] A single quantum logic gate is a quantum logic gate used in quantum circuits to operate a single quantum bit. It includes Hadamard gates, phase gates, single quantum rotation gates, etc. Single quantum logic gates can be used to realize the state transformation of a single quantum bit and to realize the basic operations and algorithms in quantum computing.
[0103] Multiple quantum logic gates are quantum logic gates used in quantum circuits to operate multiple qubits. They include CRX, CRY, CRZ, CNOT gates, SWAP gates, Tooffoli gates, etc. Multiple quantum logic gates can not only be used to realize the state transformation of a single qubit, but also to realize the control and interaction between multiple qubits.
[0104] In one embodiment of this application, C3 is obtained by selecting any two vectors from the head entity vector, relation vector, and tail entity vector. 2 There are several combination methods, and a reconstruction matrix is determined for each combination method, including:
[0105] From the head entity vector, relation vector, and tail entity vector: select the head entity vector and relation vector to obtain the first combination method; select the head entity vector and tail entity vector to obtain the second combination method; select the relation vector and tail entity vector to obtain the third combination method.
[0106] The first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix are determined based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method.
[0107] Combination methods refer to the ways to select two vectors from a given set of head entity vectors, relation vectors, and tail entity vectors, and combine them together. Each combination method corresponds to a different vector combination result. It is important to note that the combination method here refers to the combination of two vectors, regardless of their order. That is, head entity vectors, relation vectors, and relation vectors are all considered to be combined in the same way.
[0108] In the embodiments of this application, the combination methods include a first combination method, a second combination method, and a third combination method. The first combination method represents the combination of the head entity vector and the relation vector, the second combination method represents the combination of the head entity vector and the tail entity vector, and the third combination method represents the combination of the relation vector and the tail entity vector.
[0109] In one embodiment of this application, determining the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method includes:
[0110] The elements in the head entity vector, relation vector, and tail entity vector are randomly arranged to obtain the corresponding recombined head entity vector, recombined relation vector, and recombined tail entity vector.
[0111] The recombined head entity vector, recombined relation vector, and recombined tail entity vector are each equally divided to obtain the corresponding sub-head entity vector group, sub-relation vector group, and sub-tail entity vector group.
[0112] The vectors in the sub-head entity vector group and the sub-relation vector group are used as one-dimensional vectors in the first reconstruction matrix, the vectors in the sub-head entity vector group and the sub-tail entity vector group are used as one-dimensional vectors in the second reconstruction matrix, and the vectors in the sub-relation vector group and the sub-tail entity vector group are used as one-dimensional vectors in the third reconstruction matrix, such that any two adjacent one-dimensional vectors in the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix belong to different vector groups.
[0113] In this embodiment of the application, the reconstructed matrix refers to a matrix obtained by operating and transforming the head entity vector, relation vector, and tail entity vector based on a series of methods provided in this embodiment of the application, and capable of using a quantum variational convolutional layer to extract its features.
[0114] Random permutation refers to rearranging the elements of the head entity vector, relation vector, and tail entity vector in a random manner, such that the position of each element in the new permutation is random, and each permutation has an equal probability. Given a head entity vector, relation vector, and tail entity vector, random permutation generates new vectors, including recombining the head entity vector, relation vector, and tail entity vector. Random permutation can be implemented using various randomization algorithms or functions, ensuring that the generated new vectors are random and uniform.
[0115] Recombining the head entity vector refers to the new vector obtained by randomly arranging the elements in the head entity vector. Recombining the relation vector refers to the new vector obtained by randomly arranging the elements in the relation vector. Recombining the tail entity vector refers to the new vector obtained by randomly arranging the elements in the tail entity vector.
[0116] Equal partitioning refers to dividing the recombined head entity vector, recombined relation vector, and recombined tail entity vector into several sub-vectors of equal length. These sub-vectors are combined into corresponding sub-vector groups, including sub-head entity vector groups, sub-relation vector groups, and sub-tail entity vector groups. Within each sub-vector group, each sub-vector has the same length, and the order of its elements is consistent with the order of the elements in the corresponding recombined head entity vector, recombined relation vector, or recombined tail entity vector. For example, if there is a recombined head entity vector of length n, and it is to be equally partitioned into m sub-head entity vectors, then the length of each sub-head entity vector will be n / m. If n is not divisible by m, the length of the last sub-head entity vector may be slightly different, but the lengths of the other sub-vectors will remain equal.
[0117] In this embodiment of the application, the sub-head entity vector group refers to the combination of sub-head entity vectors obtained by equally dividing the recombined head entity vector; the sub-relation vector group refers to the combination of sub-relation vectors obtained by equally dividing the recombined relation vector; and the sub-tail entity vector group refers to the combination of sub-tail entity vectors obtained by equally dividing the recombined tail entity vector.
[0118] The following example uses the triplet and corresponding head entity vector, relation vector, and tail entity vector provided in the above embodiments of this application to illustrate how C3 can be obtained by selecting any two vectors from the head entity vector, relation vector, and tail entity vector. 2 The method of combining different combinations and determining a reconstruction matrix based on each combination is illustrated with examples.
[0119] From the head entity vector |0.2 -0.3 0.5 0.8 -0.1 0.6 -0.4 0.9|, the relation vector |0.7 0.9 0.3 -0.2 0.6 -0.5 0.1 -0.8|, and the tail entity vector |0.4 -0.6 0.8 -0.1 0.3 -0.9 0.7 0.2|, we select the head entity vector |0.2 -0.3 0.5 0.8 -0.1 0.6 -0.4 0.9| and the relation vector |0.7 0.9 0.3 -0.2 0.6 -0.5 0.1 -0.8| as the first combination. Then, we select the head entity vector |0.2 -0.3 0.5 0.8 -0.1 0.6 -0.4 0.9| and the tail entity vector |0.4 -0.6 0.8 -0.1|. 0.3 -0.9 0.7 0.2| is selected as the second combination method, and the relation vector |0.7 0.9 0.3 -0.2 0.6 -0.5 0.1 -0.8| and the tail entity vector |0.4 -0.6 0.8 -0.1 0.3 -0.9 0.7 0.2| are selected as the third combination method.
[0120] Randomly arrange the elements in the head entity vector |0.2 -0.3 0.5 0.8 -0.1 0.6 -0.4 0.9| to obtain the recombined head entity vector |0.9 -0.4 0.5 0.2 0.6 0.8 -0.3 -0.1|; randomly arrange the elements in the relation vector |0.7 0.9 0.3 -0.2 0.6 -0.5 0.1 -0.8| to obtain the recombined relation vector |0.3 -0.8 0.1 -0.5 -0.2 0.6 0.7 0.9|; randomly arrange the elements in the tail entity vector |0.4 -0.6 0.8 -0.1 0.3 -0.9 0.7 0.2| to obtain the recombined tail entity vector |0.8 0.2 -0.6 -0.1 0.3 0.7 0.4 -0.9|.
[0121] The head entity vector, relation vector, and tail entity vector are divided equally. Each vector is divided into two sub-vectors with the same number of elements. The combination of these two sub-vectors is called a sub-vector group. The recombined head entity vector |0.9 -0.4 0.5 0.2 0.6 0.8 -0.3 -0.1| is equally divided to obtain the child head entity vector group, which includes the child head entity vectors |0.9 -0.4 0.5 0.2| and |0.6 0.8 -0.3 -0.1|. The recombined relation vector |0.3 -0.8 0.1 -0.5 -0.2 0.6 0.7 0.9| is equally divided to obtain the child relation vector group, which includes the child relation vectors |0.3 -0.8 0.1 -0.5| and |-0.2 0.6 0.7 0.9|. The recombined tail entity vector |0.8 0.2 -0.6 -0.1 0.3 0.7 0.4| is also equally divided. The -0.9| is divided equally to obtain the child tail entity vector group, which includes the child tail entity vector |0.8 0.2 -0.6 -0.1| and the child tail entity vector |0.3 0.7 0.4 -0.9|.
[0122] Using the sub-head entity vectors |0.9 -0.4 0.5 0.2| and |0.6 0.8 -0.3 -0.1| from the sub-head entity vector group, and the sub-relation vectors |0.3 -0.8 0.1 -0.5| and |-0.2 0.6 0.7 0.9| from the sub-relation vector group, as one-dimensional vectors of the first reconstruction matrix, we obtain the first reconstruction matrix:
[0123]
[0124] In this vector, the first row is the child entity vector |0.9 -0.4 0.5 0.2|, the second row is the child relation vector |0.3 -0.8 0.1 -0.5|, the third row is the child entity vector |0.6 0.8 -0.3-0.1|, and the fourth row is the child relation vector |-0.2 0.6 0.7 0.9|. Any two adjacent one-dimensional vectors belong to different vector groups.
[0125] Using the child head entity vectors |0.9 -0.4 0.5 0.2| and |0.6 0.8 -0.3 -0.1| from the child head entity vector group, and the child tail entity vectors |0.8 0.2 -0.6 -0.1| and |0.3 0.7 0.4 -0.9| from the child tail entity vector group, as one-dimensional vectors of the second reconstruction matrix, we obtain the second reconstruction matrix:
[0126]
[0127] In this vector, the first row is the child head entity vector |0.9 -0.4 0.5 0.2|, the second row is the child tail entity vector |0.8 0.2 -0.6 -0.1|, the third row is the child head entity vector |0.6 0.8 -0.3 -0.1|, and the fourth row is the child tail entity vector |0.3 0.7 0.4 -0.9|. Any two adjacent one-dimensional vectors belong to different vector groups.
[0128] Using the sub-relation vectors |0.3 -0.8 0.1 -0.5| and |-0.2 0.6 0.7 0.9| from the sub-relation vector group, and the sub-tail entity vectors |0.8 0.2 -0.6 -0.1| and |0.3 0.7 0.4 -0.9| from the sub-tail entity vector group, as one-dimensional vectors of the third reconstruction matrix, we obtain the third reconstruction matrix:
[0129]
[0130] In this vector, the first row is a sub-relation vector |0.3 -0.8 0.1 -0.5|, the second row is a sub-tail entity vector |0.8 0.2 -0.6 -0.1|, the third row is a sub-relation vector |-0.2 0.6 0.7 0.9|, and the fourth row is a sub-tail entity vector |0.3 0.7 0.4 -0.9|. Any two adjacent one-dimensional vectors belong to different vector groups.
[0131] This application embodiment randomly rearranges the head entity vector, relation vector, and tail entity vector, which increases the diversity and richness of the data, reduces the interference of the arrangement order of a specific element in the head entity vector, relation vector, and tail entity vector on the model, and improves the robustness of the model. It equally divides the reconstructed head entity vector, reconstructed relation vector, and reconstructed tail entity vector into multiple sub-vectors, and combines different sub-vectors into different reconstruction matrices, ensuring that the sub-vectors in different sub-vector groups are interleaved in the reconstruction matrix. This better captures the interaction features between the head entity vector, reconstructed relation vector, and reconstructed tail entity vector, increasing the model's ability to perceive local features and data interaction features. Based on these and other reasons, the reconstruction matrix determination method provided by this application embodiment significantly improves the verification accuracy of triples in the recommendation system.
[0132] In one embodiment of this application, the feature matrix includes a first feature matrix, a second feature matrix, and a third feature matrix. The step of using a quantum variational convolutional layer to extract features from the reconstructed matrix to obtain the feature matrix includes:
[0133] Quantum variational convolutional layers are used to extract features from the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix, respectively, to obtain a first feature matrix corresponding to the first reconstruction matrix, a second feature matrix corresponding to the second reconstruction matrix, and a third feature matrix corresponding to the third reconstruction matrix.
[0134] See Figure 3 , Figure 3 This is an exemplary schematic diagram of a quantum variational convolution circuit provided in an embodiment of this application. Figure 3 The quantum variational convolution circuit shown includes four qubits and consists of an encoding circuit, an entanglement circuit, a variational circuit, and a measurement layer connected in sequence. The measurement layer is used to measure the quantum state of the qubits to obtain the circuit operation results.
[0135] Figure 3 In the quantum variational convolution circuit shown:
[0136] The encoding circuit includes a Hadamard gate acting on each qubit to transition the qubit from the ground state to the excited state;
[0137] The encoding circuit also includes a first single quantum logic gate RY(θ1) operating on the first qubit, a first single quantum logic gate RY(θ2) operating on the second qubit, a first single quantum logic gate RY(θ3) operating on the third qubit, and a first single quantum logic gate RY(θ4) operating on the fourth qubit; a second single quantum logic gate RZ(θ5) operating on the first qubit, a second single quantum logic gate RZ(θ6) operating on the second qubit, a second single quantum logic gate RZ(θ7) operating on the third qubit, and a second single quantum logic gate RZ(θ7) operating on the fourth qubit. The parameters θ1 of the first single quantum logic gate RY(θ1), θ2 of the first single quantum logic gate RY(θ2), θ3 of the first single quantum logic gate RY(θ3), θ4 of the first single quantum logic gate RY(θ4), θ5 of the second single quantum logic gate RZ(θ5), θ6 of the second single quantum logic gate RZ(θ6), θ7 of the second single quantum logic gate RZ(θ7), and θ8 of the second single quantum logic gate RZ(θ8) are all determined based on one of the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix.
[0138] Taking the first reconstructed matrix provided in the embodiments of this application as an example, the quantum variational convolution circuit can be used to reconstruct submatrices of the first reconstructed matrix. Feature extraction is performed to obtain a portion of the first feature matrix. The parameter θ1 of the first single quantum logic gate RY(θ1) is determined based on the one-dimensional vector |0.9 -0.4| in the first row of the first reconstructed submatrix, θ1 = arctan([0.9,-0.4]); the parameter θ2 of the first single quantum logic gate RY(θ2) is determined based on the one-dimensional vector |0.3 -0.8| in the second row of the first reconstructed submatrix, θ2 = arctan([0.3,-0.8]); the parameter θ3 of the first single quantum logic gate RY(θ3) is determined based on the one-dimensional vector |0.6 0.8| in the third row of the first reconstructed submatrix, θ3 = arctan([0.6,0.8]); the parameter θ4 of the first single quantum logic gate RY(θ4) is determined based on the one-dimensional vector |-0.2 0.6| in the fourth row of the first reconstructed submatrix, θ4 = arctan([-0.2,0.6]).
[0139] The parameter θ5 of the second single quantum logic gate RZ(θ5) is determined based on the one-dimensional vector |0.9 -0.4| in the first row of the first reconstruction matrix submatrix, θ5 = arctan([0.9, -0.4]). 2 The parameter θ6 of the second single quantum logic gate RZ(θ6) is determined based on the one-dimensional vector |0.3 -0.8| in the second row of the first reconstruction matrix submatrix, θ6 = arctan([0.3, -0.8]). 2The parameter θ7 of the second single quantum logic gate RZ(θ7) is determined based on the one-dimensional vector |0.60.8| in the third row of the first reconstructed submatrix, θ7=arctan([0.6,0.8]). 2 The parameter θ8 of the second single quantum logic gate RZ(θ8) is determined based on the one-dimensional vector |-0.2 0.6| in the fourth row of the first reconstruction submatrix, θ8=arctan([-0.2,0.6]). 2 ).
[0140] The entangled circuit includes: a CNOT gate operating on the first and second qubits, wherein the second qubit is the control bit and the first qubit is the controlled bit; a CNOT gate operating on the second and third qubits, wherein the third qubit is the control bit and the second qubit is the controlled bit; a CNOT gate operating on the third and fourth qubits, wherein the fourth qubit is the control bit and the third qubit is the controlled bit; and a CNOT gate operating on the first and fourth qubits, wherein the first qubit is the control bit and the fourth qubit is the controlled bit.
[0141] Entanglement circuits are used to establish entanglement between loaded qubits. Multiple quantum logic gates (CNOT gates) applied to the first and second qubits are used to establish entanglement between them. Similarly, multiple quantum logic gates (CNOT gates) applied to the second and third qubits are used to establish entanglement between them. The same applies to the third and fourth qubits. Finally, multiple quantum logic gates (CNOT gates) applied to the first and fourth qubits are used to establish entanglement between them.
[0142] The variational circuit includes a third single quantum logic gate RX(β1) acting on the first qubit, a third single quantum logic gate RX(β2) acting on the second qubit, a third single quantum logic gate RX(β3) acting on the third qubit, and a third single quantum logic gate RX(β4) acting on the fourth qubit. The parameters β1 of the third single quantum logic gate RX(β1), β2 of the third single quantum logic gate RX(β2), β3 of the third single quantum logic gate RX(β3), and β4 of the third single quantum logic gate RX(β4) are all determined based on training.
[0143] In one embodiment of this application, the quantum variational convolutional layer includes the encoding circuit and at least two loop circuits located after the encoding circuit, the loop circuits including the entanglement circuit and the variational circuit connected in sequence.
[0144] For example, the quantum variational convolutional layer may include an encoding circuit, a first entangled circuit, a first variational circuit, a second entangled circuit, a second variational circuit, a third entangled circuit, a third variational circuit, ..., an Nth entangled circuit, and an Nth variational circuit connected in sequence. The structures of the first entangled circuit, the second entangled circuit, the third entangled circuit, ..., the Nth entangled circuit are all identical to those of the entangled circuit, and the structures of the first variational circuit, the second variational circuit, the third variational circuit, ..., the Nth variational circuit are all identical to those of the variational circuit; the parameters of the first variational circuit, the second variational circuit, the third variational circuit, ..., the Nth variational circuit are all determined based on training.
[0145] It should be noted that the quantum variational convolution circuit provided in this application is only used for feature extraction of a subset of elements of the feature matrix. A quantum variational convolution layer should include multiple quantum variational convolution circuits, each used to extract features from a subset of elements of the feature matrix, thereby collectively completing the feature extraction of the feature matrix. Taking the first feature matrix provided in the embodiment of this application as an example, the quantum variational convolution layer may include three quantum variational convolution circuits, each used to extract features from a subset of the first feature matrix. Feature extraction is then performed. In practical applications, an appropriate number of quantum variational convolution circuits should be selected according to the requirements.
[0146] After extracting features from the first reconstruction matrix provided in this embodiment using a quantum variational convolutional layer, a first feature matrix can be obtained. For example, the first feature matrix can be... After extracting features from the second reconstruction matrix provided in this embodiment using a quantum variational convolutional layer, a second feature matrix can be obtained. For example, the second feature matrix can be... After extracting features from the third reconstruction matrix provided in this embodiment using a quantum variational convolutional layer, a third feature matrix can be obtained. For example, the third feature matrix can be...
[0147] This application provides a quantum variational convolutional layer that extracts features from the reconstructed matrix using a quantum variational convolutional circuit. It leverages the unique properties of quantum computing to better capture the nonlinear and quantum entanglement features within the reconstructed matrix, thereby better uncovering the potential information within it. The quantum variational convolutional circuit includes parametric quantum logic gates, whose parameters can be trained using variational optimization algorithms to maximize model performance. The CNOT gates in the entanglement layer can establish entanglement relationships between qubits, enhancing their interaction and better capturing correlations in the data. For these reasons, the quantum variational convolutional layer provided in this application significantly improves the verification accuracy of triples in recommendation systems.
[0148] In one embodiment of this application, the feature vector includes a first feature vector, a second feature vector, and a third feature vector; the dimensionality reduction of the feature matrix to obtain the feature vector includes:
[0149] The dimensions of the first feature matrix, the second feature matrix, and the third feature matrix are reduced respectively to obtain the first feature vector corresponding to the first feature matrix, the second feature vector corresponding to the second feature matrix, and the third feature vector corresponding to the third feature matrix.
[0150] Taking the first feature matrix, second feature matrix, and third feature matrix provided in the embodiments of this application as examples, the method for reducing the dimensionality of the first feature matrix, second feature matrix, and third feature matrix to obtain the first feature vector corresponding to the first feature matrix, the second feature vector corresponding to the second feature matrix, and the third feature vector corresponding to the third feature matrix can be as follows: Dimensionality reduction of the first feature matrix The first eigenvector is obtained as |0.169-0.598 1.321|; the second eigenvector matrix is obtained after dimensionality reduction. The second eigenvector is obtained as |-0.322 -1.087 0.152|; the third eigenvector matrix is obtained after dimensionality reduction. The third eigenvector is obtained as |0.1021.967 -1.338|.
[0151] In one embodiment of this application, the step of using a fully connected layer to measure the confidence level of the feature vector includes:
[0152] The first feature vector, the second feature vector, and the third feature vector are concatenated to obtain the confidence measurement vector. The confidence measurement vector is then input into the fully connected layer, and the fully connected layer is run.
[0153] Concatenation involves joining the first, second, and third eigenvectors in a specific order to form a longer confidence measurement vector. The concatenation operation does not change the values of the elements in each vector; it merely facilitates merging multiple vectors into a single, unified confidence measurement vector for subsequent confidence measurement operations. The concatenation can be done simply by joining the first, second, and third eigenvectors in sequence, or by adding delimiters or other rules as needed. This application does not impose any restrictions on this approach.
[0154] Taking the first feature vector |0.169 -0.598 1.321|, the second feature vector |-0.322 -1.087 0.152|, and the third feature vector |0.102 1.967 -1.338| provided in the embodiments of this application as an example, after concatenating the first feature vector, the second feature vector, and the third feature vector, the confidence measurement vector |0.169-0.598 1.321-0.322-1.087 0.152 0.102 1.967-1.338| can be obtained.
[0155] In this embodiment, dimensionality reduction of the feature matrix reduces the dimension of the feature space, lowers data complexity and computational complexity, and removes redundant information from the feature matrix, improving model performance. Concatenating the first, second, and third feature vectors allows for comprehensive consideration of the relationships between different features, extracting a more comprehensive and richer feature representation. Inputting the confidence measurement vector into the fully connected layer allows for learning the nonlinear relationships between features, extracting higher-order feature representations from the confidence measurement vector, and obtaining the triple confidence. For these reasons, the dimensionality reduction, concatenation, and confidence measurement methods provided in this embodiment significantly improve the verification accuracy of triples in the recommendation system.
[0156] In one embodiment of this application, determining whether a triplet in the recommendation system is correct based on the triplet confidence score includes:
[0157] If the confidence value of the triple is within a preset range, then the triple of the recommendation system is correct;
[0158] Otherwise, the recommendation system has a triplet error.
[0159] Confidence level is a measure of the degree of trust or credibility in an event or hypothesis. In machine learning, confidence level is typically used to represent the certainty or reliability of a model's predictions. A higher confidence level indicates that the model is more confident in the prediction, while a lower confidence level indicates that the model is more uncertain about the prediction. For example, a model with a confidence level of 0.9 predicting a sample as "A" has 90% confidence that the sample belongs to category "A".
[0160] Triple confidence refers to a measure of the credibility or confidence of a triple in a knowledge graph, that is, a measure of the authenticity or correctness of the triple in the knowledge graph. In the embodiments of this application, triple confidence can be a confidence score, indicating the degree of credibility or confidence of the triple. The range of triple confidence is 0 to 1, where 0 represents unreliable and 1 represents highly reliable.
[0161] In this embodiment, when the triple confidence level is within a preset range, such as 0.9, 0.95, or 0.99, the triple is considered correct; when the triple confidence level is outside the preset range, the triple is considered incorrect. This application does not specifically limit the preset range of triple confidence levels; it should be selected according to actual needs.
[0162] See Figure 4 , Figure 4 This is a flowchart illustrating another method for verifying triples in a recommendation system provided in an embodiment of this application. The following is a schematic diagram of the process. Figure 4 For example, the flow of another recommendation system triple verification method provided in the embodiments of this application will be described:
[0163] Obtain the triples of the knowledge graph of the recommendation system, and obtain the triple vectors corresponding to the triples. The triple vectors include the head entity vector, the relation vector, and the tail entity vector.
[0164] Select any two vectors from the head entity vector, relation vector, and tail entity vector to obtain C3. 2 The combination of triplets of vectors.
[0165] Based on triplet vectors and C3 2 The combination of three-pronged vectors determines the reconstruction matrix.
[0166] The reconstructed matrix is input into a quantum variational convolutional layer, and the quantum variational convolutional layer is run to obtain the feature matrix.
[0167] The dimensionality of the feature matrix is reduced to obtain the feature vectors, and then the feature vectors are concatenated to obtain the confidence measurement vector.
[0168] The confidence measurement vector is input into the fully connected layer, and the fully connected layer is run to obtain the triple confidence.
[0169] Determine whether a triplet is correct based on its confidence level.
[0170] See Figure 5 , Figure 5 This is a flowchart illustrating another method for verifying triples in a recommendation system provided in an embodiment of this application. The following is a schematic diagram of such a method. Figure 5 For example, the flow of another recommendation system triple verification method provided in the embodiments of this application will be described:
[0171] Obtain the triples of the knowledge graph of the recommendation system, and obtain the head entity vector, relation vector, and tail entity vector of the triples.
[0172] Select the head entity vector and the relation vector as the first combination method; select the head entity vector and the tail entity vector as the second combination method; select the relation vector and the tail entity vector as the third combination method.
[0173] The elements in the head entity vector are rearranged randomly to obtain the recombined head entity vector; the elements in the relation vector are rearranged randomly to obtain the recombined relation vector; and the elements in the tail entity vector are rearranged randomly to obtain the recombined tail entity vector.
[0174] The head entity vector is divided and recombined equally to obtain a subhead entity vector group containing multiple subhead entity vectors; the relation vector is divided and recombined equally to obtain a subrelation vector group containing multiple subrelation vectors; the tail entity vector is divided and recombined equally to obtain a subtail entity vector group containing multiple subtail entity vectors.
[0175] The sub-head entity vector in the sub-head entity vector group and the sub-relation vector in the sub-relation vector group are used as one-dimensional vectors in the first reconstruction matrix; the sub-head entity vector in the sub-head entity vector group and the sub-tail entity vector in the sub-tail entity vector group are used as one-dimensional vectors in the second reconstruction matrix; the sub-relation vector in the sub-relation vector group and the sub-tail entity vector in the sub-tail entity vector group are used as one-dimensional vectors in the third reconstruction matrix; and any two adjacent one-dimensional vectors in the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix belong to different vector groups.
[0176] The first reconstruction matrix is input into each quantum variational convolution circuit corresponding to the quantum variational convolutional layer, and the quantum variational convolution circuit is run to obtain the first feature matrix; the second reconstruction matrix is input into each quantum variational convolution circuit corresponding to the quantum variational convolutional layer, and the quantum variational convolution circuit is run to obtain the second feature matrix; the third reconstruction matrix is input into each quantum variational convolution circuit corresponding to the quantum variational convolutional layer, and the quantum variational convolution circuit is run to obtain the third feature matrix.
[0177] The first feature matrix, the second feature matrix, and the third feature matrix are reduced in dimension to obtain the corresponding first feature vector, second feature vector, and third feature vector. The first feature vector, the second feature vector, and the third feature vector are concatenated to obtain the confidence measurement vector.
[0178] The confidence measurement vector is input into the quantum variational fully connected layer, and the quantum variational fully connected layer is run to obtain the triple confidence. If the triple confidence value is within the preset range, the triple is correct; otherwise, the triple is incorrect.
[0179] See Figure 6 , Figure 6 This is a schematic diagram of the structure of a triplet verification device for a recommendation system provided in an embodiment of this application. Figure 2 Corresponding to the process shown, the apparatus includes:
[0180] Reconstruction module 601 is used to select any two vectors from the head entity vector, relation vector, and tail entity vector of the recommender system triple to obtain C3. 2 Each combination method, and a reconstruction matrix determined for each combination method;
[0181] The feature extraction and dimensionality reduction module 602 is used to extract features from the reconstructed matrix using a quantum variational convolutional layer to obtain a feature matrix, and to reduce the dimensionality of the feature matrix to obtain a feature vector.
[0182] The confidence measurement module 603 is used to measure the confidence of the feature vector using a fully connected layer to obtain the confidence of the triples;
[0183] The confirmation module 604 is used to determine whether the triples in the recommendation system are correct based on the confidence level of the triples.
[0184] Optionally, the quantum circuit corresponding to the quantum variational convolutional layer includes an encoding circuit, an entanglement circuit, and a variational circuit. The encoding circuit is used to load the reconstruction matrix onto the qubits, the variational circuit is used to establish entanglement between the loaded qubits, and the variational circuit is used to perform variational quantum encoding on the entangled qubits.
[0185] Optionally, the encoding circuit includes a first single quantum logic gate and a second single quantum logic gate acting on each qubit, the entanglement circuit includes a multi-quantum logic gate acting on multiple qubits, and the variational circuit includes a third single quantum logic gate acting on each qubit. The parameters of the first and second single quantum logic gates are determined based on the reconstruction matrix, and the parameters of the third single quantum logic gate are determined based on training.
[0186] Optionally, C3 is obtained by selecting any two vectors from the head entity vector, relation vector, and tail entity vector. 2 There are several combination methods, and a reconstruction matrix is determined for each combination method, including:
[0187] From the head entity vector, relation vector, and tail entity vector: select the head entity vector and relation vector to obtain the first combination method; select the head entity vector and tail entity vector to obtain the second combination method; select the relation vector and tail entity vector to obtain the third combination method.
[0188] The first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix are determined based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method.
[0189] Optionally, determining the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method includes:
[0190] The elements in the head entity vector, relation vector, and tail entity vector are randomly arranged to obtain the corresponding recombined head entity vector, recombined relation vector, and recombined tail entity vector.
[0191] The recombined head entity vector, recombined relation vector, and recombined tail entity vector are each equally divided to obtain the corresponding sub-head entity vector group, sub-relation vector group, and sub-tail entity vector group.
[0192] The vectors in the sub-head entity vector group and the sub-relation vector group are used as one-dimensional vectors in the first reconstruction matrix, the vectors in the sub-head entity vector group and the sub-tail entity vector group are used as one-dimensional vectors in the second reconstruction matrix, and the vectors in the sub-relation vector group and the sub-tail entity vector group are used as one-dimensional vectors in the third reconstruction matrix, such that any two adjacent one-dimensional vectors in the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix belong to different vector groups.
[0193] Optionally, the feature matrix includes a first feature matrix, a second feature matrix, and a third feature matrix. The step of using a quantum variational convolutional layer to extract features from the reconstructed matrix to obtain the feature matrix includes:
[0194] Quantum variational convolutional layers are used to extract features from the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix, respectively, to obtain a first feature matrix corresponding to the first reconstruction matrix, a second feature matrix corresponding to the second reconstruction matrix, and a third feature matrix corresponding to the third reconstruction matrix.
[0195] Optionally, the feature vector includes a first feature vector, a second feature vector, and a third feature vector, and the dimensionality reduction of the feature matrix to obtain the feature vector includes:
[0196] The dimensions of the first feature matrix, the second feature matrix, and the third feature matrix are reduced respectively to obtain the first feature vector corresponding to the first feature matrix, the second feature vector corresponding to the second feature matrix, and the third feature vector corresponding to the third feature matrix.
[0197] Optionally, the step of using a fully connected layer to measure the confidence level of the feature vector includes:
[0198] The first feature vector, the second feature vector, and the third feature vector are concatenated to obtain the confidence measurement vector. The confidence measurement vector is then input into the fully connected layer, and the fully connected layer is run.
[0199] Optionally, determining whether the triples in the recommendation system are correct based on the triple confidence score includes:
[0200] If the confidence value of the triple is within a preset range, then the triple of the recommendation system is correct;
[0201] Otherwise, the recommendation system has a triplet error.
[0202] See Figure 7 , Figure 7 A flowchart illustrating a method for expanding a knowledge graph in a recommendation system, provided in an embodiment of this application, may include the following steps:
[0203] S701, obtain the triplet to be expanded;
[0204] Triples to be expanded refer to triples that need to be verified for correctness during the expansion of the recommender system's knowledge graph. Their correctness determines whether they should be added to the recommender system's knowledge graph. Triples to be expanded may be missing from the recommender system's knowledge graph or may be incorrect; they need to be verified before it can be determined whether they should be added.
[0205] S702, verify whether the triplet to be expanded is correct according to the method provided in the above embodiments of this application;
[0206] S703, if the triple to be expanded is correct, expand the triple to be expanded into the knowledge graph of the recommendation system.
[0207] In one embodiment of this application, if the triple to be expanded is incorrect, the triple to be expanded will not be expanded into the recommendation system knowledge graph.
[0208] This application also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0209] Specifically, in this embodiment, the storage medium may include, but is not limited to, USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks, and other media capable of storing computer programs.
[0210] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the method embodiments described above.
[0211] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.
[0212] Specifically, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0213] S11, select any two vectors from the head entity vector, relation vector, and tail entity vector of the recommender system triples to obtain C3. 2 Each combination method, and a reconstruction matrix determined for each combination method;
[0214] S12, use a quantum variational convolutional layer to extract features from the reconstructed matrix to obtain a feature matrix, and reduce the dimensionality of the feature matrix to obtain a feature vector;
[0215] S13, use a fully connected layer to measure the confidence of the feature vector to obtain the triple confidence;
[0216] S14, determine whether the triplet in the recommendation system is correct based on the confidence level of the triplet.
[0217] Specifically, the specific examples in this embodiment can be referred to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0218] Specifically, in this embodiment, the processor can also be configured to perform the following steps via a computer program:
[0219] S21, obtain the triplet to be expanded;
[0220] S22, determine whether the triplet is correct according to the method provided in the above embodiments of this application;
[0221] S23, if the triple to be expanded is correct, expand the triple to be expanded into the knowledge graph of the recommendation system.
[0222] Specifically, the specific examples in this embodiment can be referred to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0223] The above description, based on the embodiments shown in the drawings, details the structure, features, and effects of this application. The above description is only a preferred embodiment of this application, but this application does not limit the scope of implementation to what is shown in the drawings. Any changes made in accordance with the concept of this application, or modifications to equivalent embodiments, that do not exceed the spirit covered by the specification and drawings, should be within the protection scope of this application.
Claims
1. A method for verifying triples in a recommendation system, characterized in that, The method includes: From the head entity vector, relation vector, and tail entity vector of the recommender system triple, select any two vectors to obtain Each combination method, and a reconstruction matrix determined for each combination method; The reconstructed matrix is feature-extracted using a quantum variational convolutional layer to obtain a feature matrix, and then the feature matrix is dimensionality-reduced to obtain a feature vector. The quantum circuit corresponding to the quantum variational convolutional layer includes an encoding circuit, an entanglement circuit, and a variational circuit. The encoding circuit includes a first single quantum logic gate and a second single quantum logic gate acting on each qubit to load the reconstructed matrix onto the qubit. The variational circuit includes a third single quantum logic gate acting on each qubit to establish entanglement between the loaded qubits. The variational circuit also includes a third single quantum logic gate acting on each qubit to perform variational quantum encoding on the entangled qubits. The feature vectors are concatenated and a fully connected layer is used to measure the confidence level to obtain the triple confidence level. The system determines whether the triples in the recommendation system are correct based on the confidence level of the triples.
2. The method as described in claim 1, characterized in that, The parameters of the first and second single quantum logic gates are determined based on the reconstruction matrix, and the parameters of the third single quantum logic gate are determined based on training.
3. The method as described in claim 1, characterized in that, Select any two vectors from the head entity vector, relation vector, and tail entity vector to obtain There are several combination methods, and a reconstruction matrix is determined for each combination method, including: From the head entity vector, relation vector, and tail entity vector: select the head entity vector and relation vector to obtain the first combination method; select the head entity vector and tail entity vector to obtain the second combination method; select the relation vector and tail entity vector to obtain the third combination method. The first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix are determined based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method.
4. The method as described in claim 3, characterized in that, The determination of the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix based on the head entity vector, the relation vector, the tail entity vector, and the first combination method, the second combination method, and the third combination method includes: The elements in the head entity vector, relation vector, and tail entity vector are randomly arranged to obtain the corresponding recombined head entity vector, recombined relation vector, and recombined tail entity vector. The recombined head entity vector, recombined relation vector, and recombined tail entity vector are each equally divided to obtain the corresponding sub-head entity vector group, sub-relation vector group, and sub-tail entity vector group. The vectors in the sub-head entity vector group and the sub-relation vector group are used as one-dimensional vectors in the first reconstruction matrix, the vectors in the sub-head entity vector group and the sub-tail entity vector group are used as one-dimensional vectors in the second reconstruction matrix, and the vectors in the sub-relation vector group and the sub-tail entity vector group are used as one-dimensional vectors in the third reconstruction matrix, such that any two adjacent one-dimensional vectors in the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix belong to different vector groups.
5. The method as described in claim 3 or 4, characterized in that, The feature matrix includes a first feature matrix, a second feature matrix, and a third feature matrix. The feature matrix is obtained by using a quantum variational convolutional layer to extract features from the reconstructed matrix, including: Quantum variational convolutional layers are used to extract features from the first reconstruction matrix, the second reconstruction matrix, and the third reconstruction matrix, respectively, to obtain a first feature matrix corresponding to the first reconstruction matrix, a second feature matrix corresponding to the second reconstruction matrix, and a third feature matrix corresponding to the third reconstruction matrix.
6. The method as described in claim 5, characterized in that, The feature vectors include a first feature vector, a second feature vector, and a third feature vector. The dimensionality reduction of the feature matrix to obtain the feature vectors includes: The dimensions of the first feature matrix, the second feature matrix, and the third feature matrix are reduced respectively to obtain the first feature vector corresponding to the first feature matrix, the second feature vector corresponding to the second feature matrix, and the third feature vector corresponding to the third feature matrix.
7. The method as described in claim 6, characterized in that, The process of concatenating the feature vectors and using a fully connected layer to measure confidence yields the triple confidence score, including: The first feature vector, the second feature vector, and the third feature vector are concatenated to obtain the confidence measurement vector. The confidence measurement vector is then input into the fully connected layer, and the fully connected layer is run to obtain the triple confidence.
8. The method as described in claim 1, characterized in that, The step of determining whether the triples in the recommendation system are correct based on the triple confidence score includes: If the confidence value of the triple is within a preset range, then the triple of the recommendation system is correct; Otherwise, the recommendation system has a triplet error.
9. A verification device for triples in a recommendation system, characterized in that, The device includes: The reconstruction module is used to select any two vectors from the head entity vector, relation vector, and tail entity vector of the recommender system triples to obtain... Each combination method, and a reconstruction matrix determined for each combination method; The feature extraction and dimensionality reduction module is used to extract features from the reconstructed matrix using a quantum variational convolutional layer to obtain a feature matrix, and then reduce the dimensionality of the feature matrix to obtain a feature vector. The quantum circuit corresponding to the quantum variational convolutional layer includes an encoding circuit, an entanglement circuit, and a variational circuit. The encoding circuit includes a first single quantum logic gate and a second single quantum logic gate acting on each quantum bit, used to load the reconstructed matrix onto the quantum bit. The variational circuit includes a third single quantum logic gate acting on each quantum bit, used to establish entanglement between the loaded quantum bits. The variational circuit also includes a third single quantum logic gate acting on each quantum bit, used to perform variational quantum encoding on the entangled quantum bits. The confidence measurement module is used to concatenate the feature vectors and use a fully connected layer to measure the confidence of the triples. The confirmation module is used to determine whether the triples in the recommendation system are correct based on the confidence level of the triples.
10. A method for expanding a knowledge graph in a recommendation system, characterized in that, The method includes: Get the triples to be expanded; The method described in any one of claims 1-8 determines whether the triplet is correct; If the triple to be expanded is correct, the triple to be expanded is added to the knowledge graph of the recommendation system.
11. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1-8 or 10 when it is run.
12. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method described in any one of claims 1-8 or 10.
Citation Information
Patent Citations
Text classification method and device, storage medium and electronic device
CN116431807A
Complex system prediction method and device, storage medium and electronic device
CN116484731A