METHOD OF CONSTRUCTING EXPLANATIONS FOR RECOMMENDER SYSTEMS BASED ON THE TEMPORAL DYNAMICS OF USER PREFERENCES

The problem of constructing explanations for recommendations in situations of cold start and shilling attacks is considered. The first situation is characterized by incomplete information about the user's preferences, and the second is characterized by a distortion of the ratings of items in the recommendation system. A method for constructing explanations for the recommended list of subjects is proposed. The method uses weighted temporal dependencies to form explanations. Each such dependence reflects a change in sales of goods for two non-contiguous time intervals. These intervals are set according to a given level of detail of time, for example, day, week, month. The input is presented by a sales journal with time stamps. The method includes the steps of forming temporal rules, calculating the weights of the rules, building explanations. The weights of the rules reflect the degree of change in sales for a pair of intervals. The result of the method is a recommendation in the form of a numerical estimate of the change in user preferences with respect to the subject in the recommendation. The proposed method allows to increase sales efficiency due to the active selection of items by the user based on the explanations received.


Introduction
Recommender systems are designed to build a personalized list of items, such as goods or services that meet the interests of the current user. Such systems form recommendations based on the similarity of subjects or similar preferences of users. Information on sales of items, as well as ratings of these items, set by users, are used as input to build recommendations. Recommender systems make it easier for the user, which allows to increase sales. Therefore, such systems are widely used when selling goods, watching movies, selling tourist tours, recommending conferences, etc. [1].
In the process of functioning of recommender systems, problems arise related to the incompleteness or intentional distortion of input information.
The problem of incomplete information or the problem of a cold start arises when new, "cold", as well as irregular users of the recommendation system appear [2]. Since new users have not yet made a choice of subjects, the recommendation system does not have enough information about their preferences. Therefore, it can't build accurate recommendations and, instead of items of interest to the user, it can offer simply popular products.
The problem of distorting the input information, or the problem of shilling attacks, is that the attacker artificially lowers or raises the ratings of some items [3]. Raising the ratings of selected products allows to increase their sales, and lowering -to reduce sales of competitors. Changing ratings as a result of an attack can lead to the issuance of irrelevant recommendations and to a complete failure of the recommendation system. The user ceases to trust such a system.
To solve the problem of cold start, hybrid methods are used [4], which combine the use of collaborative filtering with the analysis of contextual data. This combination is complemented by the possibilities of active learning [5]. Hybrid methods also take into account changes in user requirements over time i. e. temporal dynamics of its preferences. In this case, temporal constraints [6], temporal graph [7], multilayer graph [8], neural network model [9] are used.
Methods for detecting shilling attacks are focused on identifying the pattern of an attacking user [10] based on statistical and machine learning methods [11], as well as the temporal dynamics of its preferences [12].
A common feature of the considered approaches is that they select products for the "cold" consumer, recognize rating distortions without the active participation of the user. This may reduce its confidence in the recommendation system and the refusal to use recommendations.
To increase user confidence, the concept of explaining recommendations is used. A number of criteria are proposed in [13] for evaluating the explanations. These criteria characterize the user's confidence in the recommendations, the impact of explanations on sales performance, the degree of ease of use of recommendations for users [14]. Evaluation of explanations based on user surveys, as well as re-selection of users after receiving explanations, shows a decrease in refusals to select items after receiving explanations [15].
In general, existing approaches to the construction of explanations do not take into account changes in user preferences over time. However, given the lack of information about new users, as well as distortion of ratings as a result of shilling attacks, it is important to formulate the most relevant recommendations. For this, it is necessary to take into account temporal dynamics in user requirements. To solve this problem, it is advisable to use temporal dependencies, reflecting the change in the number of goods or services sold over time.
The aim of this research is development of a method for constructing explanations in recommender systems based on the consideration of temporal dependencies that describe changes in the user's interests for the processes of purchasing goods over a selected time interval.

