A method and system for online course recommendation based on knowledge graph

Through the combination of knowledge graph and deep learning, users' interest in learning time and generate personalized recommendations, solving the problem of poor recommendation results in the existing technology and improving user stickiness and user experience.

CN114722182BActive Publication Date: 2024-12-13RENMIN UNIVERSITY OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210213438.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-04
Publication Date
2024-12-13
Estimated Expiration
2042-03-04

AI Technical Summary

Technical Problem

Existing online course recommendation methods are difficult to capture users' interest in learning time, especially the dynamic changes and evolution of interests, resulting in poor recommendation results and affecting user stickiness and user experience.

Method used

Using deep learning methods based on knowledge graphs, the online course knowledge graph is constructed, entities and relationship vectors are extracted, and time information in user history is learned in combination with the Transformer model, user portraits are generated, and target course vectors are spliced ​​and input into the DNN network. , predict the click probability to generate a recommendation list.

Benefits of technology

It realizes personalized recommendations, captures the evolution of short-term and long-term interests of users, improves user stickiness and recommendation effects, and integrates course semantic information through knowledge graphs to improve the recommendation effect of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114722182B_ABST
    Figure CN114722182B_ABST
Patent Text Reader

Abstract

The present invention relates to an online course recommendation method and system based on knowledge graph, which comprises: extracting entities and constructing online course knowledge graph according to the information and features of online courses; inputting triples in the knowledge graph into a representation learning model for feature learning to obtain entity and relationship vectors; extracting the user's historical study records and corresponding to the course library to obtain user course-sequence data; using the deep learning model transformer encoder part to learn the historical records with time information added to train user portraits; splicing the user portrait with the target course vector to obtain a new vector with dimension expansion, inputting it into a DNN network, and training the learning model; generating a recommendation list for the user according to the click probability output by the trained learning model. The present invention can better capture the user's time learning interest, recommend courses to the target user according to the target user's continuous course selection behavior; and can be widely used in the fields of knowledge graphs and deep learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge graphs and deep learning, and in particular to an online course recommendation method and system based on knowledge graphs. Background Art

[0002] Online learning platforms provide anyone with low-cost opportunities to access a large number of courses. However, the large number of courses makes it difficult for users to choose a suitable course, which seriously hinders user retention and course completion rates on online learning platforms.

[0003] Traditional recommendation methods are based on filtering, including collaborative filtering, content-based, and hybrid recommendations, which describe user interests by averaging or weighted averaging users' historical behaviors (such as course registration, course bookmarks, etc.), while simple fusion strategies fail to capture the temporal learning interests behind users' temporal behaviors. The temporal learning interests of online users can be expressed in two forms: interest drift and interest evolution. Rather than assuming that users' interests remain unchanged over time, interest drift indicates that users' interests in course learning are dynamic and diversified. Interest evolution indicates that as users acquire knowledge, skills, and experience over time, their learning interests are also evolving. For example, after learning the course "C++ Basic Programming", one may learn "C++ Advanced Programming" because the former is an advanced course of the latter. However, in course recommendation design, the above learning interest form based on users' course registration sequence has not been studied. Deep learning models are widely adopted to capture users' temporal interests by encoding historical sequential behaviors into a hidden state vector. Although the state vector helps to encode the sequential dependencies between historical registration behaviors, it fails to mine temporal learning interests from the potential knowledge connections between courses. Temporal information helps to understand online learning behavior. The learning patterns and interests of people who learn continuously and those who learn intermittently are completely different. In recent years, knowledge graphs have been widely used to incorporate external knowledge into recommenders. In our context, knowledge graphs can provide complementary and distinguishable course semantic information. Therefore, recommenders combined with knowledge graphs can better capture and reasonably expand the temporal learning interests behind the course semantic relevance. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide an online course recommendation method and system based on knowledge graph, combining deep learning and knowledge graph recommendation schemes to better capture the user's time learning interest. It can recommend courses to target users based on their continuous course selection behavior.

[0005] To achieve the above-mentioned purpose, the present invention adopts the following technical scheme: a method for recommending online courses based on knowledge graph, which comprises: extracting entities to construct an online course knowledge graph according to the information and features of the online courses; inputting the triples in the knowledge graph into the representation learning model for feature learning to obtain entity and relationship vectors; extracting the user's historical study records and corresponding them to the course library to obtain the user's course-sequence data; for each user, using the deep learning model transformer encoder part to learn the historical records that add time information, and training the user portrait to characterize the user's preferences; splicing the user portrait with the target course vector to obtain a new vector with expanded dimension, inputting it into the DNN network, and training the learning model; generating a recommendation list for the user according to the click probability output by the trained learning model.

