1 Introduction

Recommender systems have widely followed the collaborative filtering strategy, where similar-minded users tend to get similar recommendations [8]. In real-world scenarios, the main limitation of collaborative filtering strategy is the data sparsity of users’ preferences, significantly degrading the recommendation accuracy. To overcome the data sparsity problem and generate trust-based recommendations, several models exploit the selections of trust friends [4, 12]. In trust-based recommendations, models consider that people tend to rely on recommendations from their friends [6, 10]. In addition, in online networks users may establish both trust and distrust relationships, while the vast majority of users have unknown relationships. EpinionsFootnote 1, an e-commerce site for reviewing and rating products, allows users to evaluate others based on the quality of their reviews, and form trust and distrust relations with them. In SlashdotFootnote 2 users post news and comments, and tag other users as friends or foes. The analyses in related studies conclude that users might accept recommendations from their trusted friends, but will certainly exclude recommendations from their distrusted foes [20, 21, 23]. In this respect, more recently a few attempts have been made to exploit both trust and distrust relationships at the same time in recommender systems [1, 2, 15, 19]. Following the collaborative filtering strategy, these models assume that the latent features of trust/distrust users should be as close/far as possible. However, such models exploit trust and distrust relationships in an explicit manner, that is users’ direct friends or foes, and do not infer implicit (indirect) social relationships that users establish in recommender systems. Due to the presence of sparsity in social relationships, models that use trust and distrust relationships exploit a limited number of social relationships, thus not performing well as we will show in our experiments in Sect. 5.

Inferring social relationships of trust and distrust users is a challenging task [20]. Given explicit social relationships, the goal is to infer the indirect relationships of trust and distrust users. Trust relationships show strong transitivity, which means that inferring trust relationships can be computed in a network of trust users, mainly because if two users a and b are friends and a third user c is friend with a, then user c might be a friend of b as well. However, recent studies showed that distrust is certainly not transitive [3, 21, 23]. Therefore, distrust cannot be considered as the negative of trust when inferring users’ distrust relationships. Accounting for the transitivity of trust relationships, a few prediction models have been proposed to infer the implicit trust relationships, while exploiting explicit distrust relationships in their predictions [7, 20]. Nonetheless, these models are designed to predict missing-trust relationships and not to generate recommendations. Therefore, a pressing challenge resides on how to infer trust relationships of users with their distrust relationships to boost the recommendation accuracy.

1.1 Contribution

To overcome the shortcomings of existing methods our contributions are summarized as follows, first we infer implicit trust relationships with multiple random walks while considering the users’ explicit distrust relationships during the inference. By significantly enhancing users’ relationships and reducing the number of unknown relationships, we formulate a social regularization term to weigh users’ trust and distrust degrees and capture the correlations of users’ preferences with those of their friends and foes. We introduce a regularization method and design an objective function as a minimization problem with respect to the latent features, and solve our recommendation problem via gradient descent. Our experiments show that the proposed approach is superior to all the competitors at different levels of sparsity in users’ preferences, as well as in users’ social relationships.

The remainder of the paper is organized as follows, Sect. 2 reviews the related work and in Sect. 3 we formally define our problem. Section 4 details the proposed model, Sect. 5 presents the experimental results and Sect. 6 concludes the study.

2 Related Work

In trust-based recommender systems, many different strategies have been introduced to exploit the selections of trust users. Jamali and Ester [6] extend the probabilistic matrix factorization of [12] by weighting the user latent factors based on their trust relationships. In [10], a trust-based ensemble method is presented to combine matrix factorization with a social-based neighborhood model. In [5], a random walk model is introduced to incorporate a trust-based approach into a neighborhood-based collaborative filtering strategy. In this study, authors run random walks on the trust network, formed by the trust relationships, and then perform a probabilistic item selection strategy to generate recommendations. The random walk performs the search in the trust network and the item selection part considers ratings on similar items to avoid going too deep in the network. However, TrustWalker does not infer implicit (indirect) trust relationships, as it performs random walks to generate recommendations using a neighborhood-based model. Guo et al. [4] extend SVD++ [8], to learn both the user preferences and the social influence of her friends. However, all the above studies ignore users’ distrust relationships when generating recommendations, an important factor to boost the recommendation accuracy [23]. Ma et al. [11] present a social regularization method by sharing a common user-item matrix, factorized by ratings and social relationships. This work introduces a trust-based as well as a distrust-based model to exploit trust and distrust relationships in each model separately. The goal of the trust-based model is to minimize the distances of latent features between trust users, while the distrust-based model tries to maximize the latent features’ distances between distrust users.