The method of constructing explanations taking into account changes in user preferences
The developed method is intended to supplement the recommendations with explanations in order to increase the efficiency of the recommendation system.
The effectiveness of such explanations according to [13] can be assessed using indicators such as efficiency and credibility. The first indicator is determined through the relationship between the number of sales when using recommendations with explanations, as well as sales based on recommendations without explanations. The second indicator reflects the influence of explanations on consumer choice of goods. For example, if, after considering the explanations, the user chose a new, more prestigious and expensive product, then this means that the explanations convinced it to make a more expensive purchase. Thus, an increase in the efficiency of the recommendation system based on explanations is carried out both through an increase in sales in general, and as a result of increased sales of new, more technological, fashionable goods that have a higher price. In order to achieve the indicated increase in efficiency with the help of explanations, it is necessary that the user change its choice after reading the explanations. In other words, the user must trust these explanations. The confidence indicator, according to [13,15], shows how well the proposed explanation justifies for the user the benefits of a particular item. Such a justification, as well as recommendations, can be obtained either on the basis of the characteristics of this item, or on the basis of a well-known choice of other users. In this paper, the second approach is implemented.
The developed method generates explanations that reflect the temporal dynamics of customer demand and allow the user to make an informed choice when there is a lack or distortion of information about user preferences, for example, in a cold start situation or in the case of shilling attacks on the recommendation system.
The developed method uses an adapted version of the weighted temporal rules proposed in [16]. Traditionally, each such rule sets a time order for a pair of events or actions. For example, the selection sequence for a pair of products in an e-commerce system. The weight of the rule depends on the likelihood of its use. Therefore, for recommender systems, the weight of the rule must be related to the popularity of the product described by this rule. The set of rules allows to describe a time-ordered sequence of selection of goods and services by the user of the recommendation system. Such a sequence reflects implicit causal relationships between user actions [17]. Temporal dependencies corresponding to these relationships can be obtained on the basis of log analysis [18]. In recommendation systems, logs are represented by sales logs.
Adapting the rules to solve the problem of constructing recommendations consists in calculating their weight in such a way as to take into account not only the popularity of a particular product, but also the changes in the number of units sold in the e-commerce system. This method uses temporal rules of type F (Future), since a temporal operator of type F allows to associate a pair of arbitrary moments in one time stream. The combination of these rules allows to describe the change in sales for all moments belonging to a given time interval.
The general form of a rule r of type F with weight w between the moments of purchases t m and t s of time has the form: where n m and n s -the number of purchases at time t m and t s , respectively. Using temporal rules, the method describes the dynamics of consumer demand over a given time interval ∆T. The endpoint of this interval is the current t now . The duration ∆T depends on the product group and the subject area and should reflect the cycles of increase/decrease in customer demand. For goods that are sold cyclically, 2-3 times a year, this interval is several months. Examples of such products are travel tours, clothing. For goods in the field of high technology, this interval depends on the frequency of release and is a year or more.
The period ∆T is divided into a sequence of intervals ∆τ m . The intervals ∆τ m . reflect the level of detail of time (hour, day, etc.). For each interval ∆τ m ., the number of purchases for each product is calculated. Then a set F -temporal rules r jm is formed that connect each interval ∆τ m with a finite interval ∆τ M . The weight of the rule depends on the difference in purchases between the intervals: the more the quantity of goods sold has changed, the greater the weight of the rule.
An example of the considered temporal rules for one item i j is presented in Fig. 1.
Each rule r jm describes the increase/decrease in sales of item i j for a pair of time intervals (∆τ m , ∆τ M ). The whole set of rules R j ={r jm } characterizes the change in sales of goods over a period of time ∆T.
The method as input uses: sales journal L; period of time for calculating explanations ∆T; time granulation level ∆τ; a subset of items I of the recommendation for which explanations are generated.
Each line l of sales journal L is represented by a four (user u k , item i j , number of items purchased n j , timestamp τ n ). The time period ∆T depends on the category of items for which recommendations are generated.
The method includes the following stages. Stage 1. Selecting a subset L ∆T of records l=(u k , i j , n j ,τ n ) of the sales journal L for calculating temporal dynamics from a subset of goods I for a given period of time ∆T. The resulting subset is: Stage 2. Journal conversion for a given granulation level ∆τ.
Step 2. 1. Normalization of the number of purchases n j for each line of the sales journal L ∆T . Normalization is carried out in order to compare temporal dynamics for different objects ij. The result of this step is a set L norm : , , , : . max Step 2. 2. Dividing the initial time period ∆T into an ordered sequence of time detail intervals ∆τ m , as is shown in Fig. 1 Step 2. 3. Summation of purchases for each item i j ∈I for a given granulation level ∆τ: Computer Sciences Stage 4. Calculation of the set of weights W={Wj} of temporal rules for items, taking into account the popularity of objects and the difference in sales between the intervals ∆τ m and ∆τ M .
The popularity of items is taken into account due to the normalization of weights in step 2. 1. Therefore, to calculate the weight wm,j, the rules rm,j are enough to find the difference in sales on the intervals ∆τ m and ∆τ M: : Stage 5. Calculation of temporal dynamics over a period of time ∆T for each product i j from the initial recommended set. The temporal dynamics for each item i j is set by the element g j equal to the total change in the normalized quantity of goods sold for this period of time: , : .
Stage 6. Formation of explanations in the form of a list of goods ordered by temporal dynamics provided that this dynamics is positive: The list of pairs (ij, gj) obtained at this stage shows how much the interest of users in the product i j for a given period of time ∆T has increased, and therefore is an explanation of the recommendations of this item, which satisfies the criterion of trust [13].

