Explainable recommendation based on knowledge graph and multi-objective optimization

Recommendation system is a technology that can mine user's preference for items. Explainable recommendation is to produce recommendations for target users and give reasons at the same time to reveal reasons for recommendations. The explainability of recommendations that can improve the transparency of recommendations and the probability of users choosing the recommended items. The merits about explainability of recommendations are obvious, but it is not enough to focus solely on explainability of recommendations in field of explainable recommendations. Therefore, it is essential to construct an explainable recommendation framework to improve the explainability of recommended items while maintaining accuracy and diversity. An explainable recommendation framework based on knowledge graph and multi-objective optimization is proposed that can optimize the precision, diversity and explainability about recommendations at the same time. Knowledge graph connects users and items through different relationships to obtain an explainable candidate list for target user, and the path between target user and recommended item is used as an explanation basis. The explainable candidate list is optimized through multi-objective optimization algorithm to obtain the final recommendation list. It is concluded from the results about experiments that presented explainable recommendation framework provides high-quality recommendations that contains high accuracy, diversity and explainability.


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 1 3 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. 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. 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. 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 1 3 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.

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 = e h , e t , r , where e h and e t represent head node and tail node respectively, and r represents the relationship between head node e h and tail node e 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: x represents the decision variable, Ω 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: x ∈ Ω is identified as Pareto optimal solution if there is inexistence other x * ∈ Ω such that x * ≻ x.
All Pareto optimal solutions form the Pareto optimal solution set, which can be described as: 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: 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.

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.

3
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: 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: where L i is the recommendation list and s(m, n) 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 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 , 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: where N is the length of the recommendation list, r i,j_m is the rating of user i for item j_m , 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 ′ _m represents an item in the candidate list corresponding to user i , item j_m and item j ′ _m are nodes on the same path from target user i . S j_m,j ′ _m is similarity of attributes between item j_m and item j ′ _m . S j_m,j ′ _m is calculated as follows: where A j_m denotes the attributes set of item j_m , and A j ′ _m is attributes set about item j ′ _m . The larger value about S j_m,j ′ _m , the more similar between two items in terms of attributes. Item j ′ _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:

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 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.

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.

Experimental data
The recommendation performance of our presented model is evaluated by calculating three different evaluation indicators on Movielens and Anime datasets. 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.

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.  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.

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 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.
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 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. 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.
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. 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. 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 {user 2612 → item 5 → item 4080} is used as a recommendation reason to tell user 2612 why the item 4080 is recommended to him.

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.