Introduction

Recommendation system (RS) is essentially an information filtering technology that generates personalized recommendations based on users' historical behaviors. Explainable recommendation system provides target user with reason for recommendations while recommending to target user so as to tell target user the reason for recommendations [32]. An excellent explainable recommendation system can provide an intuitive explanation in a way that is simple for users to reveal reason for recommendations to improve user acceptance and persuasiveness of recommendations. The explainable recommendation system is an effective technology that improves transparency, persuasiveness, effectiveness, credibility as well as users' satisfaction with recommended results [30]. Therefore, explainable recommendation has gradually become an indispensable technology in network applications.

Existing explainable recommendation research is divided into the following two types: one is the way about displaying explanation, and the other is a model that generates explainable recommendations. Explainable recommendation based on information source or style is to provide users with information to explain the reason for recommending an item [37]. There are a variety of explainable styles. The basic presentation style is text, which is used to explain the reason for recommendation to the user. Model-based explainable recommendations can provide users with recommendations and explanations through an explainable model. The application of model-based explainable recommendation system is more extensive [21]. In the field of model-based explainable recommendation systems, there are many methods for modeling, including matrix factorization [38], factorization machines [3], deep learning [12], knowledge graph [2], etc.

Knowledge graph is graphical databases which contains a large amount of relationship information between entities and can be used as a convenient way to enrich users and items information [33, 39]. The problem of sparse data interaction between users and items is effectively alleviated by constructing a knowledge graph [39]. The user's historical records and recommendation results are related through the knowledge graph [26], which improves the probability of target users choosing recommended items [18]. Through different types of relationship links in knowledge graph, it is beneficial to the diversity of recommendation results. Therefore, knowledge graph is often used in model-based explainable recommendation system. Catherine [7] presented certain rules to rank entities and combined knowledge graph to generate recommendations and explanations. Ai [1] pointed out a method of using graph embedding for entities, and propose a new method to find a path to generate explanations for target users. Ma [23] summarized the rules between entities from the constructed knowledge graph, and made recommendations based on these rules. Xian [34] proposed a method termed as Strategy Guided Path Reasoning (PGPR), which obtains a recommendation list through a recommendation algorithm and finds an explanation path in the constructed knowledge graph. The explainable recommendation system based on the above methods can improve the explainability of recommendation results to some extent, but the accuracy and diversity of recommendation results cannot be optimized at the same time. Providing users with explainable recommendations while maintaining recommendation performance is a challenge in the field of explainable recommendation systems.

Multi-objective optimization algorithm is to make conflicting objectives as optimal as possible [4, 13, 16, 24, 35]. Multi-objective optimization has applications in various fields [36], such as blockchain [15], modeling [11, 17], and information diffusion [10]. In the field of recommendation systems, multiple recommendation properties are in conflict with each other, but they need to be optimized simultaneously [25]. Hence, combining multi-objective optimization algorithms and recommendation systems for personalized recommendation is a hot topic [5, 6, 9, 14]. Gong [40] used MOEA to optimize precision and diversity contemporary, and this method can provide multiple recommendations for one or more users at the same time. Wang [31] established a framework combined MOEA that describes the ability of this framework to recommend exact and unpopular items for users. Ribeiro [27] presented a hybrid recommendation model that combed the differences in precision, novelty and diversity of existing recommendation methods. Zheng [8] used SVD to acquire candidate recommendation list for users, and the candidate list about target user obtained by SVD is optimized using immune optimization algorithm to acquire the ultimate final recommendation results. These recommendation models regard objective functions as conflicting, and use MOEA to optimize the objectives synchronously to get the optimal recommendation list. However, most of these recommendation methods, which aim at the precision and diversity about recommendations and ignore the explainability about recommendations.