[0006] Furthermore, extracting entities and constructing an online course knowledge graph based on the information and features of the online course includes:

[0007] Extract entities and relationships based on the user's historical learning records and course-related features;

[0008] Number the extracted entities and relations, starting from 0 for entity e to n, and starting from 0 for relation r;

[0009] Relates head entity e through relationship r h and tail entity e t , the numbers are formed into triples <e h ,r,e t >.

[0010] Furthermore, the triples in the knowledge graph are input into a representation learning model for feature learning to obtain entity and relationship vectors, including:

[0011] The learning model is trained based on the negative sampling method. <e h ,r,e t > Get negative example triples by replacing the head and tail nodes <e h ′,r,e t ′>;

[0012] Initializing the parameters of the learning model, including a mapping matrix and a node relationship representation vector;

[0013] Based on the learning of positive and negative triplets, the distance between the head and tail nodes of the negative triplet is maximized, and the distance between the head and tail nodes of the positive triplet is minimized. The model is optimized according to the loss function, and the parameters are continuously updated until the loss function stops decreasing and the learning model converges. The learning model outputs the representation vectors of entities and relationships.

[0014] Furthermore, the deep learning model transformer encoder is used to partially learn the historical records of adding time information and train the user profile, including:

[0015] Count the maximum, minimum and average lengths of user history records, select a fixed length as maxlen to split the historical learning records, and if the user history record is less than maxlen, fill it with 0 and add a positive infinite number;

[0016] Encode the user history sequence in order and time, so that the course representation vector contains the knowledge graph information and user behavior information;

[0017] Use the multi-head attention mechanism to train the weights of the historical sequence, split the dimension d into h parts, each with a dimension of d / h, and each vector contains different information;

[0018] The output of the multi-head attention layer is sent to the normalization and residual connection layer for processing. The features include residual connection and normalization, which is equivalent to adding the input vector to the output vector.

[0019] The output enters the Feed Forward Neural Network layer and undergoes two layers of activation functions to undergo full connection dimension transformation.

[0020] The output of the feedforward neural network is input into the residual connection and normalized again;

[0021] After the user history sequence is learned by the transformer, the learned course vector sequence is output, and the representation vectors are added together as the vector representation of the user portrait.

[0022] Furthermore, the sequence and time coding of the user history sequence includes:

[0023] For each user, each record is numbered and coded as k = [0, 1, 2..., n] according to the course learning sequence, where sequence number i represents the i-th course that the user has studied after joining the platform;

[0024] Use the course registration time interval to further capture the information contained in user behavior and calculate the registration time t for each course. i Registering for your first course 0 The time interval Δt 0i ;

[0025] For time interval Δt 0i Do minmax standardization and set Δt 0i Scaling to 0-k max Between max represents the length of the user's history record, and the scaled time interval is denoted as t(vk );

[0026] Add the position information and time information to get the final coding order information TPos (v k )=k+t(v k );

[0027] Using sin and cos periodic functions, expand TPos(v k ) has the same dimension as the course vector representation;

[0028] TPos(v k ) is input into the vector representation of the corresponding course, so that the course representation vector contains the information of the knowledge graph and user behavior information.

[0029] Furthermore, the user portrait is concatenated with the target course vector to obtain a new vector with expanded dimension, which is input into the DNN network to train the learning model, including:

[0030] After the DNN network is fully connected, the weights are iteratively updated using the gradient descent method. Several weight coefficient matrices W and bias vectors b are used to perform linear operations and activation operations with the input value vector x. Starting from the input layer, the calculation is performed backward layer by layer until the output layer is reached to obtain the output result value. The data range of the DNN output is set to 0-1, which represents the predicted recommendation score.

[0031] The user set is divided into a training set and a test set, and the training set is input into the learning model for learning until the learning model converges.

[0032] Further, generating a recommendation list for the user according to the click probability output by the trained learning model includes:

[0033] The user set of the test data is input into the trained learning model, and the course candidate set is all courses except those input into the model learning to simulate the real scenario;

[0034] Each candidate item in the candidate set is combined with the user's historical record to learn the learning model and output the click probability;

[0035] Sort the click probability values ​​of all items from high to low, select the first K items after sorting as the recommendation results, and output the ID number of the item;

[0036] Repeat the above process until the recommendation lists of all users are output.

