{'fraction_non_alphanumeric': 0.024248760581430644, 'fraction_numerical': 0.007183568850966241, 'mean_word_length': 4.964996982498492, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The improved model of user similarity coefficients computation For recommendation systems

The subject matter of the article is a model of calculating the user similarity coefficients of the recommendation systems. The goal is the development of the improved model of user similarity coefficients calculation for recommendation systems to optimize the time of forming recommendation lists. The tasks to be solved are: to investigate the probability of changing user preferences of a recommendation system by comparing their similarity coefficients in time, to investigate which distribution function describes the changes of similarity coefficients of users in time. The methods used are: graph theory, probability theory, radioactivity theory, algorithm theory. Conclusions. In the course of the researches, the model of user similarity coefficients calculating for the recommendation systems has been improved. The model differs from the known ones in that it takes into account the recalculation period of similarity coefficients for the individual user and average recalculation period of similarity coefficients for all users of the system or a specific group of users. The software has been developed, in which a series of experiments was conducted to test the effectiveness of the developed method. The conducted experiments showed that the developed method in general increases the quality of the recommendation system without significant fluctuations of Precision and Recall of the system. Precision and Recall can decrease slightly or increase, depending on the characteristics of the incoming data set. The use of the proposed solutions will increase the application period of the previously calculated similarity coefficients of users for the prediction of preferences without their recalculation and, accordingly, it will shorten the time of formation and issuance of recommendation lists up to 2 times.


Introduction
Recommendation systems (RSs) are a powerful tool for goods and services digital marketing. They are often used on web-resources with a large number of users and items. In this case, during the recommendation system operation, there may be a shortage of computing resources and a decrease in its work quality. The analysis of the main criteria for the evaluation of RSs allowed us to present the main characteristics of their work quality as shown in Fig. 1.
Each of these characteristics has a significant effect on the quality of the recommendation system, but it should be noted that first of all system users form their judgments about the recommendation system in the process of its operation. However, this evaluation is largely influenced by the characteristic of the time (speed) of the recommendation.

Quality characteristics of recommendation systems
Characteristics that are important to system owners Characteristics that are important to system users Time (speed) of the creation of recommendation lists to users Accuracy of rating prediction User space coverage and item space coverage The usefulness of recommendations and their relevance to user needs The diversity, serendipity and novelty of recommendations User data privacy, absence of risk for using a system Robustness to profile-injection attacks Time (speed) of getting a recommendation list The conducted research has shown that one of the main indicators that affect the total time of creating recommendations is the time computing similarity coefficients between users. This is largely due to the significant increase in the use of RSs, their introduction into a wide range of applications, a significant increase in the quantity of these systems users. As well as an increase in the quantity of the content items amount, and consequently an increase in the frequency of changes in the users' preferences, and therefore their similarity coefficients.
One way to optimize this characteristic is to predict changes in user interests and adapt the RSs to identified trends in time characteristics.
Thus, the question of improving the quality of recommendation systems by adapting the time characteristics to possible changes in preferences of users becomes topical.
The conducted research has shown that the memory-based approach is simpler, has high accuracy, can use incremental input of new data. However, this approach is resource-intensive, cannot provide a descriptive analysis of existing patterns, give more insight into available data, and explain a prediction.
At the same time, model-based methods have models that give a greater understanding of formed recommendations, as well as the process of generating recommendations is divided into two stages: resourceintensive model training in the pending mode and simple computing recommendations based on the existing model in real times. The disadvantages of this approach are that it does not support incremental learning and have a lower accuracy of prediction.
One of the main reasons for the high resource consumption of user-based, based on memory-based collaborative filtering methods, is to use the procedure computing similarity coefficients between users whenever it is necessary to form recommendations. Currently, statistics changes in user behavior are not counted for reducing the frequency of the recompute their similarity coefficients, so there is no possibility to adapt the recomputing time of similarity coefficients to the probability of their change.
In the works [1,[18][19][20][21][22][23] models of user preference change dynamics in time, both for periodic and for non-periodic changes, were researched and proposed. These models were developed and used to increase the work accuracy of recommendation systems, but not to reduce the recalculation frequency of user similarity coefficients.
This work proposes to improve the recommendation lists formation method in such systems by using statistics on user behavior when using collaborative filtering to reduce the formation time of recommendations.
The conducted research has shown that the similarity coefficients recompute can be used not only to form recommendations but also, to identify the networks of bots. Bots from the same network will have consistently the same preferences because since they will have the same target items for rating changes. Such bots should be identified and their data disregarded when recommendation lists formation created for normal users. A sign of a bot network will be the presence of a certain quantity of users with similarity coefficients between them equal or very close to one 1 1 k     . In this case, the question arises how often the similarities between users be recomputed? Moreover, for how long should the similarity coefficients for the detected suspicious user group remain the same to make sure that it is a bot network?
In this formulation of the problem, it becomes justified to use user-based and memory-based collaborative filtering, because it is necessary to determine namely the similarity between users. In this case, the prediction of ratings and generating recommendation lists can generally be based on other methods and models. This can lead to delays in customer service when users need to wait for recommendations unsatisfactorily long. To reduce the load on computing resources, it is advisable to determine which data of a recommendation system does not lose its relevance for a certain period and to recompute them no more frequently than with the defined periodicity.
In neighborhood-based models of recommendation systems [1][2][3][4][5], the creation of a user recommendation list can be divided into three separate processes: 1. Computing the similarity coefficients between users (or items).
2. Predicting individual preferences based on the similarity coefficients.
3. Create a Top N of preferences to form recommendation lists for users based on predicted preferences.
This paper proposes to reduce the quantity of computations related to the recomputation of user similarity coefficients. Namely, the similarity coefficients between pairs of users to recompute not every time the recommendation lists are formed, but only when such a recomputation is required. The similarity coefficients between user pairs of a recommendation system may remain unchanged for some time but will change eventually. There may be several reasons for changing the similarity coefficients between users: 1. The cold-start problem: When new users are added to the system their preferences are not known, arises a cold-start problem [8], recommendations for new users are created based on contextual (including demographic) and popular data. When the first actions of the user appear, it is possible to compute similarity coefficients for him, but this information is few at the beginning, so they do not fully reflect the preferences of the user and his similarity to other users. Therefore, even with a small amount of new data about such a user, the recompute of similarity coefficients for him can give significantly different values.
2. Changing preferences or the continuous coldstart problem.
In practically implemented recommendation systems, user preferences have a frequent change that may be related to changing a user's needs or changing their tastes and interests. Changing the preferences of already known users of a recommendation system, which has accumulated enough information to correctly identify their tastes, is known in scientific publications as the continuous coldstart problem [9].
Recommendation systems based on collaborative filtering are most sensitive to the cold-start problem, and therefore the continuous cold-start problem [1,8,9]. Thus, the conducted researches have shown that the main components of the improved method of formation recommendation lists can be an improved model of recomputing similarity coefficients of users (items), a time optimization model of similarity coefficients recomputation. Consider the main components of forming the recommendation lists method in more detail.

The improved model of computing user similarity coefficients
The conducted researches have shown that the basis for developing the improved model of computing similarity coefficients can be the user-based collaborative filtering approach and testing it using the graph database Neoj4. In this case, similarity coefficients between users can be used Pearson correlation coefficient [24,25]: where 1 u and 2 u users between whom the similarity coefficient is determined;, 2 2 r r ratings are set by 1 st and 2 nd users respectively; n the quantity of the items in the system; і 2 2 r r average ratings of 1 st and 2 nd users respectively. The value 1 2 ( , ) k u u belongs to the interval from -1 to 1, where -1 corresponds to the absolute dissimilarity of users, and 1 the absolute similarity.
Formula (1) provides that it is necessary to need to compute the difference between each rating 1i r and the average value of the ratings 1 r . For optimization in real applications for computations similarity coefficients, this formula is rewritten as: By periodically enumerating 1 2 ( , ) k u u , it is possible to detect the relative change in the preferences of users 1 u and 2 u , that is, when changing 1 2 ( , ) k u u can say that 1 u or 2 u or both users changed their preferences. Other approaches should be used to detect the absolute change in the user's preferences, but in this work, the authors are interested in the relative change of preferences because due to relative change of preferences it is necessary to recompute the similarity coefficients.
Since recompute all the similarity coefficients in a database for any user at each access to the system is a labor-intensive process. In this paper, it is proposed to add to the system the following parameters: the maximum allowable recomputation period of similarity coefficients for each user and the maximum allowable average recomputation period of similarity coefficients for all users system or a specific group of users. The recomputation period of similarity coefficients can be determined based on a level of user activity in the system and a frequency of his preferences change, which should be determined based on accumulated statistics about him.
It is proposed to compute the average recomputation period of similarity coefficients based on the accumulated statistics about all system users. Besides, to use it during the process of the cold-start problem for an individual user, whose the authors do not have yet enough data so that to determine his recomputation period of similarity coefficients. Also, possibly divide users into groups by a specific criterion. For example, activity level, and compute for each group its average recomputation period of similarity coefficients.
Consider the example of the graph part in the database of the developed recommendation system is shown in Figure 2 and Figure 3. Therefore, Figure 2 shows the graph part of the recommendation system database after computing user similarity coefficients. As the figure shows, the developed graph database contains users and items that are written as vertices of the graph, and ratings that are written as oriented edges of the graph that connect users vertices and items vertices. Based on the ratings of formula (2), the users' similarity coefficients are computed and recorded into the database in the form of non-oriented edges between users.
In Fig. 2 schematically shows the format of recording the above vertices and edges in the developed database. Since only oriented edges can be created in DBMS Neo4j, both types of edges are created oriented, but in the edges of the "Similarity" type (Figure 3b), the direction of the edges is ignored during the operation of the recommendation system. This figure shows in which format in the developed system proposes to save the values of the recomputation periods of similarity coefficients.  Nodes, representing users, contains the label: User and have the property id. Also, nodes, meaning items, contains the label: Item and the property id. A relationship that contains user rating (Fig. 3, a) has the label: Rated, the property rating that contains a value of rating, and the property time that contains the value of time when the user rated item. Relationships, that containing the user similarity coefficients (Fig. 3, b), have the label: Similarity and the following properties:  coefficient the value of the similarity coefficient,  recountPeriod the recomputation period of similarity coefficients for the given user (containing the empty value at the moment of cold-start),  averageRP the average recomputation period of similarity coefficients for all users of the system (or for a group of users to which that user belongs),  lastRecountTime the last recomputation time of similarity coefficients for that given user. Thus, user similarity coefficients must be recomputed if the system requests their reading at the time t lastRecountTime + recountPeriod  for an already known user or at the time t lastRecountTime + averageRP  for a user during the cold-start.
After similarity coefficients are recomputed, their values are rewrites to new ones in the database, and the time of the last recomputation is recorded in the property lastRecountTime.
The reasons for changing the similarity coefficients between a pair of users x 1 and x 2 can be:  User x 1 changed his preferences.
 User x 2 changed his preferences.
 Users x 1 and x 2 changed their preferences.  Enough data about user x 1 was accumulated to more accurately determine his similarity coefficients, and the previous data was not enough to determine the correct similarity coefficients.
 Enough data about user x 2 was accumulated to more accurately determine his similarity coefficients, and the previous data was not enough to determine the correct similarity coefficients.
 Enough data about users x1 and x2 were accumulated to more accurately determine their similarity coefficients, and the previous data was not enough to determine the correct similarity coefficients.
The experiment that values of the similarity coefficients between user pairs were recomputing at some time intervals, and comparing with the previous ones to determine the stability periods of the user similarity coefficients were conducted. Instability times of user similarity coefficients, to make their recomputations there is no sense. Moreover, knowing the average recomputation period of similarity coefficients, It is possible to determine the optimum intervals of time through that it is possible to recompute the similarity coefficients between users without significant loss of the system accuracy.

Experiment description
The open dataset MovieLens was used for the experiment [26]. This dataset was created based on the movie recommendation system. The dataset MovieLens contains the following data: user IDs, user ratings for movies, tags for movies (that were added by users), movie IDs, movie titles, movie genres, time of user action (namely rating time, tag creation time). Since users of this system must rate items using the number of stars. Besides, they can use half the star, and the maximum number of stars is five, then the ratings can be as follows: 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0.
The relationships between the elements of dataset MovieLens are specified using adjacency lists in spreadsheet files of .csv format, that contain, in one row, related elements such as user id, movie id, and the rating that a corresponding user has set a corresponding movie. In the dataset MovieLens, time is recorded in Unix-time format and represents a date from 28.07.1996.
For the experiment, all the time in the dataset was divided into intervals, in this example, these intervals were chosen for a duration of 1 million secondsapproximately 11 days. This period was chosen because of the particularities of the data set being used, namely that people's preferences for movies do not change so often, and the desire to watch movies of other genres may take several days. Initially, different time intervals were used, but stability/change periods for user similarity coefficients could be observed at the selected above interval duration, and the recomputations quantity of similarity coefficients on the dataset did not exceed 700, therefore experiments with such the time interval did not take much time.
Similarity coefficients between users were recomputed at the end of each period that determined by the given time interval, the data for the recomputation was taken from the start of the dataset and to the end of a current period. The computation data were recorded in a .csv file in the format shown in Table 1.
As a result, time series were obtained for each pair of users that contained values of their similarity coefficients at different time intervals. Similarity coefficients were considered only for the activity periods of the investigated users. That is, when users ceased their activity on the system, the similarity coefficients for them were no more computed, as they would remain unchanged, not because of their preferences changes, but because of the new information absence, as similarity coefficients would be computed based on old data that ceased to be updated. The limited number of user pairs were selected to process the data received, for which activity periods overlapped enough for analysis. The purpose of processing data from Table 1 is counting of stability periods k ij , that means a time during which none of the pair users have changed their preferences (the similarity coefficient between a pair of users has not changed). To determine such a period, in the table valid values of correlation for rating k ij (t 1 ) are searched. Then the time interval [t 1 ; t 2 ] is searched: where d the limit of sensitivity, in this case, d is selected to be equally 0.01. In most of the data, user activity is insufficient, for some values of time t the correlation coefficient is impossible to compute. In such cases, it is not possible to determine the fact of period completion where the correlation coefficient is constant. As a result, for defined intervals, the array T(n) was created, where n the serial number of the defined sequence; T the sequence duration in conventional units of time. The created array allows to plot diagram of event frequency to obtain the similarity coefficients stability interval of user pairs N(n) as shown in Figure 4.
The constructed frequency diagram of the stability intervals from their length in Figure 5 makes it possible to obtain the probability function of the specified interval existence length n using the normalization at that operation Initially, before constructing the chart, the data were smoothed by the moving average. After that, regressions were plotted, that match popular declining distributions. The best approximation was given by the exponential regression N(n) ≈ 80e -0,17n with the standard deviation S ≈ 19. At the same time, assuming the Pareto distribution, having an approximation N(n) ≈ 79n -0,93 with the standard deviation S ≈ 24. The obtained data contribute to the choice of the exponential distribution since its use allowed to obtain the smaller standard deviation of the approximation result from the experimental data. Unfortunately, the difference between the deviations of the best approximations is negligible against the background of random deviations of the plot, so the statement of the exponential distribution should be understood only as a working hypothesis. Also, to model the process of changing the similarity coefficients, applying the assumption that each similarity coefficients changes at a random time and independently of each other, because such a process has the exponential distribution, analogous to radioactive decay. Then can proceed to determine the time during that user pairs will change the similarity coefficient with the 0.5 probability.
The invariance probability determination of the similarity coefficients (within d) as a time function is possible by presenting the data from Figure 4 as follows in Fig. 5.   Fig, 5. The dependence of the user pair quantity, who have not changed their similarity coefficient, on time; where: t conditional time; k the user pair quantity who have not changed their similarity coefficients at a given time t The plot from Figure 5 was obtained as follows: At the beginning time, the total number of monitored users was noted.
Further, at each time interval, the user pair quantity, who has not changed their similarity coefficient, was marked, which was defined as the difference from the previous value at the appropriate time on this plot and the corresponding value at the appropriate time on the plot from Fig. 4. To confirm the assumption of the exponential law, the exponential regression was constructed, which showed a sufficiently small standard deviation.
According to the change distribution exponential law hypothesis of user similarity coefficients in time, the laws of radioactive decay can be applied to this process, because of the coincidence of the accepted basic laws of distribution. The plot from Figure 5 was used to facilitate the search for a period when the given part similarity coefficients of users (for example, 50%) will be changed, by analogy with the radioactive decay law. Indeed. Fig. 5 shows the plot of the user pairs quantity N(t), that have not changed the similarity coefficients, this plot can be approximated by the exponential function [27]: where N 0 the initial number of users, λ the sought regression coefficient, t conditional time.
For the statistical description of preference changes, it is sufficient to determine the coefficients N 0 and λ by exponential regression.
The regression is performed by logarithmic the left and right parts of the equation.
The regression is performed on experimental data, that are given in the following Table 2. The regression error square is computed by the following formula: If open the parentheses, then the formula will take the form that can be used to find the standard deviation of R 2 : 2 2 0 2 0 2 2 0 ln ( ( )) 2ln( ( )) ln( ) 2 ln( ( )) ln ( ) 2 ln( ) where the overline indicates the operation of computing the arithmetic mean of all regression data: i = 1..n.
To find the extremum of the standard deviation of the regression from the experimental data, which is the only minimum, we equate the derivatives by the sought coefficients to zero: that gives the following system of linear equations: 2 0 0 ln( ( )) ln( ) 0 ln( ( )) ln( ) 0 The solution the system of equations will give the following expressions to compute the sought coefficients: 2 ln( ( )) ln( ( )) After the computations, the curve really will be to reflect the exponential distribution N(n) ≈ 366.72e -0.046n . As a result, the indicator λ = 0.046 allows to determine the following values, as an analog of the decay patterns of radioactive isotopes [28]: The average lifetime of preference τ = 1/λ. In this example, the average stability time of the similarity coefficients of user pairs is τ = 21.7 selected time intervals in the experiment.
Half-life: The time at that half of the user pairs will change their preferences: T 1/2 = τln2, T 1/2 ≈ 15 the selected time intervals in the experiment.
The probability of preference change at time t: The probability of preference invariability at time t: q(t) = e -λt .
In the process of servicing recommendation systems, for us the most important criterion is the assurance that a user will do not change preferences during time t st with probability p st : Also more useful maybe the formula that shows the time of user preferences change with probability q st : So, if the recommendation system allows the error probability q st , then similarity coefficients should recompute no more frequently than every time intervals t st .

Time optimization model of similarity coefficients recomputing
Time optimization model of similarity coefficients recomputing: 0 ( , , , , , , ) min fr ir fr ir T T T n n n t   , where fr T the time of complete recomputation, that including the recomputation of similarity coefficients and their transmission for further processing, as well as the value λ; ir T the time of transmission of the old similarity coefficients for further processing; fr n part of the wrong decisions about the recomputation of the similarity coefficients (to obtain the prediction of preferences with the given accuracy it was not necessary to recompute the similarity coefficients, it was possible to save system resources); ir n part of the wrong decisions about not recomputing the similarity coefficients (to obtain the prediction of preferences with the given accuracy it was necessary to recompute the similarity coefficients); 0 n the part of the wrong recommendations; t the time since the last recomputation of preference statistics;  the average period of user access to the system. These values are subject to the following restrictions: ir fr T T  the technological constants that depend on the performance of a computing system and computation algorithms; 1 ir n  the part can be expressed from the empty set before all cases are included; 0 0 cr n n   the part of the false recommendations should not exceed value ; 0 0 t t       the time cannot be negative, the recomputation for zero intervals of time is not expedient, also the time is limited in value within reasonable limits; t   system work time should be greater than the time between user visits.
The function of average customer service time T is built based on listed above values and the problem of minimizing this service time is solved. The system works as follows: The point of time reference for an individual user is the moment when the last full recomputation of recommendations based on his activity history.
On subsequent hits, the system estimates the probability that the previous computations of the similarity coefficients will be erroneous for the user. If the error probability has exceeded the set critical value, then the similarity coefficients are completely recomputed.
Let's introduce the notation cr t (cr: critical), as the time after which the probability of making wrong recommendation lists is higher than cr n . The recommendation creation error consists of the basic probability of error for a recommendation system b p and the probability of error due to the use of the old similarity coefficients without their recomputation   1 t p t = e   .
As a result of computing the sum of probabilities, having the following result:

Conclusions
In this article, the model of user similarity coefficients computation for recommendation systems is proposed. The model differs from the known ones, in that the recomputation period indicator of the similarity coefficients, for an individual user, and the average recomputation period indicator of the similarity coefficients, for all users of the system, or a specific group of users is taken into account.
During the modeling, an analytical expression was proposed to determine the intervals at which it would be advisable to recompute the user similarity coefficients in the recommendation system.
It has been experimentally demonstrated that the use of the proposed solutions will provide an opportunity to increase the period of application of the previously computed user similarity coefficients for the prediction of user interests, without recomputing them every time and, accordingly, reduce the time of formation and issuance of recommendations up to 2 times.