Experiment results
An experimental verification of the method is performed using the «Online Retail» gift store sales journal, which is available in the UCI repository. Each journal entry contains all the necessary information to build an explanation: code, name, product sold, as well as a time stamp with the date and time of sale.
To test the method, two experiments are performed. The first experiment is devoted to the construction of explanations, and the second to the justification of the choice of the time granulation level ∆τ m .
During the first experiment, the time period ∆T was 5 days, and the time granulation level ∆τ m -1 day. As a result of stage 1, 10.1 thousand sales records were selected for all items.
Additionally, weekends were filtered. One of the days off was in these 5 days. Therefore, sales data were received in 4 days.
The initial recommended list of items was obtained using collaborative filtering for a randomly selected user. This set consists of 7 elements.
Temporal dependencies were formed for four subjects. For other recommended items, sales occurred only on one of the selected days, which did not allow building such dependencies. The results of the key stages of the method are given in Table 1. Table 1 The results of the implementation of the method of constructing explanations taking into account changes in user preferences Items Daily sales, n jm The weights of the rules w m,j Increase/decrease in demand g j Use to explain recommendations It can be seen from Table 1 that, in the first item, temporal rules reflected a trend towards a cessation of sales growth, even taking into account an increase in purchases on one of the selected days. In the second and fourth items, user preferences are changing, but overall the trend is positive, aimed at increasing sales.
When allocating the level ∆τ m =1 day, it turned out that temporal rules for many goods could not be obtained. The reason for this situation is that these products were sold at long intervals, for example, several times a decade or a month. Therefore, when conducting the second experiment, for one product from the recommended list, the granulation values of time of 10 days and 1 month were selected. For this experiment, the product that was sold during the year was selected. The results of the experiment are given in Table 2. Table 2 The results of the implementation of the method of constructing explanations for different time granulation  Table 2 shows that the time granulation level affects the resulting explanation. Comparison of n jm values shows that the monthly interval reflects the general growth trends in sales of this product over the year. In the second case, a local decrease in sales in the last decade may distort the resulting explanation.

Discussion of experimental results
The result of the work is an explanation construction method, supplementing the recommendations with a numerical assessment of the temporal dynamics of user preferences for a selected time period. The dynamics of user interests is fixed using rules (1), each of which links purchases at a pair of time intervals. The totality of such rules shows an increase or decrease in sales within the selected period compared to the current time interval (Fig. 1).
The method selects a subset of the source records (2) in which purchases are recorded within the specified time period. At the second stage, these records are converted in accordance with the selected level of time detail. The number of purchases is normalized (3), after which the subset (2) is divided into time intervals (4). The result of the second stage is a set of records (6) with a normalized number of purchases (5) at the allocated time intervals (4). At the third stage, a set of unweighted temporal rules (7) is formed for each object represented in the set (2). Then weights of these rules are calculated (8) as the difference between the normalized number of purchases for pairs of intervals. At the fifth stage, the temporal dynamics (9) for each item is calculated. The latter is represented by the sum of the weights of temporal rules for the item for the entire time interval. The result of the method is an explanation (10) in the form of a list of objects with an indication of their temporal dynamics. The explanation contains only positive values ( Table 1) in order to stimulate the user to select the appropriate item.
This method allows users to make an informed choice of items from the recommended list, especially in situations of rating distortion and incomplete data on the requirements of the current user.
The difference of the proposed method lies in the fact that the explanations obtained take into account not only the popularity of each item from the recommendation, but also the integral estimate of the change in demand for the item over a given period of time.
The advantage of the method is the ability to build explanations online, taking into account the most recent changes in the preferences of users of the recommendation system and without the need to consider the specific properties of the recommended items ( Table 1).
The disadvantage of this method is that the calculated estimate of the change in demand depends on a priori given time parameters. The rating is affected by the amount of the selected time period during which the change in user preferences is considered. The assessment also depends on the time granulation level in the source data ( Table 2).
The method has limitations associated with the mode of operation of the recommendation system. The method is not intended for offline mode of operation, since in this mode, the calculation of user preferences must be done in advance, before building recommendations. The same method uses the latest demand data to build explanations.
The method forms an explanation that complements the indicator of the most popular products. The used form of explanations is focused on new products or improved, adapted versions of them. From the standpoint of satisfying user requirements, taking into account temporal dynamics makes it possible to choose products with cyclical (for example, seasonal) demand, as well as promising products with a long estimated useful life.
The method can also be used to solve problems characterized by changing consumer demand, for example, to build a visual explanation of the reasons for the growth of information system traffic [19], as well as to provide information support for virtual enterprise clients [20].

Conclusions
The problem of constructing explanations for recommendations is considered taking into account the distortion of the rating of goods as a result of shilling attacks, as well as the lack of information about the interests of new users. In such a situation, it is advisable to take into account the temporal dynamics of user preferences. The latter is defined by a set of temporal rules that reflect the change in sales of the target product for two unrelated time intervals, for example, for two different days.
A method for constructing explanations in the form of a numerical estimate of the change in user preferences for a given period of time is proposed.
The method includes the stages of forming unweighted temporal rules, calculating the weights of temporal rules, and forming explanations in the form of the sum of the weights of the rules for each item.
This method is different in that it presents an explanation in the form of a single indicator that combines the change in sales for each recommended product for a given period of time.
The proposed method allows to increase user confidence in the recommendations due to the obviousness of the used indicator. This makes it possible to increase the efficiency of the recommendation system.
Further improvement of the method may be related to taking into account not only sales, but also the rating, subject to filtering of shilling attacks.