Recommendation method, device, computer equipment and storage medium based on knowledge graph

By obtaining user historical behavior data and knowledge graphs, selecting and configuring weights, we solved the problem of inaccurate search results in the open source community and achieved efficient and accurate project recommendations.

CN117150107BActive Publication Date: 2025-09-26GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310980822.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-04
Publication Date
2025-09-26
Estimated Expiration
2043-08-04

AI Technical Summary

Technical Problem

In the open source community, when developers and users search for projects, the search results are inaccurate due to information fragmentation and differences in organization methods, and they need to spend a lot of time on multiple searches and repeated reviews.

Method used

By obtaining the historical behavior data and knowledge graph of the target user, candidate items whose browsing time is later than the preset time are selected, the weights are configured, and queries are performed in the knowledge graph based on the item identifier to obtain recommendation results.

Benefits of technology

It improves retrieval efficiency and accuracy, saves retrieval time, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117150107B_ABST
    Figure CN117150107B_ABST
Patent Text Reader

Abstract

The present application relates to the field of knowledge graph technology, and discloses a recommendation method, apparatus, computer equipment, and storage medium based on knowledge graphs. The method comprises: obtaining historical behavior data and a knowledge graph of a target user; selecting each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item; configuring the weight of the candidate item according to the browsing time of the candidate item and a preset weight configuration rule, and determining at least one target item from each candidate item according to the weight of each candidate item; and querying the knowledge graph according to the item identifier of each target item to obtain a recommendation result. It is possible to query the knowledge graph for items that meet the user's recent needs and obtain a recommendation result, so that when the user searches for the required item, he can search according to the recommendation result, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge graph technology, and in particular to a recommendation method, device, computer equipment and storage medium based on knowledge graph. Background Art

[0002] The open source community has abundant software resources, but since the information of each project is managed and maintained by its owner, the data contained in it still conforms to the "fragmented and disordered" characteristics of native resources on the Internet, and the information organization methods between different projects vary greatly.

[0003] At the same time, these messy text information makes the search results of developers and users often inaccurate when searching for projects. Users can only perform multiple searches and repeatedly check the project content, which results in a lot of browsing time and search time. Summary of the Invention

[0004] Based on this, it is necessary to address the technical problem that when users of the existing technology search for the required items, the accuracy of the retrieval results is low, and a recommendation method, device, computer equipment and storage medium based on knowledge graph are proposed.

[0005] In a first aspect, a recommendation method based on a knowledge graph is provided, the method comprising:

[0006] Obtaining historical behavior data and a knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item;

[0007] Selecting, from among the browsing items, each browsing item whose browsing time is later than a preset time as a candidate item;

[0008] configuring the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and determining at least one target item from each of the candidate items according to the weight of each candidate item;

[0009] According to the project identification of each target project, a query is performed in the knowledge graph to obtain recommendation results.

[0010] In a second aspect, a recommendation device based on a knowledge graph is provided, the device comprising:

[0011] An acquisition module is used to acquire the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item;

[0012] a selection module, configured to select, from among the browsing items, each browsing item whose browsing time is later than a preset time, as a candidate item;

[0013] a determination module, configured to configure the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and to determine at least one target item from each of the candidate items according to the weight of each candidate item;

[0014] The query module is used to query the knowledge graph according to the project identification of each target project to obtain recommendation results.

[0015] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned knowledge graph-based recommendation method when executing the computer program.

[0016] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned knowledge graph-based recommendation method are implemented.

[0017] The knowledge graph-based recommendation method proposed in the present invention obtains the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item, and then selects each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item, and then configures the weight of the candidate item according to the browsing time of the candidate item and the preset weight configuration rule, and determines at least one target item from each candidate item according to the weight of each candidate item, and finally queries the knowledge graph according to the item identifier of each target item to obtain recommendation results. According to the historical behavior data of the target user and the previously constructed knowledge graph, it is possible to query the knowledge graph for items that meet the user's recent needs and obtain recommendation results, so that when the user searches for the required item, he can search according to the recommendation results, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] in:

[0020] Figure 1 This is a diagram of an application environment of a recommendation method based on a knowledge graph in one embodiment;

[0021] Figure 2 Flowchart of a recommendation method based on knowledge graph in one embodiment;

[0022] Figure 3 1 is a structural block diagram of a recommendation device based on a knowledge graph in one embodiment;

[0023] Figure 4 is a structural block diagram of a computer device in one embodiment;