[0037] An online course recommendation system based on knowledge graph, comprising: an extraction module, which extracts entities and constructs an online course knowledge graph according to the information and features of the online course; a feature learning module, which inputs the triples in the knowledge graph into a representation learning model for feature learning to obtain entity and relationship vectors; a data acquisition module, which extracts the user's historical study records and corresponds them to the course library to obtain the user's course-sequence data; a processing module, which uses the deep learning model transformer encoder part to learn the historical records adding time information for each user, and trains the user portrait to characterize the user's preferences; a training module, which concatenates the user portrait with the target course vector to obtain a new vector with expanded dimension, and inputs it into a DNN network to train the learning model; a recommendation list generation module, which generates a recommendation list for the user according to the click probability output by the trained learning model.

[0038] A computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions, which when executed by a computing device, cause the computing device to perform any of the above methods.

[0039] A computing device comprises: one or more processors, a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing any of the above methods.

[0040] The present invention adopts the above technical solution, which has the following advantages:

[0041] 1. The present invention can automatically search for courses that match the user's interests in the course library by learning the user's historical records, and automatically recommend them to the user, thereby realizing personalized recommendations and improving the user's experience. It can also capture the evolution of the user's short-term and long-term interests and improve user stickiness.

[0042] 2. The present invention introduces knowledge graphs and integrates course knowledge into sequential recommendation to capture potential knowledge connections between courses. By constructing a knowledge graph containing rich meta-information of courses, considering the rich semantics and high-order connectivity of courses, and using the embedding of knowledge graphs to represent courses, the recommendation effect of the model is improved.

[0043] 3. The present invention introduces Transformer to extract the learning interests and user portraits behind the user's sequential learning behavior. The multi-head self-attention mechanism in the Transformer module can automatically capture the dependencies between courses in the sequence.

[0044] 4. The present invention captures the time-dependent short-term and long-term learning interest evolution by encoding the time interval between the registration time of the first course and the registration time of each course in the course learning sequence. For example, on an online learning platform, users tend to register for a variety of courses in a short period of time. In the long run, after completing the basic courses, advanced evolution of interests will occur. This innovation improves the recommendation effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a schematic diagram of the overall process of the online course recommendation method in one embodiment of the present invention;

[0046] Figure 2 is an example of a knowledge graph in one embodiment of the present invention;

[0047] Figure 3 is a flow chart of knowledge graph representation learning in one embodiment of the present invention;

[0048] Figure 4 is a flowchart of user profiling and probability prediction in one embodiment of the present invention;

[0049] Figure 5 It is a schematic diagram of the structure of a computing device in one embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.

[0051] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0052] The present invention provides an online course recommendation method and system based on knowledge graph and deep learning. The present invention constructs an online course knowledge graph according to the characteristics of online courses, utilizes the relationship connection between conceptual entities in the online course knowledge graph to enhance the vector representation of learning course entities, and combines the deep learning model transformer to learn user portraits through user history records. The time-aware transformer model used in the present invention can describe the user's long-term and short-term interests according to the time interval of user behavior, and can express the diversity and ductility of interests. Search the course library for courses that match the current user and combine them with the input into the DNN network to output the click probability, so as to recommend the top N most matching courses. Users do not need to select the required learning content from the massive content themselves, which not only saves time, but also improves the user experience.

[0053] In one embodiment of the present invention, a method for recommending online courses based on a knowledge graph is provided. This embodiment uses the method applied to a terminal as an example. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Figure 1 As shown, the method comprises the following steps:

[0054] 1) Based on the information and features of online courses, extract entities to build an online course knowledge graph; entities include teachers, schools, concepts, and fields, etc.;

[0055] 2) Input the triples in the knowledge graph into the representation learning model for feature learning to obtain entity and relationship vectors;

[0056] 3) Extract the user's historical study records and correspond them with the course library to obtain the user's course-sequence data;

[0057] 4) For each user, the transformer encoder part of the deep learning model is used to learn the historical records with time information and train the user profile to characterize the user's preferences;

[0058] 5) Concatenate the user portrait with the target course vector to obtain a new vector with expanded dimension, input it into the DNN network, and train the learning model;

[0059] 6) Generate a recommendation list for the user based on the click probability output by the trained learning model.

[0060] In the above step 1), entities are extracted to construct an online course knowledge graph based on the information and features of the online course, including the following steps:

[0061] 1.1) Extract entities and relationships based on the user’s historical learning records and course-related features;

[0062] The knowledge graph is a network composed of nodes and edges. Nodes represent entities, and edges represent relationships between entities. We extract course attribute information and map it into nodes of the knowledge graph. We extract teachers, schools, concepts, fields, and required prerequisite courses as nodes in the knowledge graph, and map the relationships between nodes into edges in the network. There are five types of relationships: (1) There is a teaching relationship between teachers and courses, (2) There is an opening relationship between schools and courses, (3) There is a containment relationship between courses and concepts, (4) There is a belonging relationship between concepts and fields, and (5) There is a prerequisite relationship between courses. Examples of graphs include Figure 2 shown.