Recently, a few attempts have been made to exploit both trust and distrust relationships at the same time in recommender systems. Forsati et al. [2] incorporate trust and distrust relationships into a matrix factorization framework, by formulating a hinge loss function. This method assumes that the trust/distrust relationships between users are considered as similarity/dissimilarity in their preferences, and then the latent features are computed in a manner such that the latent features of foes who are distrusted by a certain user have a guaranteed minimum dissimilarity gap from the maximum dissimilarity of friends who are trusted by this user. This means that when the user agrees on an item with one of her trusted friends, she will probably disagree on the same item with her distrusted foes, assuming a minimum predefined margin. In [1], a recommendation strategy is introduced to rank the latent features of users, based on the users’ trust and distrust relationships. This method also considers the neutral relationships (of users who have no relation to a certain user), aiming to rank the user latent features after the trust relationships and before the distrust ones. In [15] a signed graph is constructed, considering positive and negative weights for the trust and distrust relationships, respectively. Then, a spectral clustering approach is presented to generate clusters in the signed graph. The clusters are extracted on condition that users with positive connections should lie close, while users with negative ones should lie far. Following a joint non-negative matrix factorization framework the final recommendations are generated, by co-factorizing the user-item and user-cluster associations. Tang et al. [19] form a signed graph with trust and distrust relationships and capture local and global information from the graph. Local information reveals the correlations among a user and her friends/foes, and the global information reveals the reputation of the user in the whole social network, as users tend to trust users with high global reputation. Then, they exploit both local and global information in a matrix factorization technique to produce recommendations.

3 Problem Formulation

Let n and m be the numbers of users and items. Given a rating matrix \(\mathbf {R}\in \mathbb {R}^{n \times m}\), each entry \(\mathbf {R}_{iq}\) corresponds to the rating that user i has assigned to item q, with \(i=1\ldots n\) and \(q=1\ldots m\). If a user i has not rated an item q, then we set \(\mathbf {R}_{iq}=0\). In our approach we follow the collaborative filtering strategy of matrix factorization. This means that by factorizing the matrix \(\mathbf {R}\), the recommendations are in its low-rank approximation \(\hat{\mathbf {R}}\in \mathbb {R}^{n \times m}\). Matrix \(\hat{\mathbf {R}}\) can be calculated as \(\hat{\mathbf {R}}=\mathbf {U}\mathbf {V}^\top \), where \(\mathbf {U}\in \mathbb {R}^{n \times d}\) is the user factor matrix, and \(\mathbf {V}\in \mathbb {R}^{m \times d}\) is the item factor matrix with d the number of latent dimensions. To consider users’ trust and distrust relationships, we also form a graph \(\mathcal {G}\) with \(n=|\mathcal {V}|\) nodes and \(i,j \in \mathcal {V}\). Two nodes are connected with edges in the form \((i,j) \in \mathcal {E}\). The edges are considered weighted, and in our setting we consider positive and negative weights to express trust and distrust relationships, respectively. Both positive and negative weights are stored in an adjacency matrix \(\mathbf {A} \in \mathbb {R}^{n \times n}\). In our approach we generate two different graphs, a graph \(G_+\) which contains only the positive edges and a second graph \(G_-\) with the negative ones. Given \(\mathcal {E}\equiv \mathcal {E}_+\cup \mathcal {E}_-\), we compute two different adjacency matrices \(\mathbf {A}_+\in \mathbb {R}^{n \times n}\) and \(\mathbf {A}_-\in \mathbb {R}^{n \times n}\), corresponding to the weights of the positive \((i,j)_+ \in \mathcal {E}_+\) and negative \((i,j)_- \in \mathcal {E}_-\) edges/relationships. In addition, \(\forall (i,j)_-\in \mathcal {E}_-\) we set \((\mathbf {A}_-)_{ij}=|\mathbf {A}_{ij}|\), storing the absolute values of the negative weights. With this setting, the goal of the proposed approach is formally defined as follows:

Definition 1

(Problem). “Given (i) the rating matrix \(\mathbf {R}\) and (ii) the adjacency matrices \(\mathbf {A}_+\) and \(\mathbf {A}_-\) with the trust and distrust relationships, the goal of the proposed approach is first to infer the implicit trust relationships based on users’ explicit trust and distrust relationships, and then compute the low-rank approximation \(\hat{\mathbf {R}}=\mathbf {U}\mathbf {V}^\top \) to generate the final recommendations.”