[0024] Figure 5 It is a structural block diagram of a computer device in another embodiment. DETAILED DESCRIPTION

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0026] The knowledge graph-based recommendation method provided by the embodiment of the present invention can be applied in Figure 1In an application environment, the client 110 communicates with the server 120 via a network. The server 120 can receive and obtain the historical behavior data and knowledge graph of the target user through the client 110, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item. The server 120 selects each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item. The server 120 configures the weight of the candidate item according to the browsing time of the candidate item and a preset weight configuration rule, and determines at least one target item from each candidate item according to the weight of each candidate item. The server 120 queries the knowledge graph based on the item identifier of each target item to obtain a recommendation result. Based on the historical behavior data of the target user and the previously constructed knowledge graph, the server 120 can query the knowledge graph for items that meet the user's recent needs and obtain a recommendation result. When the user searches for the required item, he can search based on the recommendation result, thereby improving the search efficiency and accuracy, saving a lot of search time, and improving the user experience. The client 110 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server 120 can be implemented as an independent server or a server cluster composed of multiple servers. The present invention will be described in detail below through specific embodiments.

[0027] See also Figure 2 As shown, Figure 2 A flowchart of a knowledge graph-based recommendation method provided in one embodiment of the present invention includes the following steps:

[0028] S101: Acquire historical behavior data and a knowledge graph of a target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item;

[0029] Among them, historical behavior data refers to the data retained by the target user in the past, the browsed items refer to the items browsed by the user in the past, and the browsed time refers to the time when the user browsed the items in the past. The projects can be various software projects on the open source project hosting platform.

[0030] The historical behavior data may include browsed items, browsing time of browsed items, platform to which browsed items belong, content information of browsed items and basic information of browsed items. The basic information of browsed items may include the author of browsed items and the computer design language used for browsing items. For example, if the computer design language is C language, C language is a computer programming language that has the characteristics of both high-level language and assembly language. C language can be used as a working system design language for writing system applications, or as an application design language for writing applications that do not rely on computer hardware.

[0031] A knowledge graph is a graph that includes: each standard item, the feature data of each standard item, and the relationships between the feature data of different standard items. These relationships can include belonging relationships, combination relationships, inclusion relationships, and causal relationships. Feature data refers to data that represents the representative characteristics of a standard item. For example, if the item is "algorithm based on convolutional neural network," its feature data can include "convolution" and "neural network."

[0032] S102: selecting, from among the browsing items, each browsing item whose browsing time is later than a preset time as a candidate item;

[0033] As an example, the latest browsing time is determined among the browsing times corresponding to the respective browsing items, and the preset candidate duration is subtracted from the latest browsing time to obtain the preset time.

[0034] Specifically, each browsing item whose browsing time is later than a preset time is selected from various browsing items as a candidate item, so as to remove each browsing item whose browsing time is not later than the preset time, thereby obtaining candidate items with higher recommendation value.

[0035] S103: configuring weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and determining at least one target item from each of the candidate items according to the weight of each candidate item;

[0036] The weight configuration rule is to assign weights to candidate items from high to low in the order of browsing time, and the weights can be values ​​such as 0.1, 0.5, 0.4, etc. The weights of candidate items are configured according to the browsing time of the candidate items and the preset weight configuration rule.

[0037] As an example, the candidate items include the first candidate item, the second candidate item, and the third candidate item, and the corresponding browsing times are 20:20, 20:18, and 21:10 respectively. The first candidate item is assigned the second weight, the second candidate item is assigned the third weight, and the third candidate item is assigned the first weight, wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.

[0038] Finally, at least one target project is determined from among the candidate projects based on the weight of each candidate project. As an example, a candidate project whose weight is greater than a preset weight value is selected as the target project. As another example, the candidate projects are sorted in descending order of their weights to obtain a sorting result, and the top-ranked candidate projects in the sorting result are selected as the target projects. As an example, the top-ranked candidate projects can be specifically set to the top three.

[0039] S104: Query the knowledge graph according to the project identifier of each target project to obtain recommendation results.

[0040] The project identifier may be an ID identifier, a numeric identifier, or an alphabetical identifier.

[0041] In one implementation, the target item's item identifier is used as an index to query the knowledge graph, thereby obtaining items that the user desires to browse as recommendation results. As an example, after obtaining the recommendation results, the recommendation results are output to a terminal device for display, thereby presenting the recommendation results to the target user, allowing the target user to freely select items from the recommendation results, thereby providing the user with high-quality recommendation services.

