# Research on Learning Resource Recommendation Based on Knowledge Graph and Collaborative Filtering
## 2 Methods
### The Knowledge Graph-Based Recommendation Algorithm  
Knowledge graph is a knowledge representation format based on a graph structure used to capture semantic relationships between knowledge entities. It consists of inter connected entities, attributes, and relationships, typically represented as triples (h, r, t), where 'h' represents the head entity, 'r' signifies the relationship, and 't' denotes the tail entity. The foundational TransE model, pioneered by [PERSON] et al. [38], involves vectorizing entities and relationships in a vector space, aiming to make the vector addition of the head entity 'h' and the relationship 'r' approximately equal to the vector of the tail entity 't'. However, the TransE model exhibits limitations and is better suited for one-to-one relationships, struggling to perform well in scenarios involving one-to-many, many-to-one, or many-to-many relationships [39]. In response, subsequent models like TransH [40], TransR [41], and TransD [42] were introduced to address these shortcomings.  
In typical recommendation systems, each user is associated with multiple items, which can introduce certain challenges when employing conventional models. The TransD model represents an advancement over the TransE model and specifically addresses the management of many-to-many relationships. It excels at resolving the correspondence issue between users and items. The TransD model introduces two projection matrices: one for mapping entities and another for relationships. These matrices are determined based on the specific entities and relationships in the system. The model maps entities and relationships into distinct vector spaces and employs trainable transformation matrices to transition them from one vector space to another. This innovative approach empowers the TransD model to effectively handle diverse types of relationships while preserving consistent entity distances. The structural representation of the TransD model is illustrated in Figure 1.  
In this model, each head entity, relationship, and tail entity is represented by two vectors. One vector encapsulates its intrinsic semantics, while the other vector contributes to the formation of a matrix within the mapping space. The projection matrices are denoted as \(M_{rh}\) and \(M_{rt}\), serve the purpose of projecting the head entity and tail entity from the entity space into the relation space. These projections can be derived from Equations (1) and (2), with \(I\) representing the identity matrix.  
\[M_{rh}=r_{p}h_{p}^{\top}+I^{m\times n} \tag{1}\]  
\[M_{rt}=r_{p}t_{p}^{\top}+I^{m\times n} \tag{2}\]  
In the formula, \(h_{p}\), \(r_{p}\), and \(t_{p}\) represent the mapping vectors of each vector, and the projection matrix can consider both entities and relationships. Initialize the projection matrix by adding the identity matrix \(I\).  
\[h_{\texttt{i}\bot}=M_{rh}h \tag{3}\]  
\[t_{\texttt{i}\bot}=M_{rt}\texttt{t} \tag{4}\]  
Using the projection matrix, the projection of the head entity vector h and tail entity vector t can be obtained from Formulas (3) and (4). Two projection matrices can be applied to the head entity vector \(h_{\texttt{i}}\) (i = 1, 2, 3...) and tail entity vector \(t_{\texttt{i}}\) (i = 1, 2, 3...) respectively,  
Figure 1: Structure of the TransD Model.  
ultimately obtaining the projection vectors of each entity vector in the relational space, such as \(h_{\perp\perp}\)(i = 1, 2, 3...) and \(i_{\perp\perp}\)(i = 1, 2, 3...).