# Using Graph Neural Networks for Social Recommendations
## 3 Methodology
### Problem Statement  
Within a RS, there exist two groups of entities:  
* Users' set \(U\) with \(m\) users \(|U|=m\)
* Items' set: \(V\) with \(n\) items \(|V|=n\)  
In such a system, we assume that as users interact with items, we can collect (or infer) their preferences. Such preferences can be explicitly stated in the form of likes/dislikes (e.g., \"thumps up/down\") or ratings but can also be implicit and inferred from their actions (e.g., purchasing an item and binge-watching a TV series). Similar to other graph-based RS architectures, in RelationalNet, we model the user preference \(r_{ui}\) as a binary variable, where \(r_{ui}=1\) if user \(u\) liked item \(i\); else, \(r_{ui}=0\). These preferences \(r_{ui}\) are kept in a \(m\times n\) utility matrix \(R\) consisting of the ratings.  
As previously mentioned, social RSs differentiate from traditional RS in that they incorporate the social graph in the recommendation process; in other words, they leverage the user-user relations. A user-user-directed graph \(G_{S}=(U,U_{S})\), where \(U_{S}\) represents the social connections between users (edges), can be constructed. We represent graph \(G_{S}\) using an adjacency matrix \(S\) of size \(R^{m\times m}\), where each element \(s_{u_{1}u_{2}}=1\) if user \(u_{1}\) is friends with/follows/trusts user \(u_{2}\); otherwise, it is equal to 0. Note that in the case of friendships (bidirectional edge), the adjacency matrix \(S\) is symmetric, whereas in the case of follows/trust (unidirectional edge), the matrix is asymmetric.  
Similar to user-user social connections, item-item relations are modeled as a graph \(G_{T}=(V,V_{T})\), where \(V_{T}\) represents the item-item connections (edges) between items (nodes). We represent graph \(G_{T}\) using an adjacency matrix \(T\) of size \(R^{n\times m}\), where each element \(t_{i_{1}i_{2}}=1\) if item \(i_{1}\) is similar to item \(i_{2}\); otherwise, it is equal to 0. Consequently, this is a symmetric adjacency matrix. We can define a similarity function that is domain based, like common characteristics, category, etc.  
Additionally, every user is associated with a real-valued embedding denoted as \(x_{a}\) in the user embedding matrix \(X\in R^{D\times m}\), where \(D\) is the number of embedded features (or dimensions) of each user \(a\). Similarly, every item is associated with a real-valued embedding denoted as \(y_{i}\) in the item embedding matrix \(Y\in R^{D\times n}\), where \(D\) is the number of embedded features (or dimensions) of each item \(i\).  
As previously mentioned, in CF RSs, the objective is to predict unknown/unseen ratings (or, in general preferences) of users for items given as input a utility matrix that includes the past users' ratings (or preferences) for items. In our work, we generalize this objective to incorporate additional relations, as follows.  
Given a utility matrix \(R\) consisting of the ratings \(r_{ui}\) of users \(u\) for items \(i\), the user-user social network adjacency matrix (\(S\)), the item-item network adjacency matrix (\(T\)), and the two associated real-valued embedded matrices for users (\(X\)) and items (\(Y\)) predict the unknown/unseen preferences/ratings of users towards items, represented by the \(m\times n\) matrix \(\hat{R}\):  
\[\hat{R}=f(R,S,T,X,Y) \tag{1}\]