[0042] The recommendation method based on knowledge graph proposed in this embodiment obtains the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item, and then selects each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item, and then configures the weight of the candidate item according to the browsing time of the candidate item and the preset weight configuration rule, and determines at least one target item from each candidate item according to the weight of each candidate item, and finally queries the knowledge graph according to the item identifier of each target item to obtain recommendation results. According to the historical behavior data of the target user and the previously constructed knowledge graph, it is possible to query the knowledge graph for items that meet the user's recent needs and obtain recommendation results, so that when the user searches for the required item, he can search according to the recommendation results, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.

[0043] In one embodiment, performing a query in the knowledge graph based on the project identifier of each target project to obtain a recommendation result includes:

[0044] S201: Querying the knowledge graph for a standard project corresponding to the project identifier of the target project as a first project, and using each feature data of the first project in the knowledge graph as first feature data;

[0045] In this embodiment, the project identifier of the target project is used as an index to perform a query in the knowledge graph, thereby obtaining a standard project corresponding to the project identifier in the knowledge graph, wherein the standard project is a project obtained by performing standardized operations on open source projects obtained from various websites or platforms.

[0046] The above-mentioned standard item is taken as the first item, and then each feature data of the first item in the knowledge graph is taken as the first feature data. It should be noted that each item in the knowledge graph has one or more corresponding feature data.

[0047] S202: Take the labels corresponding to each of the first feature data corresponding to the target project as the first labels, query the standard projects corresponding to the labels that have a relationship with the first labels in the knowledge graph as the second projects, and determine the recommendation results based on the second projects corresponding to each of the target projects.

[0048] The label can refer to the field where the feature data is located, or it can be a key feature of the feature data.

[0049] As an example, the first feature data is the word "convolutional neural network", and the label corresponding to the "convolutional neural network" can be a key feature, and the key feature is "convolution". The label corresponding to the convolutional neural network can also be the field where the feature data is located, and the field can be "model training", "artificial intelligence", "machine learning" or "deep learning", etc.

[0050] In one implementation, each feature data is labeled by manual labeling or machine labeling.

[0051] Specifically, the labels corresponding to each first feature data corresponding to the target item are used as the first labels, and the standard items corresponding to the labels that have a relationship with the first labels are queried in the knowledge graph as the second items. It should be noted that the existence of a relationship means that there is a relationship between labels, and the relationship can be inclusion, combination, belonging, causality, intersection and other relationships.

[0052] Finally, the recommendation results are determined based on the second items corresponding to the target items. As an example, a preset number of second items are randomly selected from the second items as the recommendation results.

[0053] The knowledge graph-based recommendation method proposed in this embodiment searches for a standard item corresponding to the item identifier of the target item in the knowledge graph as the first item, uses each feature data of the first item in the knowledge graph as the first feature data, and finally uses the label corresponding to each of the first feature data corresponding to the target item as the first label, searches for a standard item corresponding to a label that has a relationship with the first label in the knowledge graph as the second item, and determines the recommendation result based on each of the second items corresponding to each of the target items. It can search for each second item that has a relationship with the target item and obtain the recommendation result, which greatly improves the depth and breadth of the recommendation result, thereby enriching the recommendation result and allowing users to search for the required items and search based on the recommendation result, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.

[0054] In one embodiment, the method of using a label corresponding to each of the first feature data corresponding to the target item as a first label, searching the knowledge graph for a standard item corresponding to a label that has a relationship with the first label as a second item, and determining the recommendation result based on each of the second items corresponding to each of the target items includes:

[0055] S301: adding each of the second items to a preset memory;

[0056] In this embodiment, the second item is stored in a preset memory. In one implementation, the second item is persistently stored in the memory. As an example, the second item can also be stored in a preset database.

[0057] S302: If the number of the second items in the memory does not exceed a preset number, each tag corresponding to each feature data of the second item in the knowledge graph is used as a second tag, and the knowledge graph is searched for a standard item corresponding to a tag that has a relationship with the second tag as a third item;

[0058] In this embodiment, first, a determination is made as to whether the number of second items in the memory exceeds a preset number. Then, if the number of second items in the memory does not exceed the preset number, the feature data of the second items in the knowledge graph is determined, and each tag corresponding to the feature data is used as a second tag. Next, the knowledge graph is searched for standard items corresponding to tags that have a relationship with the second tags, and these items are used as third items.

[0059] S303: taking the third item as the second item, and returning to the step of adding each second item to a preset memory;