[0063] 1.2) Number the extracted entities and relations, starting from 0 for entity e to n, and starting from 0 for relation r;

[0064] 1.3) Associate the head entity e through the relationship r h and tail entity e t , the numbers are formed into triples <e h ,r,e t >.

[0065] In the above step 2), the triples in the knowledge graph are input into the representation learning model for feature learning, such as Figure 3 As shown, the entity and relationship vectors are obtained, including the following steps:

[0066] 2.1) Based on the negative sampling method, the learning model is trained for the positive triple <e h ,r,e t > Get negative example triples by replacing the head and tail nodes <e h ′,r,e t ′>;

[0067] 2.2) Initialize the parameters of the learning model, including the mapping matrix and the node relationship representation vector;

[0068] According to the constructed positive and negative triples, the representation learning model is trained. For the head entity and the tail entity, different mapping matrices are used to project them into the relational space.

[0069] During the training process, a vector is used to represent entities and relations, and another vector is used to construct a mapping matrix, which indicates how to map entities to the relation space; each entity pair has a unique matrix.

[0070] The mapping matrix is ​​constructed as follows:

[0071]

[0072]

[0073] Among them, M rh represents the head entity mapping matrix, r p represents relation embedding, represents the head entity embedding, M rt represents the tail entity mapping matrix, represents the tail entity embedding;

[0074] The mapping matrix is ​​defined by entities and relationships, I is the identity matrix, and the generated matrix (determined by the r and h vectors) is used to modify the identity matrix.

[0075] h ⊥ =M rh h

[0076] t ⊥ =M rt h

[0077] In the formula, h ⊥ represents the embedding of the head entity after being projected into the relation space, t ⊥ Represents the embedding of the tail entity after being projected into the relation space;

[0078] 2.3) Based on the learning of positive and negative triplets, maximize the distance between the head and tail nodes of the negative triplet, minimize the distance between the head and tail nodes of the positive triplet, optimize the model according to the loss function, continuously update the parameters until the loss function stops decreasing and the learning model converges. The learning model outputs the representation vectors of entities and relationships.

[0079] Among them, the loss function L(h, r, t) is:

[0080] L(h, r, t) = max(0, d pos -d neg +margin)

[0081] Where h represents the head entity embedding, t represents the tail entity embedding, and d pos represents the score of the positive triplet, d neg Represents the score of the negative triplet, and margin represents the threshold of the difference between the positive and negative sample scores.

[0082] The loss function is L(h, r, t) to maximize the distance between positive and negative examples. The calculation of d is as follows:

[0083] d=||h+rt||

[0084] The loss function decreases continuously during the training process until the model converges.

[0085] In step 4) above, a time-aware position encoding module is integrated into the transformer, which can capture not only the order but also the registration time of the course in the course learning sequence. According to the user's historical records and the course vector generated after learning the knowledge graph representation, each user will get a serialized historical course vector representation. First, the position sequence of the courses is numbered, and then the time interval for adding the courses is encoded, standardized and added to the position code. The courses containing position and time information are input into the transformer encoder model. Model features include: multihead attention, position wise forward network.

[0086] In this embodiment, the deep learning model transformer encoder is used to partially learn the historical records with time information and train the user profile, such as Figure 4 As shown, the following steps are included:

[0087] 4.1) Count the maximum length, minimum length and average length of user history records, select a fixed length as maxlen (indicating the maximum length of user history records set in the divided training data) as the benchmark for splitting historical learning records, and fill in 0 if the user history records are less than maxlen; in this embodiment, a masking operation is performed on this part of the data, and a positive infinite number is assigned to this position. This position is ignored in subsequent calculations and does not affect model training.

[0088] The distance representation score is calculated using the function L(y, y′) = max(0, margin-y+y′), where y is the score of the positive sample and y′ is the score of the negative sample.

[0089] For each user, a historical record set S is constructed, and the first N items in S are selected as the input for model training, denoted as maxlen, and the last m item sets are used to verify the model effect.

[0090] For each historical record of the user, the semantic vector of item I is selected from the vector set learned from the knowledge graph to form a vector sequence input.

[0091] From the knowledge graph course vector set, exclude the course set for user input model training, and use the rest as the test set.

[0092] 4.2) The Transformer model does not have sequential features, so the user history sequence is sequentially and temporally encoded so that the course representation vector contains knowledge graph information and user behavior information;

[0093] 4.3) Use the multi-head attention mechanism to train the weights of the historical sequence, split the dimension d into h parts, each with a dimension of d / h, and each vector contains different information;