4 Proposed Approach

4.1 Social Inference via Multiple Random Walks

To infer the implicit trust relationships, we perform random walks on the n nodes in graph \(\mathcal {G}_+\), by taking into account the distrust relationships in graph \(\mathcal {G}_-\) during the inference. In particular, the proposed approach runs multiple random walks on the graph \(\mathcal {G}_+\) with the trust relationships and then filters out the inferred trust relationships by considering the distrust relationships in graph \(\mathcal {G}_-\). The main reason that we avoid to perform random walks on graph \(\mathcal {G}_-\) is that distrust is not transitive, as opposed to trust [7, 20, 21, 23]. Next, we present the case of performing a single random walk on graph \(\mathcal {G}_+\) and we show how to perform multiple random walks to better infer the implicit trust relationships.

Single Random Walk. Given a source node sou and a target node tar in graph \(\mathcal {G}_+\), with \((sou,tar) \notin \mathcal {E}_+\), the goal is to start a random walk from sou to reach tar to infer their trust relationships, denoted as \((\mathbf {\overline{A}}_+)_{sou,tar}\). We assume that the walk moves from one node to a neighbourhood node at each step, and at time t has moved to node i. The walk chooses whether to move to another node with probability \(\xi _t\) or terminate the walk with probability \(1-\xi _t\). In the case of terminating the walk, the value \((\mathbf {\overline{A}}_+)_{sou,tar}\) is returned only if edge \((i,tar) \in \mathcal {E}_+\), and 0 otherwise. The transition probability of moving from a current node i to another node j is calculated as follows:

$$\begin{aligned} p_+(j|i)=\mathbf {(A_+)}_{ij}/d_i \end{aligned}$$
(1)

where \(d_i=\sum _{j}{(\mathbf {A}_+)_{ij}}\) is the degree of i. The transition matrix \(\mathbf {T}_+ \in \mathbb {R}^{n \times n}\) of a random walk is given by

$$\begin{aligned} \mathbf {T}_+=\mathbf {D}_+^{-1}\mathbf {A}_+ \end{aligned}$$
(2)

where \((\mathbf {D}_+)_{ii}=d_i\) is the degree diagonal matrix, with \(\mathbf {D}_+\in \mathbb {R}^{n \times n}\). A vector \(\mathbf {p}_+ ^{(t)} \in \mathbb {R}^n\) represents the visiting distribution over all n nodes at a certain time t. With these settings, if the walk continues at the next time \(t+1\), the distribution vector will be updated as follows:

$$\begin{aligned} \mathbf {p}_+^{(t+1)}=\mathbf {p}_+^{(t)}\times \mathbf {T}_+ \end{aligned}$$
(3)

In the case of isolated users, random walks are not performed, as these users have not expressed their social preferences.

Multiple Random Walks. Instead of performing a single walk, we run multiple random walks from a source node in graph \(\mathcal {G}_+\) to better infer the implicit trust relationships. The main reason that we can achieve better inference is that multiple random walks start from the source user sou to seek more alternatives for the implicit (indirect) relationship to the target user tar. Given the graph \(\mathcal {G}_+\), we define s as the total length of a single walk for which we recursively update the distribution vector \(\mathbf {p}^{(s)}\). For a target node tar we consider all its in-linked edges, denoted by \((\mathbf {A}_+)_{*tar}\), that is the tar-th column vector of \(\mathbf {A}_+\). With these settings, the returned value for a random walk terminated at time s is:

$$\begin{aligned} (\mathbf {\overline{A}}_+)_{sou,tar}|s=\mathbf {p}^{(s)}(\mathbf {A}_+)_{*tar} \end{aligned}$$
(4)

Theoretically, we can perform random walks with infinite lengths from the source node. Aggregating the multiple random walks from the source node we have:

$$\begin{aligned} (\mathbf {\overline{A}}_+)_{sou,tar}=\sum _{t=1}^{\infty }\omega _+(t)\mathbf {p}_+^{(0)}\mathbf {T}_+^t(\mathbf {A}_+)_{*tar} \end{aligned}$$
(5)

where \(\mathbf {p}_+^{(0)}\) is the starting distribution of a walk on \(\mathcal {G}_+\) and \(\omega _+(t)\) expresses the probability that a random walk will terminate at a certain time t:

$$\begin{aligned} \omega _+(t)= p_+(s=t|\xi )=\xi _t\prod _{i=1}^{t-1}{(1-\xi _i)} \end{aligned}$$
(6)

Therefore, the adjacency matrix \(\mathbf {\overline{A}}_+\) with the inferred trust relationships is calculated as follows:

$$\begin{aligned} \mathbf {\overline{A}}_+=\sum _{t=1}^{\infty }\omega _+(t)\mathbf {T}_+^t\mathbf {A}_+ \end{aligned}$$
(7)

In our implementation, we avoid long (infinite) walks on the graph, following the idea of the “six degrees of separation”, that is most nodes can be reached with a six step walk length [13]. This means that if a walk has reached more than six steps, then the walk is terminated. In practice, we observed that random walks do not reach more than 4 steps in our experiments with \(\xi _t=0.85\), equal to the dampening factor of PageRank [14]. Next, the inferred trust relationships are stored in matrix \(\mathbf {\overline{A}}_+\).

When performing multiple random walks on graph \(\mathcal {G}_+\), the distrust relationships in graph \(\mathcal {G}_-\) are ignored. Consequently, an inferred trust relationship between a source user sou and a target user tar in \(\mathbf {\overline{A}}_+\), might have a distrust relationship between sou and tar in graph \(\mathcal {G}_-\). Since users do not accept the recommendations of distrust users [2, 7], we recompute matrix \(\mathbf {\overline{A}}_+\) by setting \(\mathbf {\overline{A}}_+ \leftarrow 0\), if \(\mathbf {(\overline{A}}_+)_{ij}>0 \wedge (\mathbf {A}_-)_{ij} >0, \forall i,j=1\dots n\). Finally, the filtered trust relationships and their positive weights are stored into the initial adjacency matrix with the trust relationships, by setting \(\mathbf {A}_+ \leftarrow \mathbf {\overline{A}}_+\).

4.2 Regularization Method

To generate the recommendations in our regularization method, we have to compute the low rank approximation \(\hat{\mathbf {R}}\) based on the inferred trust relationships in \(\mathbf {A}_+\) and the distrust relationships in \(\mathbf {A}_-\). We first capture the user-based similarities using the rating matrix \(\mathbf {R}\). If users i and j have interacted with at least a common item q, then users i and j are connected based on their preferences [22]. The preferences’ connections/similarities are stored in a similarity matrix \(\mathbf {S} \in \mathbb {R}^{n \times n}\), whose ij-th entries are calculated as follows:

$$\begin{aligned} \mathbf {S}_{ij}= {\left\{ \begin{array}{ll} \frac{\sum \limits _{q=1}^{m}\mathbf {R}_{iq}\mathbf {R}_{jq}}{\sqrt{\sum \limits _{q=1}^{m} \mathbf {R}_{iq}^2} \sqrt{\sum \limits _{q=1}^{m}\mathbf {R}_{jq}^2}} &{},\quad \text {if users}\,\, i\,\, \text {and}\,\,j\,\, \text {are connected} \\ 0 &{},\quad \text {otherwise} \end{array}\right. } \end{aligned}$$
(8)

with i, \(j=1,\ldots ,n\).

Next, we form the neighbourhoods \(\mathcal {N}_+^i\) and \(\mathcal {N}_-^i\) based on the adjacency matrices \(\mathbf {A}_+\) and \(\mathbf {A}_-\), respectively, where \(\mathbf {A}_+\) contains the explicit as well as the inferred implicit trust relationships. Given the latent vector \(\mathbf {U}_i\) of user i and the latent vector \(\mathbf {U}_j\) of her friend j, with \(j\in \mathcal {N}_+^i\), their distance \(|| \mathbf {U}_i - \mathbf {U}_j ||_2^2\) should be as close as possible, weighted by the trust degree \((\mathbf {A}_+)_{ij}\) and the preference similarity \(\mathbf {S}_{ij}\). The reason that we consider the similarity between trust users i and j is that trust friends do not necessarily have similar preferences [4]. The higher the similarity between two friends the most likely would be that they have similar preferences. Thus, we weigh the influence of trust friends i and j as follows:

$$\begin{aligned} \sum _{j\in \mathcal {N}_+^i} (\mathbf {A}_+)_{ij} \mathbf {S}_{ij} || \mathbf {U}_i - \mathbf {U}_j ||_2^2 \end{aligned}$$
(9)

Accordingly, for a distrusted user \(k\in \mathcal {N}_-^i\), we have to penalize their distance \(|| \mathbf {U}_i - \mathbf {U}_k ||_2^2\), weighted by the distrust degree \((\mathbf {A}_-)_{ik}\) and their preference dissimilarity \(1-\mathbf {S}_{ik}\) as follows:

$$\begin{aligned} -\sum _{k\in \mathcal {N}_-^i} (\mathbf {A}_-)_{ik} (1-\mathbf {S}_{ik}) || \mathbf {U}_i - \mathbf {U}_k ||_2^2 \end{aligned}$$
(10)

By aggregating Eqs. (9) and (10), we have the following regularization term with respect to a latent vector \(\mathbf {U}_i\), to measure the weighted influence of trust and distrust relationships:

$$\begin{aligned} \begin{aligned} \varPsi (\mathbf {U}_i)&= \sum _{j\in \mathcal {N}_+^i} (\mathbf {A}_+)_{ij} \mathbf {S}_{ij} || \mathbf {U}_i - \mathbf {U}_j ||_2^2 -\sum _{k\in \mathcal {N}_-^i} (\mathbf {A}_-)_{ik} (1-\mathbf {S}_{ik}) || \mathbf {U}_i - \mathbf {U}_k ||_2^2 \end{aligned} \end{aligned}$$
(11)

To compute the latent matrices \(\mathbf {U}\) and \(\mathbf {V}\) we formulate the following objective function \(\mathfrak {L}\) as a minimization problem:

$$\begin{aligned} \begin{aligned}&\min _{\mathbf {U},\mathbf {V}} \mathfrak {L}(\mathbf {U},\mathbf {V}) = ||\mathbf {R}-\mathbf {U}\mathbf {V}^\top ||_F^2 + \lambda (||\mathbf {U}||_F^2+||\mathbf {V}||_F^2) +\alpha \sum _{i=1}^{n}{\varPsi (\mathbf {U}_i)} \end{aligned} \end{aligned}$$
(12)

where the second and third terms are the regularization term to avoid model overfitting and the social regularizer of Eq. (11), respectively. Parameters \(\lambda \) and \(\alpha \) control the influences of the respective regularization terms.

To optimize Eq. (12) we use a gradient-based strategy. As the term \(\varPsi (\mathbf {U}_i)\) in Eq. (11) may become negativeFootnote 3, making the objective function \(\mathfrak {L}\) non-convex, we define an auxiliary matrix \(\mathbf {H} \in \mathbb {R}^{n \times d}\). During the optimization of the objective function \(\mathfrak {L}\) for the iteration iter and \(i=1 \ldots n\) we set \(\mathbf {H}^{iter}_i=1\) if \(\varPsi (\mathbf {U}_i)> 0\), and 0 otherwise. Thus, at the iteration iter we have the following objective function:

$$\begin{aligned} \begin{aligned}&\min _{\mathbf {U},\mathbf {V}} \mathfrak {L}(\mathbf {U},\mathbf {V}) = ||\mathbf {R}-\mathbf {U}\mathbf {V}^\top ||_F^2 + \lambda (||\mathbf {U}||_F^2+||\mathbf {V}||_F^2) \\&+\alpha \sum _{i=1}^{n}{\mathbf {H}^{iter}_i \bigg [\sum _{j\in \mathcal {N}_+^i} (\mathbf {A}_+)_{ij} \mathbf {S}_{ij} || \mathbf {U}_i - \mathbf {U}_j ||_2^2 -\sum _{k\in \mathcal {N}_-^i} (\mathbf {A}_-)_{ik} (1-\mathbf {S}_{ik}) || \mathbf {U}_i - \mathbf {U}_k ||_2^2\bigg ]} \end{aligned} \end{aligned}$$
(13)

As \(\mathfrak {L}\) becomes convex with the auxiliary matrix \(\mathbf {H}^{iter}\), we follow a gradient-based optimization strategy to calculate matrices/variables \(\mathbf {U}\) and \(\mathbf {V}\). Given a learning parameter \(\eta \) we have the following update rules:

$$\begin{aligned} \begin{aligned}&\mathbf {U}^{iter+1}_i \leftarrow \mathbf {U}^{iter}_i-\eta \frac{ \partial {\mathfrak {L}}}{\partial \mathbf {U}^{iter}_i},\quad i=1\dots n \\&\mathbf {V}^{iter+1}_q \leftarrow \mathbf {V}^{iter}_q-\eta \frac{ \partial {\mathfrak {L}}}{\partial \mathbf {V}^{iter}_q},\quad q=1\dots m \end{aligned} \end{aligned}$$
(14)

where the respective gradients at iteration iter are calculated as follows:

$$\begin{aligned} \begin{aligned} \frac{\partial {\mathfrak {L}}}{\partial \mathbf {U}^{iter}_i}&= 2\sum _{q=1}^m \mathbb {I}_{iq}^R (\mathbf {U}_i^\top \mathbf {V}_q - \mathbf {R}_{iq})\mathbf {V}_q +2 \lambda \mathbf {U}_i \\&+ 2\alpha \mathbf {H}^{iter}_i \sum _{j\in \mathcal {N}_+^i} (\mathbf {A}_+)_{ij} \mathbf {S}_{ij} (\mathbf {U}_i - \mathbf {U}_j) \\&- 2\alpha \mathbf {H}^{iter}_i\sum _{k\in \mathcal {N}_-^i} (\mathbf {A}_-)_{ik} (1-\mathbf {S}_{ik}) (\mathbf {U}_i - \mathbf {U}_k) \end{aligned} \end{aligned}$$
(15)
$$\begin{aligned} \begin{aligned}&\frac{\partial {\mathfrak {L}}}{\partial \mathbf {V}^{iter}_q} = 2\sum _{i=1}^n \mathbb {I}_{iq}^R(\mathbf {U}_i^\top \mathbf {V}_q - \mathbf {R}_{iq})\mathbf {U}_i + 2\lambda \mathbf {V}_q \end{aligned} \end{aligned}$$
(16)

where \(\mathbb {I}_{iq}^R \in \{0,1\}^{n\times m}\) is an indicator matrix, with \(\mathbb {I}_{iq}^R=1\) if \(\mathbf {R}_{iq}>0\) and 0 otherwise. Based on the gradients in Eqs. (15) and (16) we can solve the minimization problem of Eq. (13) using the update rules in Eq. (14). Having computed matrices \(\mathbf {U}\) and \(\mathbf {V}\), we reconstruct the initial rating matrix \(\mathbf {R}\) by computing \(\hat{\mathbf {R}}=\mathbf {U}\mathbf {V}^\top \) to generate the final recommendations.

5 Experimental Evaluation

5.1 Experimental Setup

In our experiments, we use a real-world dataset from EpinionsFootnote 4 [3]. For comparison reasons, we conduct our experiments on a down-sampled dataset, at the same scale as in [2, 15]. The down-sampled dataset contains \(n=119,867\) users, \(m=676,436\) product-items and 12,328,927 ratings, including 452,123 trust and 92,417 distrust social relationships. The reason for selecting the dataset is that it is among the most challenging datasets in the relevant literature, as it contains many users and items with high sparsityFootnote 5 in users’ preferences, as well as it includes users’ trust and distrust relationships.

To evaluate the performance of the proposed method, we randomly select a percentage of ratings (iq) as a test set \(\mathcal {T}\), while the remaining ratings are used to train our model. Following relevant studies [2, 11], we evaluate the performance of our model in terms of Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE), which are formally defined as follows