[0060] In this embodiment, this means that the number of second items in the memory does not exceed the preset number. In order to make the number of second items in the memory equal to or exceed the preset number, the third item is used as the second item, thereby jumping back to the step of adding each of the second items to the preset memory; wherein, returning to execute the step of adding each of the second items to the preset memory means returning to step S301 and executing step S301.

[0061] S304: If the number of the second items in the memory exceeds a preset number, determining the recommendation result according to each of the second items in the memory.

[0062] In this embodiment, when the number of second items in the memory exceeds a preset number, it means that enough second items containing sufficiently rich relationships have been obtained. Finally, the recommendation results are determined based on the second items in the memory, thereby enriching the recommendation results.

[0063] As an example, a preset number of second items are randomly selected from the second items in the memory, and as a recommendation result, the selected number may be 10.

[0064] The knowledge graph-based recommendation method proposed in this embodiment adds each second item to a preset memory, and then if the number of second items in the memory does not exceed the preset number, each label corresponding to each feature data of the second item in the knowledge graph is used as a second label, and the standard item corresponding to the label that has a relationship with the second label is queried in the knowledge graph as a third item, and then the third item is used as the second item, and the step of adding each second item to the preset memory is returned to execute. Finally, if the number of second items in the memory exceeds the preset number, the recommendation result is determined according to each second item in the memory. The preset memory can be used to increase the number of second items, thereby enriching the recommendation results, so that when the user searches for the required item, they can search according to the recommendation results, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.

[0065] In one embodiment, performing a query in the knowledge graph based on the project identifier of each target project to obtain a recommendation result further includes:

[0066] S401: Inputting the feature data of each candidate item into a trained behavior analysis model for data analysis to obtain a prediction result, wherein the behavior analysis model is a model trained based on the Wi de & Deep model;

[0067] The behavior analysis model is trained based on the Wide & Deep model, a hybrid model consisting of a single-layer Wide component and a multi-layer Deep component. The Wide component primarily provides the model with strong "memory," while the Deep component primarily enhances "generalization." For example, a behavior collector collects a large amount of user behavior data. This behavior data can include features from multiple items a user has browsed in the past. Based on this behavior data, user-specific behavioral interest profiles are constructed and fed into the Wide & Deep model for training.

[0068] Specifically, the feature data of each candidate item is input into a trained behavior analysis model for data analysis to obtain a prediction result, wherein the prediction result may be the item desired by the predicted user.

[0069] S402: Query the knowledge graph according to the project identifier of each target project to obtain query results;

[0070] In one implementation, for each target project, a query is performed in the knowledge graph according to the project identifier of each target project, and one or more projects corresponding to the target project are obtained as query results.

[0071] S403: Determine the recommendation result according to the prediction result and the query result.

[0072] In this embodiment, as an example, the prediction results and the query results are used as recommendation results. As another example, a first preset number of items are randomly selected from the prediction results and the query results as recommendation results, where the first preset number may be 20. As another example, a second preset number of items are randomly selected from the prediction results and the query results, where the second preset number may be 10.

[0073] The knowledge graph-based recommendation method proposed in this embodiment obtains a prediction result by inputting the feature data of each candidate item into a trained behavior analysis model for data analysis, wherein the behavior analysis model is a model trained based on the Wi de & Deep model, and then queries are performed in the knowledge graph according to the item identifier of each target item to obtain query results, and finally the recommendation result is determined according to the prediction results and the query results. The behavior analysis model can predict the items that the user expects to browse and obtain prediction results. Finally, the recommendation result is obtained based on the query results and prediction results queried in the knowledge graph, thereby improving the accuracy of the recommendation result, making the recommendation result more in line with user expectations, and improving the user experience.

[0074] In one embodiment, before obtaining the historical behavior data and knowledge graph of the target user, the following steps are included:

[0075] S501: Acquire project information corresponding to each standard project, wherein the project information includes a project introduction and a project label;

[0076] Among them, the standard project is a project that has undergone standardized operations on open source projects obtained from various websites or platforms. The standardized operation may include standardization of the name. The project label refers to the label that comes with the standard project itself, that is, the label that already exists for the standard project on the website or platform.

[0077] S502: Preprocessing the project information, and extracting keywords from the preprocessed project information to obtain a keyword set for each standard project;

[0078] In this embodiment, the project information is first preprocessed. As an example, data cleaning is performed on the obtained project information, primarily removing irrelevant text, punctuation, redundant characters, and escape characters. Regular expressions are used to standardize the project information to improve its quality. Next, keyword extraction is performed on the preprocessed project information to obtain a keyword set for each standard project.