[0094] In this embodiment, multiple attention mechanisms are trained simultaneously, each attention mechanism outputs a weighted vector representation hi, and the results of multiple heads are concatenated to obtain the final result of the entire attention layer.

[0095] 4.3.1) Attention mechanism Attention is a dot product operation mode:

[0096]

[0097] Among them, Q, K, V are obtained by multiplying the model input by different matrix transformations, Q represents the query, K represents the key, and V represents the value. Divide by the dimension This is to avoid extremely small gradients so that the softmax result does not produce extreme values.

[0098] 4.3.2) Finally, the output results are concatenated according to the vector dimension.

[0099] MultiHead(H)=Concat(head 1 ;head 2 ;...;head h )

[0100] head i =Attention(HW Q , H.W. K , H.W. V )

[0101] Among them, head i is the output of Attention, h is the number of heads, and W Q , W K and W V is the projection matrix for each head. HW Q ,HW K ,HW V Both represent the dot product of the projection matrix and the input, which is used to extract information. MultiHead (H) represents the final output of the multi-head attention mechanism. h Represents the output of each head in the multi-head attention mechanism.

[0102] 4.4) The output of the multi-head attention layer is sent to the normalization and residual connection layer for processing. The features include residual connection and normalization, which is equivalent to adding the input vector to the output vector, that is, the output structure becomes f(x)=f(x)+x. The advantage of this is that when taking the partial derivative of x, a constant term is added to avoid the problem of gradient vanishing; x represents the input vector.

[0103] 4.5) The output enters the Feed Forward Neural Network layer and undergoes two layers of activation functions to perform full-connection dimension transformation; the activation function of the first layer is RELU, and the second layer is a linear activation function;

[0104] In this embodiment, the function FFN can be expressed as: FFN(x)=max(0, xW1+b1)W2+b2, where W and b represent the weight matrix and bias respectively. The input dimension is d, and after two layers of activation functions, the output dimension eventually changes back to d dimension.

[0105] 4.6) The output of the feedforward neural network is input into the residual connection and normalized again;

[0106] 4.7) After the user history sequence is learned by the transformer, the learned course vector sequence is output, and the representation vectors are added together as the vector representation of the user portrait.

[0107] Among them, in step 4.2), the user history sequence is sequenced and time-coded, including the following steps:

[0108] 4.2.1) For each user, each record is numbered and coded as k = [0, 1, 2..., n] according to the course learning sequence, where sequence number i represents the i-th course that the user has studied after joining the platform;

[0109] 4.2.2) Since users may register for multiple courses in a short period of time, or register for two courses with a long interval between them, we use the registration time interval to further capture the information contained in user behavior and calculate the registration time t for each course. i Registering for your first course 0 The time interval Δt 0i ;

[0110] For example, for a user, there are operations in one online process, such as data structure 10:20, java system 10:21. There are also operations that are separated by a long time, such as c++ 2020-05-13, probability theory and mathematical statistics 2020-12-05. After a long span, the user may have learned the previous courses in this process, and the interests are constantly evolving, so it is inaccurate to describe user behavior only using location information.

[0111] 4.2.3) In order to be able to describe the registration course time interval for users in a personalized way, the time interval Δt 0i Do minmax standardization and set Δt 0i Scaling to 0-k max Between max represents the length of the user's history record, and the scaled time interval is denoted as t(v k );v k represents the original time difference, t(v k ) represents the scaled time interval.

[0112] in,

[0113]

[0114] X std =X std *(max-min)+min

[0115] Where, X std represents the standard deviation of the data, and X represents the time difference series of the user's historical records;

[0116] max is set to the maximum length of the history record, min is 0, and the registration time interval Δt 0i Scaling to 0-k max between.

[0117] 4.2.4) Add the position information and time information to obtain the final coding order information TPos (v k );

[0118] TPos(v k )=k+t(v k )

[0119] 4.2.5) Use sin and cos periodic functions to expand the final encoding order information TPos (v k ) has the same dimension as the course vector representation;

[0120] where the value p of each dimension is calculated using the sin and cos periodic functions to expand it to the same dimension n as the vector k (i)

[0121]

[0122] 4.2.6) Set TPos(v k ) is input into the vector representation of the corresponding course, so that the course representation vector contains the information of the knowledge graph and the user behavior information;

[0123] Among them, the Transformer encoder layer is composed of a multi-head attention mechanism (Multi-Head Self-Attention Layer), a feedforward network (Position-wise Feed-Forward Layer) and normalization and connection (Addand Norm).

[0124] In the above step 5), the user portrait is concatenated with the target course vector to obtain a new vector with expanded dimension, which is input into the DNN network to train the learning model, specifically:

[0125] After the DNN network is fully connected, the weights are iteratively updated using the gradient descent method. Several weight coefficient matrices W and bias vectors b are used to perform linear operations and activation operations with the input value vector x. Starting from the input layer, the calculation is performed backward layer by layer until the output layer is reached to obtain the output result value. The data range of the DNN output is set to 0-1, which represents the predicted recommendation score.

[0126] The user set is divided into a training set and a test set, and the training set is input into the learning model for learning until the learning model converges.

[0127] DNN network is a forward propagation neural network with many hidden layers. The neural network layers inside DNN can be divided into three types: the first layer is the input layer, the last layer is the output layer, and the middle layer is the hidden layer. Each layer is fully connected, and any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. The relationship between layers is connected using activation functions and linear relationships, which is z=σ(∑w i x i +b). Where σ is the activation function, w is the linear relationship coefficient, and b is the deviation.

[0128] The specific steps include:

[0129] 5.1) Initialization parameters, the linear coefficient from the kth neuron in the l-1th layer to the jth neuron in the 1st layer is defined as The bias value b is defined as: The b of the ith neuron in the nth layer is defined as The output of the previous layer is used to calculate the output of the next layer. The output of the jth neuron in the first layer is

[0130]

[0131] 5.2) Use the stochastic gradient descent algorithm to iteratively update the weights, iteratively updating each sample once, the formula is as follows:

[0132]

[0133]

[0134] In the formula, J(θ) represents the loss function value, m represents the sample size, and h θ (x i ) represents the model prediction value, y i represents the actual value, and θ represents the parameter;

[0135] Use the loss function of each sample to obtain the corresponding gradient and update it:

[0136]

[0137] Among them, θ j represents the updated parameters, The input vector representing the sample;

[0138] 5.3) When the loss function no longer decreases and the model converges, the predicted recommendation score is output and the data range is set to 0-1.

[0139] In the above step 6), generating a recommendation list for the user according to the click probability output by the trained learning model includes the following steps:

[0140] 6.1) The user set of the test data is input into the trained learning model, and the course candidate set is all courses except those input into the model learning to simulate the real scenario;

[0141] 6.2) Each candidate item in the candidate set is combined with the user history record to learn the learning model and output the click probability;

[0142] 6.3) Sort the click probability values ​​of all items from high to low, select the first K items after sorting as the recommendation results, and output the ID number of the item;

[0143] 6.4) Repeat the above steps until the recommendation lists of all users are output.

[0144] In one embodiment of the present invention, a knowledge graph-based online course recommendation system is provided, which includes:

[0145] The extraction module extracts entities and constructs the online course knowledge graph based on the information and features of the online courses;

[0146] The feature learning module inputs the triples in the knowledge graph into the representation learning model for feature learning to obtain entity and relationship vectors;

[0147] The data acquisition module extracts the user's historical study records and corresponds them to the course library to obtain the user's course-sequence data;

[0148] The processing module uses the transformer encoder part of the deep learning model to learn the historical records of each user and add time information to train the user profile to characterize the user's preferences.

[0149] The training module concatenates the user portrait with the target course vector to obtain a new vector with expanded dimensions, which is then input into the DNN network to train the learning model.

[0150] The recommendation list generation module generates a recommendation list for users based on the click probability output by the trained learning model.

[0151] The system provided in this embodiment is used to execute the above-mentioned method embodiments. Please refer to the above-mentioned embodiments for specific processes and detailed contents, which will not be repeated here.

[0152] like Figure 5As shown, it is a schematic diagram of the structure of a computing device provided in an embodiment of the present invention. The computing device can be a terminal, which can include: a processor, a communication interface, a memory, a display screen and an input device. Among them, the processor, the communication interface and the memory complete mutual communication through a communication bus. The processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. When the computer program is executed by the processor, it implements an online course recommendation method; the internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be realized through WIFI, a management network, NFC (near field communication) or other technologies. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the housing of the computing device, or an external keyboard, touchpad or mouse. The processor can call the logic instructions in the memory to execute the following method: extract entities and construct an online course knowledge graph based on the information and features of the online course; input the triples in the knowledge graph into the representation learning model for feature learning to obtain entity and relationship vectors; extract the user's historical study records and correspond them to the course library to obtain user course-sequence data; for each user, use the deep learning model transformer encoder part to learn the historical records that add time information and train the user portrait to characterize the user's preferences; concatenate the user portrait with the target course vector to obtain a new vector with expanded dimension, input it into the DNN network, and train the learning model; generate a recommendation list for the user based on the click probability output by the trained learning model.