A framework which can generate recommendations and explanations at the same time (called ERKM) is proposed. The purpose of proposed framework is to boost the explainability, diversity and accuracy of recommendations at the same time so as to comprehensively improve the performance of recommendations. First of all, users and items are connected through the constructed knowledge graph to obtain a candidate list for each target user. Accuracy, diversity and explainability about recommendations are optimized using MOEA contemporary, which ensures both explainability and recommendation performance of recommendation results. For the explainability of recommendation results, a quantitative evaluation indicator is adopted to measure explainability about recommended items by constructing the knowledge graph, which is calculated by user’s rating of items and the similarity of attributes between items. To some extent, recommending items in this way will increase the probability of target users accepting the recommended items, which signifies that the recommended items are more explainable for target users. Our contributions are described in the following three aspects.

  1. 1.

    An explainable recommendation framework on the basis of knowledge graph and multi-objective optimization is constructed, which optimizes accuracy, explainability and diversity about recommendations in the meantime.

  2. 2.

    Different semantic relationships are used to connect users and items to construct a knowledge graph. Through these semantic relationships, users' interests can be deeply discovered. A candidate list for each target user is obtained from the constructed knowledge graph.

  3. 3.

    The product of user's rating of item and the similarity of attributes between items is adopted to measure the explainability of recommended item, and at the same time the corresponding path of recommended item in the knowledge graph is regarded as the basis for explanation.

The remainder about the paper is organized as follows. Section 2 reveals the preliminary. Section 3 demonstrates the presented explainable recommendation framework. Section 4 shows analysis the results about experimental. A case study is given by in Sect. 5. Section 6 illustrates the conclusion.

Preliminary

Knowledge graph

Knowledge graph describes different relationship between entities in a visual way, which can help formal description and understanding relationship between different entities [20]. Knowledge graph is composed of several triples \(S = \left\{ {e_{{\text{h}}} ,e_{{\text{t}}} ,r} \right\}\), where \(e_{{\text{h}}}\) and \(e_{{\text{t}}}\) represent head node and tail node respectively, and \(r\) represents the relationship between head node \(e_{{\text{h}}}\) and tail node \(e_{{\text{t}}}\). Since knowledge graph provides a better way to manage and utilize massive amounts of information, the application of knowledge graphs has gradually expanded to various fields. In the field of explainable recommendation systems, the potential connections between different entities can be discovered through a knowledge graph, which provides additional information for recommendation. At the same time, knowledge graph connects users and items through different relationships to form a path that provides an explanation basis.

Multi-objective optimization

The best possible solutions in a given area under the constraints of several conflicts or mutual influences are found through multi-objective optimization. It can be stated as:

$$ {\text{min}}\;f\left( x \right) = \left[ {f_{1} \left( x \right),f_{2} \left( x \right), \ldots ,f_{n} \left( x \right)} \right]^{\rm T} , $$

where \(x = \left[ {x_{1} ,x_{2} , \ldots ,x_{m} } \right] \in \Omega\), \(x\) represents the decision variable, \(\Omega\) is the decision variable space, the dimension of the decision variable is represented by \(m\), and \(n\) denotes the number of objective functions.

Pareto solution is an important concept in multi-objective optimization. It is considered that decision variable \(x_{a}\) dominates decision variable \(x_{b}\), if these two decision variables meet the following requirements:

$$ \left\{ {\forall i \in \left\{ {1,2, \ldots ,\left. n \right\}} \right.} \right.f_{i} \left( {x_{a} } \right) \le \left. {f_{i} \left( {x_{b} } \right)} \right\} \wedge \left\{ {\exists j \in \left\{ {1,2, \ldots ,\left. n \right\}} \right.} \right.f_{j} \left( {x_{a} } \right) \le \left. {f_{j} \left( {x_{b} } \right)} \right\}, $$

\(x \in \Omega\) is identified as Pareto optimal solution if there is inexistence other \(x^{*} \in \Omega\) such that \(x^{*} \succ x\).

All Pareto optimal solutions form the Pareto optimal solution set, which can be described as:

$$ PS = \left\{ {x \in \Omega \left| {\neg \exists x^{*} } \right.} \right. \in \Omega ,x^{*} \succ \left. x \right\}. $$