$$\text {MAE}=\frac{\sum _{(i,q)\in \mathcal {T}}|\mathbf {R}_{iq} - \hat{\mathbf {R}}_{iq}|}{|\mathcal {T}|}$$
$$\text {RMSE}=\sqrt{\frac{\sum _{(i,q)\in \mathcal {T}}\big (\mathbf {R}_{iq} - \hat{\mathbf {R}}_{iq}\big )^2}{|\mathcal {T}|}}$$

where \(\hat{\mathbf {R}}\) is the prediction of our model e.g., the low rank approximation matrix, and \(\mathbf {R}\) is the rating matrix with the ratings of the test set \(\mathcal {T}\). The difference between the two evaluation metrics is that RMSE emphasizes more in larger prediction errors than MAE. We repeated our experiments five times and we averaged our results over the five runs.

5.2 Compared Methods

In our experiments, we use the following baseline methods:

  • NMF [9]: a baseline non-negative matrix factorization method, which does not consider neither trust or distrust relationships.

  • MF-distrust [11]: a matrix factorization strategy that incorporates the distrust information, trying to maximize the user latent features of users who are connected with a explicit distrust social relationship. This strategy does not use trust relationships.

  • TrustWalker [5]: a random walk model that exploits explicit trust relationships in a neighborhood-based collaborative filtering strategy. This model ignores users’ distrust relationships.

  • TrustSVD [4]: a model that extends SVD++ [8] to learn both the user preferences and the social influence of her friends. This method does not exploit distrust relationships as well.