[0079] In one embodiment, the keyword extraction is performed on the pre-processed project information to obtain a keyword set for each standard project, including:

[0080] S5021: Preprocessing the project information, wherein the preprocessing includes data cleaning and data planning;

[0081] S5022: using ansj word segmenter to extract keywords from the pre-processed project information to obtain a keyword set for each standard project.

[0082] In this embodiment, after preprocessing the project information, the ANSI tokenizer (ANSI) from the field of natural language processing (NLP) is used to extract keywords from the project description, project profile, and project tags. The ANSI tokenizer is a Chinese tokenizer implemented using Java, a general-purpose, class-based, object-oriented programming language that can be used as a computing platform for application development. The ANSI tokenizer can achieve an in-memory tokenization speed of 1 million words per second and a file tokenization speed of 300,000 words per second, with an accuracy rate exceeding 96%.

[0083] The knowledge graph-based recommendation method proposed in this embodiment preprocesses the project information, wherein the preprocessing includes data cleaning and data planning processing, and finally uses the ansj word segmenter to extract keywords from the preprocessed project information to obtain a keyword set for each of the standard projects. High-quality project information can be obtained through preprocessing, which is conducive to segmenting the preprocessed project information through the ansj word segmenter to obtain a keyword set with excellent segmentation effect.

[0084] S503: Input each of the keyword sets into a trained natural language processing deep model for feature extraction to obtain vector matrices corresponding to each of the keyword sets, wherein the natural language processing deep model is a model trained based on the Word2Vec model;

[0085] Among them, the text clustering of the Word2Vec model is a model that effectively solves problems such as redundant extracted nouns, too many labels, and processing of unpopular words. Word2Vec is a typical deep model for natural language processing, consisting of a CBOW (continuous bag of words) model adapted to small samples and a Skip-gram model suitable for large corpora. The goal of the Skip-gram model is to learn the continuous feature representation of words by optimizing the likelihood objective of neighborhood preservation.

[0086] In this embodiment, each keyword set is input into a trained natural language processing deep model for feature extraction, and the vector matrix corresponding to each keyword set output by the natural language processing deep model is obtained. As an example, each keyword is converted into a vector matrix of dimension 1x400.

[0087] S504: using a preset spectral clustering algorithm to cluster the vector matrices corresponding to the keyword sets to obtain a clustering matrix;

[0088] In this embodiment, the spectral clustering algorithm can be based on super pixel anchors. Figure 2The hyperspectral clustering algorithm with heavy dimensionality reduction is then based on superpixel anchors Figure 2 The hyperspectral clustering algorithm with heavy dimensionality reduction clusters each vector matrix corresponding to each keyword set to obtain a clustering matrix.

[0089] S505: Input the clustering matrix into the trained feature association model to perform relationship-based feature association to obtain the knowledge graph, wherein the feature association model is a model trained based on the Bert model, BGRU model and CRF model connected in sequence.

[0090] Among them, the Bert (Bidirectional Encoder Representation from Transformers) model can generate deep bidirectional language representations. The BGRU (Bidirectional Gate Recurrent Unit) model and the CRF (Conditional Random Field) model are also included.

[0091] In this embodiment, after obtaining the clustering matrix, the clustering matrix is ​​input into the trained feature association model for relationship-based feature association, so that the relationship between each feature data in the clustering matrix and other feature data is determined. The above relationship can be an inclusion relationship, a belonging relationship, a combination relationship, or a causal relationship, thereby obtaining the knowledge graph.

[0092] In one implementation, when new knowledge entities are input from the outside world, the knowledge graph should automatically classify and extract information from the new entities, thereby continuously expanding the scale and scope of the knowledge base. Due to the large number of steps involved in building a knowledge graph, it is not practical to execute the entire construction process for each new knowledge entity input when faced with a small number of scattered new knowledge entities. The knowledge graph can be embedded in the TransG model, which can automatically discover semantic clusters of relationships and use a mixture of multiple relationship components to transform entity pairs, solving the problem of multiple semantics for a single relationship. The knowledge graph uses the TransG model to build automated knowledge reasoning capabilities, learn features from some existing projects, and use the TransG model's knowledge reasoning capabilities to process new input projects and find the top several most similar existing projects, effectively responding to the input of new nodes. This solves the difficulty of short-term reasonable classification and correct recommendation of new nodes as the knowledge graph grows in size, enriches the association channels, and can balance stability and flexibility.