[0153] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0154] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the computing device to which the scheme of the present application is applied. The specific computing device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0155] In one embodiment of the present invention, a computer program product is provided, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, wherein the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: extracting entities to construct an online course knowledge graph based on the information and features of the online course; inputting the triples in the knowledge graph into a representation learning model for feature learning to obtain entity and relationship vectors; extracting the user's historical study records and corresponding them to the course library to obtain user course-sequence data; for each user, using the transformer encoder part of the deep learning model to learn the historical records that add time information, and training the user portrait to characterize the user's preferences; concatenating the user portrait with the target course vector to obtain a new vector with expanded dimension, and inputting it into the DNN network to train the learning model; and generating a recommendation list for the user based on the click probability output by the trained learning model.

[0156] In one embodiment of the present invention, a non-transitory computer-readable storage medium is provided, which stores server instructions, and the computer instructions enable a computer to execute the methods provided by the above embodiments, for example, including: extracting entities to construct an online course knowledge graph based on the information and features of the online course; inputting the triples in the knowledge graph into the representation learning model for feature learning to obtain entity and relationship vectors; extracting the user's historical study records and corresponding them to the course library to obtain user course-sequence data; for each user, using the deep learning model transformer encoder part to learn the historical records that add time information, and training the user portrait to characterize the user's preferences; splicing the user portrait with the target course vector to obtain a new vector with expanded dimension, inputting it into the DNN network, and training the learning model; generating a recommendation list for the user based on the click probability output by the trained learning model.

[0157] The above embodiment provides a computer-readable storage medium, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0158] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0159] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. 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. However, 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 embodiments of the present invention.

Claims

1. A method for recommending online courses based on knowledge graph, characterized in that: include: According to the information and features of online courses, entities are extracted to build the online course knowledge graph; Inputting the triples in the knowledge graph into a representation learning model for feature learning to obtain entity and relationship vectors; Extract the user's historical study records and correspond them with the course library to obtain the user's course-sequence data; For each user, the transformer encoder part of the deep learning model is used to learn the historical records with time information and train the user profile to characterize the user's preferences. The user portrait is concatenated with the target course vector to obtain a new vector with expanded dimension, which is input into the DNN network to train the learning model. Generate a recommendation list for the user according to the click probability output by the trained learning model; The transformer encoder part of the deep learning model is used to learn the historical records of adding time information and train the user profile, including: Count the maximum length, minimum length and average length of user history records, select a fixed length as maxlen to split the historical learning records, and if the user history record is less than maxlen, fill it with 0 and add a positive infinite number; Encode the user history sequence in order and time, so that the course representation vector contains the knowledge graph information and user behavior information; Use the multi-head attention mechanism to train the weights of the historical sequence, split the dimension d into h parts, each with a dimension of d / h, and each vector contains different information; The output of the multi-head attention layer is sent to the normalization and residual connection layer for processing. The features include residual connection and normalization, which is equivalent to adding the input vector to the output vector. The output enters the Feed Forward Neural Network layer and undergoes two layers of activation functions to undergo full connection dimension transformation. The output of the feedforward neural network is input into the residual connection and normalized again; After the user history sequence is learned by the transformer, the learned course vector sequence is output, and the representation vectors are added together as the vector representation of the user portrait; The step of sequentially and time-coding the user history sequence includes: For each user, each record is numbered and coded as k = [0, 1, 2..., n] according to the course learning sequence. Sequence number i represents the i-th course that the user has studied after joining the platform. Use the course registration time interval to further capture the information contained in user behavior and calculate the registration time t for each course. i The time interval Δt from the first course registration t0 0i ; For time interval Δt 0i Do minmax standardization and set Δt 0i Scaling to 0-k max Between max represents the length of the user's history record, and the scaled time interval is denoted as t(v k ); Add the position information and time information to get the final coding order information TPos (v k )=k+t(v k ); Using sin and cos periodic functions, expand TPos(v k ) has the same dimension as the course vector representation; TPos(v k ) is input into the vector representation of the corresponding course, so that the course representation vector contains the information of the knowledge graph and user behavior information.

2. The online course recommendation method based on knowledge graph as claimed in claim 1, characterized in that: The extracting entities and constructing the online course knowledge graph according to the information and features of the online course includes: Extract entities and relationships based on the user's historical learning records and course-related features; Number the extracted entities and relations, starting from 0 for entity e to n, and starting from 0 for relation r; Relates head entity e through relationship r h and tail entity e t , the numbers are formed into triples <e h ,r,e t >.