We also compare the proposed approach with the following competitive strategies that exploit both trust and distrust relationships:

  • MF-TD [2]: a method that performs matrix factorization such that the latent features of foes who are distrusted by a certain user have a guaranteed minimum dissimilarity gap from the worst dissimilarity of friends who are trusted by this user.

  • JNMF-SG [15]: a method that co-factorizes user-item and user-cluster associations, by partitioning users into clusters with a spectral clustering approach based on users’ trust and distrust explicit relationships.

  • RecSSN [19]: a recommendation method in social signed networks, that considers trust and distrust explicit relationships when generating recommendations. RecSSN captures both local and global information from the signed graph and then exploits both types of information in a matrix factorization scheme.

  • RF: a variant of the proposed method, where we avoid the inference step of Sect. 4.1 and use only the trust and distrust explicit (direct) relationships. This variant is used to show the importance of the social inference step in our regularization method, when implicit trust relationships are missing.

  • MRW-RF: the proposed method that infers social relationships in our regularization method to exploit explicit and implicit relationships.

The parameters of the examined methods have been determined via cross-validation and in our experiments we report the best results. The parameter analysis of the proposed method is further studied in Sect. 5.5.

Fig. 1.
figure 1

Effect on MAE and RMSE when varying the percentage of ratings in the training set, using all explicit relationships.

5.3 Comparison with State-of-the-Art

In Fig. 1 we evaluate the examined models in terms of MAE and RMSE. To show the negative effect of sparsity we train the models with different percentages of ratings. In this set of experiments we use all social explicit relationships. We observe that reducing the training set sizes degrades the recommendation accuracy, indicated by larger errors of MAE and RMSE in all models. Compared to baseline NMF, the trust-based models TrustWalker and TrustSVD are less affected by the presence of sparsity in the reduced training sets, as they exploit users’ trust explicit relationships. However, both TrustWalker and TrustSVD ignore users’ distrust relationships, which explains their limited performance. Also, MF-distrust can reduce the sparsity problem using the distrust relationships. The main reason that MF-distrust performs lower than TrustWalker and TrustSVD is that there are less users’ distrust relationships than trust ones in the Epinions dataset (Sect. 5.1). This complies with several studies reporting that users tend to establish less distrust relationships than trust ones [19, 20].

Clearly, all the recommendation strategies MF-TD, JNMF-SG, RecSSN, RF and MRW-RF that exploit both trust and distrust relationships outperform the baseline methods NMF, MF-distrust, TrustWalker and TrustSVD. The results in Fig. 1 reveal that it is important to exploit both trust and distrust relationships when generating recommendations. An interesting observation is that our RF variant performs significant lower than the proposed MRW-RF approach in all settings. This demonstrates the importance of social inference of implicit relationships in our approach, as RF produces recommendations only with explicit trust and distrust relationships in the regularization method of Sect. 4.2. Instead, the proposed MRW-RF approach efficiently infers the implicit trust relationships and significantly enhances the explicit ones by a factor of 1.72 on average in all five runs. As shown in Fig. 1 MRW-RF beats all its competitors, MF-TD, JNMF-SG and RecSSN, because the competitors use explicit trust and distrust relationships and ignore the implicit trust relationships that users might have. Using the paired t-test, we found that MRW-RF is superior over the competitors in all runs, for \(p<0.01\). Moreover, as friends’ trust and foes’ distrust degrees do not necessarily match with users’ preferences, our regularization method also weighs the influence of the implicit and explicit relationships, which explains the high performance of MRW-RF in all settings. To verify this, we re-ran MRW-RF without considering the terms \(\mathbf {S}_{ij}\) and \(1-\mathbf {S}_{ik}\) in the social regularization term \(\varPsi (\mathbf {U}_i)\) of Eq. (11). In our runs, we observed that the prediction error metrics of MAE and RMSE were significantly increased by 11.29% and 15.62%, respectively, indicating the importance of the weighting strategy in the social regularization term to capture the correlations of users’ preferences with trust and distrust degrees.