Pareto solutions consist of objective functions mapping to form Pareto front of this problem, that is, Pareto optimal solutions corresponding to objective function value are Pareto optimal front. Pareto optimal front can be described as:

$$ {\text{PF}} = \left\{ {F\left( x \right)} \right.\left| {x \in \left. {{\text{PS}}} \right\}} \right.. $$

Recommendation system (RS) is combined with MOEA to seek the best recommendation lists for target users. Each solution on the Pareto front represents a recommendation list for target users.

Methodology

The framework of explainable recommendation and objective functions to be optimized are introduced in detail. This explainable recommendation framework includes the construction of knowledge graph and three optimization objectives to improve accuracy, diversity, and explainability of recommendation results.

The framework of explainable recommendation

The framework of explainable recommendation based on knowledge graph and multi-objective optimization are introduced. The whole recommendation process can be divided into two procedures. First, knowledge graph is used to connect users and items through different relationships to obtain an explainable candidate list for target user. Then multi-objective optimization algorithm is used to acquire final top-N list. The framework of explainable recommendation as shown in Fig. 1.

Fig. 1
figure 1

The framework of explainable recommendation

The construction of knowledge graph

Knowledge graph is used to associate different entities to explore deeper relationships between the target user and items. The user's satisfaction with recommended items will decrease as the corresponding paths of recommended items increase [29]. In [28], when the length of path is within three hops, it has the best effect. Therefore, three nodes and two relationships are used to construct knowledge graph. Portion of the final knowledge graph about user \(A\) is shown in Fig. 2.

Fig. 2
figure 2

Portion of the final knowledge graph about user \(A\)

Target user is the first node, and item directly connected to the target user is the second node. Items with the same director as the second node are the third node, which form the explainable candidate list for target user. Then explainable candidate list is optimized using the following optimization model to obtain final recommendation list. For example, the third nodes starting from user \(A\) includes item 2 and item 3, which are a subset of the candidate list set of user \(A\). Different users will be indirectly connected through items. When making recommendations for a user, all nodes associated with the user are used.

Optimization objectives

Three objective functions optimized in this paper are introduced in detail. Precision is generally accepted as an indicator to measure recommendation performance, which is denoted by the proportion of items that users like in the final recommendations. [40]. The method of calculation is defined as:

$$ P_{i} = \frac{{\left| {R_{i} \cap T_{i} } \right|}}{{\left| {R_{i} } \right|}}, $$
(1)

where \(\left| {R_{i} } \right|\) denotes the length of final recommendations, and \(\left| {R_{i} \cap T_{i} } \right|\) is number of items that user \(i\) likes in the ultimate recommendation list obtained by explainable recommendation framework.

Diversity denotes the difference between final recommendation lists which is evaluated by calculating the similarity between items in event recommendation lists. The calculation method of diversity is as:

$$ D_{i} = 1 - \frac{{\sum m,n \in L_{i} ,m \ne ns\left( {m,n} \right)}}{{\frac{1}{2}\left| {L_{i} } \right|\left( {\left| {L_{i} } \right| - 1} \right)}}, $$
(2)

where \(L_{i}\) is the recommendation list and \(s\left( {m,n} \right)\) is the similarity between item \(m\) and item \(n\).

Revised cosine similarity method is used to calculate the similarity between item \(m\) and item \(n\). The calculation method of revised cosine similarity is given by

$$ s\left( {m,n} \right) = \frac{{\mathop \sum \nolimits_{u \in U} (R_{u,m} - \overline{R}_{u} )\left( {R_{u,n} - \overline{R}_{u} } \right)}}{{\sqrt {\mathop \sum \nolimits_{u \in U} (R_{u,m} - \overline{R}_{u} )^{2} } \sqrt {\mathop \sum \nolimits_{u \in U} (R_{u,n} - \overline{R}_{u} )^{2} } }}, $$
(3)