3. The online course recommendation method based on knowledge graph as claimed in claim 1, characterized in that: The step of inputting the triples in the knowledge graph into the representation learning model to perform feature learning and derive entity and relationship vectors includes: The learning model is trained based on the negative sampling method. <e h ,r,e t > Get negative example triples by replacing the head and tail nodes <e h ',r,e t ′>; Initializing the parameters of the learning model, including a mapping matrix and a node relationship representation vector; Based on the learning of positive and negative triplets, the distance between the head and tail nodes of the negative triplet is maximized, and the distance between the head and tail nodes of the positive triplet is minimized. The model is optimized according to the loss function, and the parameters are continuously updated until the loss function stops decreasing and the learning model converges. The learning model outputs the representation vectors of entities and relationships.

4. The online course recommendation method based on knowledge graph as claimed in claim 1, characterized in that: The user portrait is concatenated with the target course vector to obtain a new vector with expanded dimension, which is input into the DNN network to train the learning model, including: After the DNN network is fully connected, the weights are iteratively updated using the gradient descent method. Several weight coefficient matrices W and bias vectors b are used to perform linear operations and activation operations with the input value vector x. Starting from the input layer, the calculation is performed backward layer by layer until the output layer is reached to obtain the output result value. The data range of the DNN output is set to 0-1, which represents the predicted recommendation score. The user set is divided into a training set and a test set, and the training set is input into the learning model for learning until the learning model converges.

5. The online course recommendation method based on knowledge graph as claimed in claim 1, characterized in that: Generating a recommendation list for a user according to the click probability output by the trained learning model includes: The user set of the test data is input into the trained learning model, and the course candidate set is all courses except those input into the model learning to simulate the real scenario; Each candidate item in the candidate set is combined with the user's historical record to learn the learning model and output the click probability; Sort the click probability values ​​of all items from high to low, select the first K items after sorting as the recommendation results, and output the ID number of the item; Repeat the above process until the recommendation lists of all users are output.

6. An online course recommendation system based on knowledge graph, characterized in that: include: The extraction module extracts entities and constructs the online course knowledge graph based on the information and features of the online courses; A feature learning module, which inputs the triples in the knowledge graph into a representation learning model to perform feature learning and obtain entity and relationship vectors; The data acquisition module extracts the user's historical study records and corresponds them to the course library to obtain the user's course-sequence data; The processing module uses the transformer encoder part of the deep learning model to learn the historical records of each user and add time information to train the user profile to characterize the user's preferences. The training module concatenates the user portrait with the target course vector to obtain a new vector with expanded dimensions, which is then input into the DNN network to train the learning model. A recommendation list generation module generates a recommendation list for the user according to the click probability output by the trained learning model; The transformer encoder part of the deep learning model is used to learn the historical records of adding time information and train the user profile, including: Count the maximum, minimum and average lengths of user history records, select a fixed length as maxlen to split the historical learning records, and if the user history record is less than maxlen, fill it with 0 and add a positive infinite number; Encode the user history sequence in order and time, so that the course representation vector contains the knowledge graph information and user behavior information; Use the multi-head attention mechanism to train the weights of the historical sequence, split the dimension d into h parts, each with a dimension of d / h, and each vector contains different information; The output of the multi-head attention layer is sent to the normalization and residual connection layer for processing. The features include residual connection and normalization, which is equivalent to adding the input vector to the output vector. The output enters the Feed Forward Neural Network layer and undergoes two layers of activation functions to undergo full connection dimension transformation. The output of the feedforward neural network is input into the residual connection and normalized again; After the user history sequence is learned by the transformer, the learned course vector sequence is output, and the representation vectors are added together as the vector representation of the user portrait; The step of sequentially and time-coding the user history sequence includes: For each user, each record is numbered and coded as k = [0, 1, 2..., n] according to the course learning sequence. Sequence number i represents the i-th course that the user has studied after joining the platform. Use the course registration time interval to further capture the information contained in user behavior and calculate the registration time t for each course. i The time interval Δt from the first course registration t0 0i ; For time interval Δt 0i Do minmax standardization and set Δt 0i Scaling to 0-k max Between max represents the length of the user's history record, and the scaled time interval is denoted as t(v k ); Add the position information and time information to get the final coding order information TPos (v k )=k+t(v k ); Using sin and cos periodic functions, expand TPos(v k ) has the same dimension as the course vector representation; TPos(v k ) is input into the vector representation of the corresponding course, so that the course representation vector contains the information of the knowledge graph and user behavior information.

7. A computer-readable storage medium storing one or more programs, characterized in that: The one or more programs include instructions, which, when executed by a computing device, cause the computing device to perform any one of the methods of claims 1 to 5.

8. A computing device, characterized in that include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing any one of the methods described in claims 1 to 5.