[0093] The recommendation method based on knowledge graph proposed in this embodiment obtains the project information corresponding to each standard project, wherein the project information includes a project introduction and a project label, and then preprocesses the project information and performs keyword extraction on the preprocessed project information to obtain a keyword set for each standard project, and then inputs each keyword set into a trained natural language processing deep model for feature extraction to obtain each vector matrix corresponding to each keyword set, wherein the natural language processing deep model is a model trained based on the Word2Vec model, and then uses a preset spectral clustering algorithm to cluster each vector matrix corresponding to each keyword set to obtain a clustering matrix, and finally inputs the clustering matrix into the training set. The feature association model is input into the trained feature association model for relationship-based feature association to obtain the knowledge graph, wherein the feature association model is a model trained based on the Bert model, the BGRU model and the CRF model connected in sequence, and can obtain high-quality project information through preprocessing, which is conducive to the segmentation of the preprocessed project information through the ansj word segmenter to obtain a keyword set with excellent segmentation effect, and then the keyword set is input into the natural language processing deep model for segmentation, and then the vector matrix obtained after segmentation is clustered by the preset spectral clustering algorithm with excellent clustering performance, so as to obtain a clustering matrix with excellent clustering effect, and then the clustering matrix is ​​input into the trained feature association model to obtain a knowledge graph containing the relationship between feature data of different standard projects.

[0094] In one embodiment, inputting the clustering matrix into a trained feature association model to perform relationship-based feature association to obtain the knowledge graph includes:

[0095] S5051: Input the clustering matrix into the Bert model of the trained feature association model for encoding to obtain encoded data;

[0096] S5052: Inputting the encoded data into the BGRU model of the trained feature association model to perform relationship prediction and obtain a relationship prediction result;

[0097] S5053: Input the relationship prediction result into the CRF model of the trained feature association model to constrain the relationship prediction result and obtain a knowledge graph.

[0098] It's important to note that when processing project information, since most feature data comes from disorganized introduction paragraphs, context-based prediction is more suitable and can more accurately understand individual project information. Therefore, the encoded data after the BERT model is input into the BGRU model for training to improve the accuracy of the training results.

[0099] The knowledge graph-based recommendation method proposed in this embodiment obtains encoded data by inputting the clustering matrix into the Bert model of the trained feature association model for encoding processing, and then inputting the encoded data into the BGRU model of the trained feature association model for relationship prediction to obtain relationship prediction results, and finally inputting the relationship prediction results into the CRF model of the trained feature association model to constrain the relationship prediction results to obtain a knowledge graph. The clustering matrix can be input into the feature association model to obtain a knowledge graph containing the relationships between feature data of different standard items.

[0100] See also Figure 3 As shown, in one embodiment, a recommendation device based on a knowledge graph is provided, the device comprising:

[0101] An acquisition module 10 is configured to acquire historical behavior data and a knowledge graph of a target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item;

[0102] A selection module 20 is configured to select, from among the browsing items, each browsing item whose browsing time is later than a preset time as a candidate item;

[0103] a determination module 30 configured to configure the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and to determine at least one target item from each of the candidate items according to the weight of each candidate item;

[0104] The query module 40 is used to query the knowledge graph according to the project identification of each target project to obtain recommendation results.

[0105] The recommendation method based on knowledge graph proposed in this embodiment obtains the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item, and then selects each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item, and then configures the weight of the candidate item according to the browsing time of the candidate item and the preset weight configuration rule, and determines at least one target item from each candidate item according to the weight of each candidate item, and finally queries the knowledge graph according to the item identifier of each target item to obtain recommendation results. According to the historical behavior data of the target user and the previously constructed knowledge graph, it is possible to query the knowledge graph for items that meet the user's recent needs and obtain recommendation results, so that when the user searches for the required item, he can search according to the recommendation results, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.

[0106] In one embodiment, the query module 40 is further used to: query the knowledge graph for a standard item corresponding to the item identifier of the target item as a first item, and use each feature data of the first item in the knowledge graph as a first feature data; use the label corresponding to each of the first feature data corresponding to the target item as a first label, query the knowledge graph for a standard item corresponding to a label that has a relationship with the first label as a second item, and determine the recommendation result based on each of the second items corresponding to each of the target items.

[0107] In one embodiment, the query module 40 is further used to: add each of the second items to a preset memory; if the number of the second items in the memory does not exceed the preset number, then use each label corresponding to each feature data of the second item in the knowledge graph as a second label, and query the knowledge graph for a standard item corresponding to a label that has a relationship with the second label as a third item; use the third item as the second item, and return to execute the step of adding each of the second items to the preset memory; if the number of the second items in the memory exceeds the preset number, then determine the recommendation result based on each of the second items in the memory.