Fig. 2.
figure 2

Effect on MAE and RMSE when varying the percentage of explicit relationships and using 50% of the ratings as training set.

5.4 Impact of Social Relationships

Figure 2 shows the impact on MAE and RMSE when varying the percentage of explicit social relationships in the training set. All models are trained with 50% of the ratings. In this set of experiments the explicit relationships, both trust and distrust ones, are randomly removed from the training set to vary the percentage of explicit relationships in 40, 60 and 80%. When downsizing the relationships, we ensure that the same percentage of trust and distrust relationships is removed. The baseline method NMF is used for reference, as its performance is not influenced when varying the percentages of relationships. Figure 2 demonstrates that all the social-based models are negatively affected when using less relationships. Since state-of-the-art models use only explicit relationships, they do not perform well, having high prediction errors in terms of MAE and RMSE. When varying the percentages of explicit relationships, the proposed MRW-RF approach preserves the recommendation accuracy relatively high, as MRW-RF correctly infers the implicit relationships with the inference step of Sect. 4.1. In the case of 40, 60 and 80% relationships, our inference step significantly enhances the reduced relationships, by 3.28, 2.64 and 2.11, respectively. Consequently, MRW-RF is less affected in the presence of sparsity in social relationships. While state-of-the-art methods have limited performance as there are only a few relationships on which to train their models, MRW-RF boosts the recommendation accuracy by efficiently capturing users’ similarity preferences in both the implicit and explicit relationships.

5.5 Parameter Analysis

In Fig. 3, we evaluate the influence of parameters \(\alpha \), \(\lambda \) and \(\eta \). In this set of experiments we train our model using 50% of the ratings as training set with all social explicit relationships. Figure 3(a) presents the effect on RMSE with changes of the \(\alpha \) parameter in the objective function of Eq. (13). Parameter \(\alpha \) is varied from 0.1 to 0.9 by a step of 0.1. We observe that when \(\alpha \) is in the range of 0.4–0.6 the lowest error RMSE is achieved, thus we fix \(\alpha \) to 0.5. Out of this range, the RMSE metric is significantly increased, where higher values of \(\alpha \) make the selections of the social friends/foes dominate each user’s personalized selections. On the other hand, lower values of \(\alpha \) make the social selections have less influence on the objective function of Eq. (13), thus not handling well the data sparsity problem in users’ preferences. In Fig. 3(b) we study the effect of the regularization parameter \(\lambda \) in Eq. (13). We observe that there is a drop on RMSE when \(\lambda =1e-03\), as higher/lower \(\lambda \) values result in model overfitting/underfitting. In Fig. 3(c) we vary the learning rate \(\eta \) of the update rules of Eq. (14). Clearly, a more conservative learning strategy of \(\eta =1e-4\) is required, as for larger \(\eta \) values RMSE is significantly increased.

Fig. 3.
figure 3

Effect on RMSE when varying (a) the social regularization parameter \(\alpha \), (b) the regularization parameter \(\lambda \) and (c) the learning rate \(\eta \).

6 Conclusions

In this paper we presented MRW-RF, an efficient recommendation strategy to exploit users’ trust and distrust relationships and solve the sparsity in both the users’ preferences and social relationships. The two key factors of the proposed approach are (i) the correct inference of the missing-implicit trust relationships while considering users’ distrust relationships during the inference step, and (ii) the capture of the influence of friends and trust degrees on users’ preferences in our regularization method. In the proposed inference step, MRW-RF efficiently computes the trust degrees of implicit relationships and significantly enhances the explicit ones. In doing so, the proposed approach handles the sparsity in users’ relationships, which plays a crucial role on boosting the recommendation accuracy when a part of the social relationships is not available. Then, in our regularization method we weigh the influence of the inferred/implicit and explicit social relationships by taking into account the users’ preferences of friends and foes. Hence, our proposed MRW-RF method achieves high recommendation accuracy by exploiting the selection of the inferred and explicit friends, as well as the selection of explicit foes. Our experiments demonstrate the superiority of MRW-RF over several baselines when varying the sparsity in users’ preferences and in social relationships. By enhancing users’ social relationships in the inference step and efficiently incorporating the trust and distrust degrees into our regularization method, our approach significantly outperforms competitors in all settings. As future work we plan to investigate the performance of social inference of evolving trust and distrust relationships, to capture users’ preference dynamics, a challenging task for recommender systems [16,17,18].