where the set of users who both rated \(m\) and \(n\) are denoted by \(U\), \(R_{u,m}\) represents the rating of user \(u\) about item \(m\), \(\overline{R}_{u}\) denotes the mean rating about user \(u\).

Explainability indicates an ability to help target users to understand the reason for an item is recommended. Ratings of user \(i\) about items and similarity of attributes between items are adopted to measure explainability. The calculation method of explainability is defined as:

$$ E_{i} = \mathop \sum \limits_{m = 1}^{N} \frac{{r_{i,j\_m} }}{{{\text{sum}}\_r_{i} }} \times S_{{j\_m,j^{\prime}\_m}} , $$
(4)

where \(N\) is the length of the recommendation list, \(r_{i,j\_m}\) is the rating of user \(i\) for item \(j\_m\), \({\text{sum}}\_r_{i}\) is the sum of ratings for all items by user \(i\), item \(j\_m\) represents an item rated by user \(i\), item \(j^{\prime}\_m\) represents an item in the candidate list corresponding to user \(i\), item \(j\_m\) and item \(j^{\prime}\_m\) are nodes on the same path from target user \(i\). \(S_{{j\_m,j^{\prime}\_m}}\) is similarity of attributes between item \(j\_m\) and item \(j^{\prime}\_m\). \(S_{{j\_m,j^{\prime}\_m}}\) is calculated as follows:

$$ S_{{j\_m,j^{\prime}\_m}} = \frac{{\left| {A_{j\_m} \left| \cap \right|A_{{j^{\prime}\_m}} } \right|}}{{\left| {A_{j\_m} \left| \cup \right|A_{{j^{\prime}\_m}} } \right|}}, $$
(5)

where \(A_{j\_m}\) denotes the attributes set of item \(j\_m\), and \(A_{{j^{\prime}\_m}}\) is attributes set about item \(j^{\prime}\_m\). The larger value about \(S_{{j\_m,j^{\prime}\_m}}\), the more similar between two items in terms of attributes. Item \(j^{\prime}\_m\) obtained in this way is more likely to be selected by user. With the improvement of precision and diversity, it recommends various items that users like to users. The improvement of explainability increases the probability of users choosing recommended items. It is evident that precision, diversity, and explainability improve recommendation performance in three different aspects. The objective functions optimized in this paper are summarized as follows:

