A collaborative filtering method and system based on logic box embedding reasoning
By using a collaborative filtering method with logical box embedding reasoning, the problem of data sparsity in collaborative filtering for new users and new products is solved, achieving a high-efficiency improvement in recommendation performance and integrating logical reasoning and data matching capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIVERSITY SHANGYU INSTITUTE OF SCIENCE & ENGINEERING CO LTD
- Filing Date
- 2023-03-17
- Publication Date
- 2026-05-01
AI Technical Summary
Existing collaborative filtering recommendation algorithms perform poorly with new users or new products, require a large amount of user behavior data, and lack logical reasoning capabilities.
A collaborative filtering method based on logical box embedding reasoning is adopted. By collecting user and item behavior interaction information, user interaction sequences and rating sequences are generated, a logical computation graph is constructed, and logical reasoning is performed using box embedding and relation vector embedding. The distance between the target item's box embedding and the nearest item is calculated for recommendation.
It improves recommendation performance, alleviates the problem of sparse data, maintains data matching ability, and gains cognitive reasoning ability, making it suitable for recommendations of new users and new products.
Smart Images

Figure CN116304370B_ABST
Abstract
Description
A Collaborative Filtering Method and System Based on Logical Box Embedded Reasoning Technical Field
[0001] This invention relates to the field of artificial intelligence recommendation technology, specifically to a collaborative filtering method and system based on logic box embedding reasoning. Background Technology
[0002] In recent years, the application of deep neural networks has achieved tremendous success, driving the rapid development of artificial intelligence. However, deep neural networks still have some limitations. Generally speaking, how deep neural networks learn, what algorithms they use to achieve intelligence, and what theoretical analyses they are based on to draw conclusions are not explicitly or symbolically represented in the network architecture. Turing Award winner Bengio proposed that the human cognitive system consists of two subsystems: an intuitive system and a logical analysis system. The former enables rapid, unconscious, and non-verbal cognition, which is what current deep neural networks achieve. He believes that deep neural networks should be able to realize a logical analysis system, achieving a conscious, logical, planned, reasoning-capable system that can be expressed verbally.
[0003] Currently, mainstream recommendation algorithms are primarily based on collaborative filtering, a method that generates recommendations based on user behavior data. It predicts a user's preference for products by analyzing a large amount of historical user behavior data. There are two common implementations of collaborative filtering: user-based collaborative filtering and product-based collaborative filtering. User-based collaborative filtering identifies users with similar interests to the target user and then recommends products liked by these users to the target user. Product-based collaborative filtering identifies products similar to the target product and then recommends them to users who like the target product. Collaborative filtering can handle large-scale data and extract valuable information from users' historical behavior. However, collaborative filtering has a fatal flaw: it requires a large amount of user behavior data to generate meaningful recommendations, and it performs poorly for new users or new products.
[0004] Logical reasoning is a knowledge-based method that infers new knowledge by reasoning from existing knowledge. Logical reasoning does not require large amounts of user or product data; it only needs to reason about existing user-product interactions to generate meaningful recommendations.
[0005] Logical reasoning readily utilizes rule-based knowledge, while machine learning readily utilizes data facts. From a human decision-making perspective, it is typically necessary to combine knowledge and facts to solve problems. Researching a unified framework that can integrate machine learning and logical reasoning and enable them to work together is considered the holy grail challenge of artificial intelligence. Summary of the Invention
[0006] This invention addresses the shortcomings of existing technologies by proposing a collaborative filtering method and system based on logical box embedding reasoning. This method effectively integrates collaborative filtering and logical reasoning recommendation algorithm frameworks, significantly improving recommendation performance and providing new ideas for subsequent engineering applications.
[0007] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0008] A collaborative filtering method based on logical box embedding reasoning includes the following steps:
[0009] S1. Collect raw data and create a dataset, wherein the raw data includes behavioral interaction information between users and projects;
[0010] S2. First, clean the raw data, and then use a sequence construction algorithm to generate user interaction sequences and rating sequences of a specified length.
[0011] S3, Step 3: The user interaction sequence and the rating sequence are connected to the user interaction events through logical operators to generate a first-order logical query, and then a logical computation graph is constructed.
[0012] S4. Generate multiple item box embeddings from the user interaction sequence using a box embedding generation algorithm. Generate multiple relation vector embeddings from the rating sequence based on the user interaction behavior and rating in the logical computation graph.
[0013] S5. Item box embedding and relation vector embedding are calculated based on the logic computation graph to obtain a target item box embedding.
[0014] S6. Calculate the distance between the target item box embedding and the nearest item box embedding, and select the nearest n items as the most suitable items to recommend to the current user.
[0015] Preferably, in step S1, the behavioral interaction information between the user and the project is online rating and review data in the relevant field.
[0016] As a preferred method, the raw data cleaning method in step S2 is as follows: first, users and items with too little interaction are removed, and then the user rating information is classified.
[0017] Preferably, in step S2, a user interaction sequence and a rating sequence are generated based on the user's historical records and the categorized rating information.
[0018] Preferably, the item box embedding generated in step S4 has a center point vector and an offset vector.
[0019] Preferably, in step S5, the method for calculating the target item box embedding is: to calculate it using three logical reasoning operators: projection operator, intersection operator, and translation operator.
[0020] Preferably, in step S6, the distance between the target item box embedding and the nearest item box embedding is calculated, specifically divided into in-box distance and out-of-box distance.
[0021] This invention also provides a collaborative filtering system based on logic box embedded reasoning, comprising:
[0022] The data acquisition module is used to collect raw data in the relevant field, including behavioral interaction information between users and projects;
[0023] The data cleaning module is used to clean and process the raw data.
[0024] The sequence construction module is used to generate user interaction sequences and rating sequences of a specified length from the cleaned data.
[0025] The computation graph generation module is used to generate a logical computation graph based on user interaction sequences and rating sequences.
[0026] The box embedding module is used to generate multiple item box embeddings based on user interaction sequences;
[0027] The relation box embedding module is used to generate multiple relation vector embeddings based on the scoring sequence;
[0028] The logic reasoning module is used to apply item box embedding and relation vector embedding to obtain a target item box embedding based on the logic computation graph.
[0029] The box retrieval module is used to retrieve the box embeddings of the projects closest to the target project, and selects the n closest projects as the most suitable projects to recommend to the current user.
[0030] This invention has the following characteristics and beneficial effects:
[0031] This invention integrates logical reasoning technology into collaborative filtering. Logical reasoning is a knowledge-based method that infers new knowledge by reasoning from existing knowledge. Logical reasoning does not require large amounts of user and product data; it only needs to reason about existing user-product interactions to generate meaningful recommendations. Therefore, it not only alleviates the performance problems of collaborative filtering with sparse and new data, but also maintains the model's data matching ability and gains cognitive reasoning capabilities.
[0032] In addition, logical reasoning can easily utilize rule-based knowledge, while machine learning can easily utilize data facts. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 is a flowchart of the collaborative filtering method and system based on logic box embedding reasoning according to an embodiment of the present invention;
[0035] Figure 2 is a schematic diagram of the specific process steps of the collaborative filtering method and system based on logic box embedded reasoning according to an embodiment of the present invention;
[0036] Figure 3 is a schematic diagram of the logic calculation graph generated based on first-order logic query according to an embodiment of the present invention;
[0037] Figure 4 is a schematic diagram of the logical reasoning process of the collaborative filtering method based on logical box embedding reasoning according to an embodiment of the present invention;
[0038] Figure 5 shows the logical reasoning architecture of the collaborative filtering method based on logical box embedding reasoning in an embodiment of the present invention.
[0039] Figure 6 is a schematic diagram of the modules of the collaborative filtering system based on logic box embedded reasoning according to an embodiment of the present invention. Detailed Implementation
[0040] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the embodiments of this invention will be described in further detail below with reference to the accompanying drawings.
[0042] This embodiment provides a collaborative filtering method based on logical box embedding reasoning, as shown in Figures 1-5, including the following steps:
[0043] Step 1: By crawling movie rating data from Douban, we obtained 400,000 reviews and ratings from 60,000 users on 140,000 movies.
[0044] Step Two: The data cleaning module first removes users and items with interactions less than k from the dataset. Then, it performs binary classification on user ratings, primarily into negative and positive ratings. The specific classification rule is: if the maximum score in the current dataset is c, then for all users, ratings greater than three-fifths of c are classified as positive ratings, and the remainder are classified as negative ratings. The sequence construction module takes the cleaned data as input and generates user interaction sequences and rating sequences based on timestamps. For example, for the following user data:
[0045] Example of Douban movie rating data
[0046] User ID | Item ID | Rating | Timestamp | User 001 | Movie 003 | Positive Moment 0001 | User 001 | Movie 006 | Negative Moment 0015 | User 001 | Movie Product 015 | Positive Moment 0600 surface
[0047] Table 1
[0048] Generate the following sequence information for user 001:
[0049] User 001's historical sequence: <Movie 003, Movie 006, Movie 015>
[0050] User 001's rating sequence: <Positive, Negative, Positive>
[0051] Step 3: The logical operators mentioned in the logical computation graph module include logical existence. Logical operators such as logical conjunction (∨) and logical disjunction (∧) connect user history sequences and rating sequences to generate first-order logical queries. For example, to determine what movie user 001 will watch, the following first-order logical query q can be generated:
[0052]
[0053] Let V represent the set of users who have watched movies 003, 006, and 015 in the current rating sequence. What other movies would they watch next?
[0054] Based on the first-order logical query q, a logical computation graph is constructed, as shown in Figure 3. Specifically, users and products are represented as nodes in the computation graph, interactive behaviors are represented as relationships in the computation graph, and the final derivation result of the computation graph is used as the answer to the logical query q.
[0055] Step 4: The box embedding generation module constructs user history box embeddings based on the user's historical sequence. This consists of two parts. First, a learnable embedding vector query matrix represents the center vector of the user history box embedding. Initially, the offset vector of the user history box embedding is 0, representing a specific item embedding rather than a set. Second, since the user history sequence implicitly contains chronological information, the box embedding generation module adds a rotational position embedding to the center vector. It uses a rotation matrix to encode absolute position information and integrates the displayed relative positional dependencies into subsequent self-attention. Through rotational position embedding, different historical box embeddings of the same user have different positional information. The relationship embedding module also includes a learnable embedding vector query matrix. Based on the user's historical rating sequence and user interaction behavior, it constructs various relationship vectors, specifically three types: movie viewed negatively, movie viewed positively, and user viewed positively.
[0056] Step 5: The logic reasoning module performs logical reasoning on the input user history box embedding and relation vector based on the logic computation graph. A schematic diagram of the logical reasoning process is shown in Figure 4. First, we introduce the three logical operators involved in the reasoning process:
[0057] Projection operator: Projects an initial box embedding with an initial offset of 0 and containing only a single item into a set of box embeddings with a certain volume, representing the set of users who have purchased the initial box embedding item.
[0058] Intersection Operator: Based on an attention mechanism, this operator performs logical disjunction operations on multiple box embeddings to model user interests. Specifically, firstly, the center vectors of multiple box embeddings are fused using a self-attention mechanism to obtain the center vector of the intersection box embedding. Secondly, the offset vector of the intersection box embedding is calculated based on Deep Sets, a deep architecture with invariant representation, integrating the offsets between box embeddings. Finally, the center vector and offset vector of the intersection box embedding are obtained. The specific calculations of the two parts are as follows: Cen and Off represent the center vector and offset vector, respectively; MLP is a multilayer perceptron; u inter Intersection box
[0059]
[0060] Off(u inter ) = Min({Off(u1), ... Off(u) ) n )})⊙DeepSets({N1,...u n})
[0061] Translation operator: A translation-based process for transferring the position and volume of box embeddings. Specifically, the translation operator performs translation transfer on the box embeddings based on the relation vector, and calculates the translated box embedding center vector and offset vector.
[0062] The specific process is as follows: the multiple historical box embeddings and relation embeddings obtained in step four are mapped to multiple user set boxes through the projection operator, and then the multiple user set boxes are subjected to logical disjunction operation through the intersection operator to obtain a user interest box. The translation operator then transfers the interest box through the relation vector to finally obtain a target item box embedding containing a set of items that the user may purchase.
[0063] Step Six: The box retrieval module searches for the nearest item boxes as recommendations. Specifically, it retrieves all items in the item list and calculates the box distance between each item and the target item box to obtain the closest items. This can be divided into two parts:
[0064] Intra-box distance: The Manhattan distance between the center point of the predicted item's box embedding and the target item's box embedding;
[0065] Box-outside distance: The Manhattan distance between the predicted project and the target project's box embedding perimeter;
[0066] The final box distance representation is obtained by weighted summing of the in-box and out-of-box distances. The nearest n predicted items are then used as recommendations for the user.
[0067] To verify the effectiveness, this invention additionally selected several publicly available datasets for experimental demonstration, including the Amazon e-commerce dataset, the Amazon Movies & TV dataset, and the MovieLens movie rating dataset.
[0068] Experimental Data Table
[0069] ndcg@5ndcg@10hit@5hit@10 Amazon dataset 10.4049 0.4455 0.5364 0.6619 Amazon dataset 20.4835 0.5230 0.6244 0.7465 movielens dataset 0.5391 0.5773 0.6957 0.8134 surface
[0070] Table 2
[0071] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention, but it should not be construed as limiting the specific implementation of the invention to these descriptions. Finally, through the presentation and analysis of experimental results, the present invention effectively integrates logical reasoning and collaborative filtering, thereby improving recommendation performance.
[0072] This embodiment also provides a collaborative filtering system based on logic box embedded reasoning, as shown in Figure 6, including:
[0073] The data acquisition module is used to collect raw data in the relevant field, including behavioral interaction information between users and projects;
[0074] The data cleaning module is used to clean and process the raw data.
[0075] The sequence construction module is used to generate user interaction sequences and rating sequences of a specified length from the cleaned data.
[0076] The computation graph generation module is used to generate a logical computation graph based on user interaction sequences and rating sequences.
[0077] The box embedding module is used to generate multiple item box embeddings based on user interaction sequences;
[0078] The relation box embedding module is used to generate multiple relation vector embeddings based on the scoring sequence;
[0079] The logic reasoning module is used to apply item box embedding and relation vector embedding to obtain a target item box embedding based on the logic computation graph.
[0080] The box retrieval module is used to retrieve the box embeddings of the projects closest to the target project, and selects the n closest projects as the most suitable projects to recommend to the current user.
[0081] In this embodiment, the relevant domain dataset mainly includes movie rating and review data from Douban users.
[0082] Furthermore, the data cleaning module first removes users and items with insufficient interaction, and then classifies the user rating information; the sequence construction module generates user interaction sequences and rating sequences through user history records and classified rating information.
[0083] Furthermore, the logic computation graph module refers to connecting user interaction events through logical operators to generate first-order logical queries and then constructing a computation graph.
[0084] Furthermore, the box embedding module generates a box embedding with a center point vector and an offset vector, and the relation embedding module generates various relation vectors based on user interaction behavior and ratings in the computation graph.
[0085] Furthermore, the logical reasoning module mainly includes three logical reasoning operators: projection operator, intersection operator, and translation operator. The reasoning process combines these three logical operators to generate the final target item box embedding.
[0086] Furthermore, the box retrieval module calculates the distance between box pairs, specifically the in-box distance and the out-of-box distance, and finally obtains the nearest item as the recommended content for the user.
[0087] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments, including components, without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.
Claims
1. A collaborative filtering method based on logic box embedding reasoning, characterized in that, The process includes the following steps: S1. Collect raw data and create a dataset, wherein the raw data includes behavioral interaction information between users and items; S2. First, clean the raw data, and then generate user interaction sequences and rating sequences of a specified length through a sequence construction algorithm block; S3. Connect user interaction events with user interaction sequences and rating sequences through logical operators to generate first-order logical queries, and then construct a logical computation graph to generate a logical computation graph. The method for generating a logical computation graph based on a first-order logical query q is as follows: users and products are represented as nodes in the computation graph, interactive behaviors are represented as relationships in the computation graph, and the final derivation result of the computation graph is used as the answer to the logical query q. S4. Generate multiple item box embeddings from the user interaction sequence using a box embedding generation algorithm. Generate multiple relation vector embeddings from the rating sequence based on the user interaction behavior and rating in the logical computation graph. S5. Calculate a target item box embedding from the item box embeddings and relation vector embeddings based on the logical computation graph. The specific process is as follows: multiple item box embeddings and relation embeddings are mapped to multiple user set boxes through the projection operator, and then the multiple user set boxes are subjected to logical disjunction operation through the intersection operator to obtain a user interest box. The translation operator then transfers the interest box through the relation vector to finally obtain a target item box embedding containing a set of items that the user may purchase. S6. Calculate the distance between the target item box embedding and the nearest item box embedding, and select the nearest n items as the most suitable items to recommend to the current user.
2. The collaborative filtering method based on logical box embedding reasoning according to claim 1, characterized in that, In step S1, the behavioral interaction information between the user and the project is online rating and review data in the relevant field.
3. The collaborative filtering method based on logical box embedding reasoning according to claim 1, characterized in that, The method for cleaning the raw data in step S2 is as follows: first, users and items with too little interaction are removed; second, the user rating information is classified.
4. The collaborative filtering method based on logical box embedding reasoning according to claim 3, characterized in that, In step S2, user interaction sequences and rating sequences are generated based on user history records and categorized rating information.
5. The collaborative filtering method based on logical box embedding reasoning according to claim 1, characterized in that, The project box embedding generated in step S4 has a center point vector and an offset vector.
6. The collaborative filtering method based on logical box embedding reasoning according to claim 1, characterized in that, In step S5, the method for calculating the target item box embedding is as follows: it is calculated using three logical reasoning operators: projection operator, intersection operator, and translation operator.
7. The collaborative filtering method based on logical box embedding reasoning according to claim 1, characterized in that, In step S6, the distance between the target item box embedding and the nearest item box embedding is calculated, specifically divided into in-box distance and out-of-box distance.
8. A system for implementing the collaborative filtering method based on logic box embedding reasoning as described in any one of claims 1-7, characterized in that, It includes a data acquisition module for collecting raw data in the relevant field, the raw data including behavioral interaction information between users and projects; The data cleaning module is used to clean and process the raw data. The sequence construction module is used to generate user interaction sequences and rating sequences of a specified length from the cleaned data. The computation graph generation module is used to generate a logical computation graph based on user interaction sequences and rating sequences. The box embedding module is used to generate multiple item box embeddings based on user interaction sequences; The relation box embedding module is used to generate multiple relation vector embeddings based on the scoring sequence; The logic reasoning module is used to apply item box embedding and relation vector embedding to obtain a target item box embedding based on the logic computation graph. The box retrieval module is used to retrieve the box embeddings of the projects closest to the target project, and selects the n closest projects as the most suitable projects to recommend to the current user.
Citation Information
Patent Citations
Knowledge graph multi-hop reasoning method and device based on vector logic
CN115269799A
Knowledge question and answer method and device, electronic equipment and readable storage medium
CN115618011A