[0108] In one embodiment, the query module 40 is further used to: input the feature data of each candidate project into a trained behavior analysis model for data analysis to obtain a prediction result, wherein the behavior analysis model is a model trained based on the Wide & Deep model; perform a query in the knowledge graph according to the project identification of each target project to obtain a query result; and determine the recommendation result based on the prediction result and the query result.

[0109] In one embodiment, the knowledge graph-based recommendation device is further used to: obtain project information corresponding to each standard project, wherein the project information includes a project introduction and a project label; preprocess the project information, and perform keyword extraction on the preprocessed project information to obtain a keyword set for each standard project; input each keyword set into a trained natural language processing deep model for feature extraction to obtain each vector matrix corresponding to each keyword set, wherein the natural language processing deep model is a model trained based on the Word2Vec model; cluster the vector matrices corresponding to each keyword set using a preset spectral clustering algorithm to obtain a clustering matrix; input the clustering matrix into a trained feature association model for relationship-based feature association to obtain the knowledge graph, wherein the feature association model is a model trained based on the Bert model, BGRU model and CRF model connected in sequence.

[0110] In one embodiment, the recommendation device based on the knowledge graph is further used to: input the clustering matrix into the Bert model of the trained feature association model for encoding processing to obtain encoded data; input the encoded data into the BGRU model of the trained feature association model for relationship prediction to obtain a relationship prediction result; input the relationship prediction result into the CRF model of the trained feature association model to constrain the relationship prediction result to obtain a knowledge graph.

[0111] In one embodiment, the knowledge graph-based recommendation device is further used to: preprocess the project information, wherein the preprocessing includes data cleaning and data planning processing; use an ansj word segmenter to extract keywords from the preprocessed project information to obtain a keyword set for each standard project.

[0112] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the server side of a recommendation method based on a knowledge graph.

[0113] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a recommendation method based on a knowledge graph.

[0114] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0115] Obtaining historical behavior data and a knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item;

[0116] Selecting, from among the browsing items, each browsing item whose browsing time is later than a preset time as a candidate item;

[0117] configuring the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and determining at least one target item from each of the candidate items according to the weight of each candidate item;

[0118] According to the project identification of each target project, a query is performed in the knowledge graph to obtain recommendation results.

[0119] The recommendation method based on knowledge graph proposed in this embodiment obtains the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item, and then selects each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item, and then configures the weight of the candidate item according to the browsing time of the candidate item and the preset weight configuration rule, and determines at least one target item from each candidate item according to the weight of each candidate item, and finally queries the knowledge graph according to the item identifier of each target item to obtain recommendation results. According to the historical behavior data of the target user and the previously constructed knowledge graph, it is possible to query the knowledge graph for items that meet the user's recent needs and obtain recommendation results, so that when the user searches for the required item, he can search according to the recommendation results, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.

[0120] In one embodiment, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0121] Obtaining historical behavior data and a knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item;

[0122] Selecting, from among the browsing items, each browsing item whose browsing time is later than a preset time as a candidate item;

[0123] configuring the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and determining at least one target item from each of the candidate items according to the weight of each candidate item;

[0124] According to the project identification of each target project, a query is performed in the knowledge graph to obtain recommendation results.

[0125] The recommendation method based on knowledge graph proposed in this embodiment obtains the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item, and then selects each browsing item whose browsing time is later than a preset time from each browsing item as a candidate item, and then configures the weight of the candidate item according to the browsing time of the candidate item and the preset weight configuration rule, and determines at least one target item from each candidate item according to the weight of each candidate item, and finally queries the knowledge graph according to the item identifier of each target item to obtain recommendation results. According to the historical behavior data of the target user and the previously constructed knowledge graph, it is possible to query the knowledge graph for items that meet the user's recent needs and obtain recommendation results, so that when the user searches for the required item, he can search according to the recommendation results, thereby improving the retrieval efficiency and accuracy, saving a lot of retrieval time, and improving the user experience.