$$ \left\{ {\begin{array}{*{20}c} {\max P_{i} = \frac{{\left| {R_{i} \cap T_{i} } \right|}}{{\left| {R_{i} } \right|}}} \\ {\max D_{i} = 1 - \frac{{\sum m,n \in L_{i} ,m \ne ns\left( {m,n} \right)}}{{\frac{1}{2}\left| {L_{i} } \right|\left( {\left| {L_{i} } \right| - 1} \right)}}.} \\ {\max E_{i} = \mathop \sum \limits_{m = 1}^{N} \frac{{r_{i,j\_m} }}{{{\text{sum}}\_r_{i} }} \times S_{{j\_m,j^{\prime}\_m}} } \\ \end{array} } \right. $$

Individual representation

Individuals use real number coding, and each solution generated by optimization represents a set of recommended lists. The candidate list is obtained through the knowledge graph. The candidate item number is used to represent individuals. The code of each individual can be represented as

$$ X = \left\{ {x_{1} ,x_{2} , \ldots ,x_{D} } \right\}, $$

where D denotes the length of a recommendation list, \(x_{i}\) represents the number corresponding to randomly selected items in candidate list.

Genetic operators

Crossover and mutation are essential in genetic algorithms. They play a very vital role in finding the global optimal solution. Crossover and mutation methods are described in detail.

Crossover

The single point crossover swaps the right part of the crossover point at a randomly selected position to obtain two new individuals. This paper uses this classic single point crossover method. First, the individuals are randomly divided into father individuals and mother individuals. Then one of the two parts is randomly selected to form two parents, and the two parents are crossed to generate offspring. k is a randomly generated integer between [1, D], the two parents are swapped from k to the end. Since individual represents a set of recommended lists, the elements of each individual can’t be repeated. Therefore, for individuals generated by crossover, it is necessary to determine whether there are duplicate elements. The duplicate elements must be eliminated through the following operations. For repeating elements in an offspring, find the position of repeating element corresponding to another parent, and use the element at corresponding position in the parent to replace the repeating element at non-crossing position in child until there is no repeating element in child. For recommended lists P1 and P2, the elements in the red rectangle are swapped to get offspring C1 and C2. The element at corresponding position in P2 are used to replace the repeated elements outside red rectangle of C1. The specific process is shown in Fig. 3.

Fig. 3
figure 3

The crossover operator

Mutation

First randomly select a parent. Then randomly generate a positive integer to determine the number of mutations, and select the elements that are not in the parent to replace. Replace the elements in the red rectangle with elements not in the recommended list P1. The specific mutation process is shown in Fig. 4.

Fig. 4
figure 4

The mutation operator

Experimentation

Experimental data

The recommendation performance of our presented model is evaluated by calculating three different evaluation indicators on Movielens and Anime datasets.

  1. 1.

    Movielens. The Movielens dataset can be downloaded from http://www.grouplens.org. This dataset contains 2113 users, 10,197 movies, 20 movie tags, etc. Users rate movies from 1 to 5 in this dataset.

  2. 2.

    Anime. This dataset about animation can be downloaded from https://www.kaggle.com/CooperUnion/anime-recommendations-database. The Anime dataset includes 73,516 users and 12,294 animations. Ratings range from -1 to 10, and ratings greater than or equal to 1 are retained.

Parameter settings

The parameters needed in following experiment are shown in Table 1.

Table 1 Parameters setting in multi-objective optimization

Evaluation metrics

The recommendation performance about presented model is estimated by calculating Precision, diversity, explainability about target users. Precision, diversity and explainability are calculated using the same calculation methods as in Sect. 3.3. MOEA is used to obtain the ultima recommendations for each target user, but optimal recommendation results can’t be selected from this set of recommendation lists. Therefore, the maximum, minimum, and average values of this set of recommendation lists on each evaluation indicator are used to measure the overall performance of the recommendations.

Analysis of experimental results

Comparison of algorithms

NSGA-II, AGE-II, SPEA2, and BCE-IBEA are selected to compare the performance about our model in the first part of experiment. MOEA is used for target users to generate recommendation results that satisfy multiple objective functions at the same time. The recommendation performance of different algorithms is measured by the maximum, minimum and average values on each evaluation indicator. In order to select an algorithm with the best performance more efficiently, maximum, minimum and average values on each evaluation indicator are weighted and summed. Since average values measure the overall performance of all recommended lists, the weight of average values is relatively large. Maximum, minimum, and average values of evaluation indicator are weighted by a ratio of 3:3:4.

Table 2 shows evaluation metrics of four algorithms on 10 randomly selected users. It can be drawn from the table that performance difference of four algorithms is inconspicuous. Among the four algorithms, NSGA-II has 10 evaluation metrics are the best, exceeding three comparison algorithms. At the same time, NSGA-II has the best explainability among five users, which is not achieved by three comparison algorithms. Therefore, NSGA-II is selected for model comparison in the following experiments.

Table 2 Metrics on different algorithms

Comparison with other models

IN the second part of experiment, model comparisons are made to compare the performance of DIFFERENT models. 10 users are randomly selected from Movielens dataset and Anime dataset respectively to calculate the values of evaluation metrics.

MF [22], NNIA-RS [19] and MORS [31] are chosen to compare with the model that we proposed.

Table 3 reveals the values of precision on MovieLens dataset. According to Table 3, it is concluded that among the 10 randomly selected users, the mean value of three users is the highest compared with the other three comparison models. The maximum values of ten users are obviously better than the maximum values obtained by MF and NNIA-RS. The maximum and average values of 175, 325, and 383 users are better than those obtained by comparison models.

Table 3 Precision on MovieLens dataset

Table 4 demonstrates the values about precision on Anime dataset. A fact can be drawn from the data in Table 2 that mean values about precision obtained by ERKM are mostly the best among the four models. The maximum values of ten users are the best compared to comparison models. The maximum and average values of 18, 19, 22, 28, 42 and 58 users obtained by our model are better than maximum and average values obtained by comparison models.

Table 4 Precision on Anime dataset

The scoring sum of items in the recommendation list is used to measure accuracy about recommendations in the multi-objective long-tail item recommendation model MORS, which can better reflect the accuracy of recommendation. On different datasets, the minimum accuracy obtained by MORS is mostly the best compared with comparison model. The data on Anime dataset is sparse, which cause the performance of MORS on this dataset is degraded.

According to the values about explainability in Table 5, which were calculated using MovieLens dataset, it can be found that the minimum values of the 10 randomly selected users are not all the best, but the maximum and average values are better than those generated by comparison method.

Table 5 Explainability on MovieLens dataset

Explainability on Anime dataset can be seen in Table 6. It is evident from Table 6 that the mean values about 10 users are the best, which are not achieved by the three comparison models.

Table 6 Explainability on Anime dataset

The diversity calculated using MovieLens dataset are revealed in Table 7. The mean values about diversity obtained by ERKM are superior to the mean values of comparison methods except user 267. Meanwhile, the maximum values of 10 users obtained by our model are the best than comparison methods.

Table 7 Diversity on MovieLens dataset

The diversity calculated using Anime dataset are demonstrated in Table 8. Although minimum values about diversity obtained by our model are not always the best compared to comparison models, maximum values and average values of 10 users obtained by ERKM are better than values obtained by comparison methods except user 16.

Table 8 Diversity on Anime dataset

In summary, a conclusion can be drawn that although average values of precision, minimum values of diversity and explainability obtained by our proposed model are not always better than comparison models, the overall recommendation performance is the best compared with comparison models.

Case study

To illustrate the ability of the model to explain, case study is used for qualitative analysis.

Users and items are linked by ratings, items and items are linked by the same director. In Fig. 5, user 2612 has the highest rating for item 5, items along the path of item 5 can better satisfy the user's preferences. Therefore, items along the path of item 5 will be preferentially selected to recommend to the user. Simultaneously, the corresponding path is used as explanation basis to explain to user 2612 why the item is recommended. The similarity of attributes between item 4191、item 4080 and item 5 is 0 and 50% respectively. It is obvious that on the basis of optimizing accuracy and diversity through multi-objective optimization, item 4080 is more likely to be recommended to users in some degree. The path \(\left\{ {{\text{user}}\;2612 \to {\text{item}}\;5 \to {\text{item}}\;4080} \right\}\) is used as a recommendation reason to tell user 2612 why the item 4080 is recommended to him.

Fig. 5
figure 5

Explanation paths between user 2612 and several items in constructed knowledge graph

Conclusion

In order to boost explainability, precision and diversity about recommendations contemporary, an explainable recommendation framework on the basis of knowledge graph and MOEA is put forward in the work. This explainable recommendation framework is divided into the procedure of obtaining explainable candidate list and the procedure of optimization recommendation. Explainable recommendation list of target user is obtained by constructing a knowledge graph in the procedure of obtaining explainable candidate list, and the explainable recommendation list is optimized using MOEA in the procedure of optimization recommendation to obtain recommendation results that meet multiple objectives synchronously. The recommendation results obtained have good results on three different evaluation indicators. Through the comparison experiment with other three existing recommendation models, it can be seen that the explainable recommendation framework has an excellent effect on different datasets and has high explainability on the basis of maintaining accuracy and diversity.

The explainable recommendation framework proposed in this paper can obtain a set of high-quality recommendation lists, but there is an unbalance between three optimized objective functions. In the future, we will analyze the reasons for this problem to comprehensively improve the recommended performance.