[0126] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can be found in the relevant descriptions of the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0127] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0128] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0129] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A recommendation method based on a knowledge graph, the method comprising: Obtaining historical behavior data and a knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item; Selecting, from among the browsing items, each browsing item whose browsing time is later than a preset time as a candidate item; configuring the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and determining at least one target item from each of the candidate items according to the weight of each candidate item; According to the project identification of each target project, a query is performed in the knowledge graph to obtain a recommendation result, including: querying the standard project corresponding to the project identification of the target project in the knowledge graph as the first project, and taking each feature data of the first project in the knowledge graph as the first feature data; taking the label corresponding to each of the first feature data corresponding to the target project as the first label, querying the standard project corresponding to the label that has a relationship with the first label in the knowledge graph as the second project, and adding each of the second projects to a preset memory; if the number of the second projects in the memory does not exceed the preset number, then taking each label corresponding to each feature data of the second project in the knowledge graph as the second label, and querying the standard project corresponding to the label that has a relationship with the second label in the knowledge graph as the third project; taking the third project as the second project, and returning to execute the step of adding each of the second projects to the preset memory; if the number of the second projects in the memory exceeds the preset number, determining the recommendation result according to each of the second projects in the memory.

2. The recommendation method based on knowledge graph according to claim 1, characterized in that The step of querying the knowledge graph according to the project identifier of each target project to obtain recommendation results further includes: Inputting the feature data of each candidate item into a trained behavior analysis model for data analysis to obtain a prediction result, wherein the behavior analysis model is a model trained based on the Wide & Deep model; Searching the knowledge graph according to the project identifier of each target project to obtain query results; The recommendation result is determined according to the prediction result and the query result.

3. The recommendation method based on knowledge graph according to claim 1, characterized in that Before obtaining the target user's historical behavior data and knowledge graph, the following steps are included: Obtaining project information corresponding to each standard project, wherein the project information includes a project introduction and a project label; Preprocessing the project information, and extracting keywords from the preprocessed project information to obtain a keyword set for each standard project; Input each of the keyword sets into a trained natural language processing deep model for feature extraction to obtain vector matrices corresponding to each of the keyword sets, wherein the natural language processing deep model is a model trained based on the Word2Vec model; Using a preset spectral clustering algorithm, clustering the vector matrices corresponding to the keyword sets to obtain a clustering matrix; The clustering matrix is ​​input into a trained feature association model to perform relationship-based feature association to obtain the knowledge graph, wherein the feature association model is a model trained based on the Bert model, BGRU model and CRF model connected in sequence.

4. The recommendation method based on knowledge graph according to claim 3, characterized in that Inputting the clustering matrix into the trained feature association model to perform relationship-based feature association to obtain the knowledge graph includes: Inputting the clustering matrix into the Bert model of the trained feature association model for encoding to obtain encoded data; Inputting the encoded data into the BGRU model of the trained feature association model to perform relationship prediction and obtain a relationship prediction result; The relationship prediction results are input into the CRF model of the trained feature association model to constrain the relationship prediction results and obtain a knowledge graph.

5. The recommendation method based on knowledge graph according to claim 3, characterized in that The keyword extraction is performed on the pre-processed project information to obtain a keyword set for each standard project, including: Preprocessing the project information, wherein the preprocessing includes data cleaning and data planning; The ansj word segmenter is used to extract keywords from the pre-processed project information to obtain a keyword set for each standard project.

6. A recommendation method and device based on knowledge graph, characterized in that: The device comprises: An acquisition module is used to acquire the historical behavior data and knowledge graph of the target user, wherein the historical behavior data includes each browsing item and the browsing time of the browsing item; a selection module, configured to select, from among the browsing items, each browsing item whose browsing time is later than a preset time, as a candidate item; a determination module, configured to configure the weights of the candidate items according to the browsing time of the candidate items and a preset weight configuration rule, and to determine at least one target item from each of the candidate items according to the weight of each candidate item; A query module is used to query the knowledge graph according to the project identification of each target project respectively to obtain recommendation results, including: querying the knowledge graph for a standard project corresponding to the project identification of the target project as a first project, and taking each feature data of the first project in the knowledge graph as a first feature data; taking the label corresponding to each of the first feature data corresponding to the target project as a first label, querying the knowledge graph for a standard project corresponding to a label that has a relationship with the first label as a second project, and adding each of the second projects to a preset memory; if the number of the second projects in the memory does not exceed the preset number, taking each label corresponding to each feature data of the second project in the knowledge graph as a second label, and querying the knowledge graph for a standard project corresponding to a label that has a relationship with the second label as a third project; taking the third project as the second project, and returning to execute the step of adding each of the second projects to the preset memory; if the number of the second projects in the memory exceeds the preset number, determining the recommendation result according to each of the second projects in the memory.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the knowledge graph-based recommendation method as described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the knowledge graph-based recommendation method as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Content similarity analysis method and device based on knowledge graph

    CN112732927A

  • Generating labels for images associated with a user

    US20170185670A1