ReRec: A Divide-and-Conquer Approach to Recommendation Based on Repeat Purchase Behaviors of Users in Community E-Commerce

: Existing studies have made a great endeavor in predicting users’ potential interests in items by modeling user preferences and item characteristics. As an important indicator of users’ satisfaction and loyalty, repeat purchase behavior is a promising perspective to extract insightful information for community e-commerce. However, the repeated purchase behaviors of users have not yet been thoroughly studied. To ﬁll in this research gap from the perspective of repeated purchase behavior and improve the process of generation of candidate recommended items this research proposed a novel approach called ReRec (Repeat purchase Recommender) for real-life applications. Speciﬁcally, the proposed ReRec approach comprises two components: the ﬁrst is to model the repeat purchase behaviors of different types of users and the second is to recommend items to users based on their repeat purchase behaviors of different types. The extensive experiments are conducted on a real dataset collected from a community e-commerce platform, and the performance of our model has improved at least about 13.6% compared with the state-of-the-art techniques in recommending online items (measured by F-measure). Speciﬁcally, for active users, with w = 1 and N ( U A ) ∈ [ 5,25 ] , the results of ReRec show a signiﬁcant improvement (at least 50%) in recommendation. With α and σ as 0.75 and 0.2284, respectively, the proposed ReRec for unactive users is also superior to (at least 13.6%) the evaluation indicators of traditional Item CF when N ( U B ) ∈ [ 6, 25 ] . To the best of our knowledge, this paper is the ﬁrst to study recommendations in community e-commerce.


Introduction
Community e-commerce, which combines the features of traditional e-commerce and mobile commerce, is a representative of community economy [1] and marks the rise of a new commercial ideology. Generally speaking, community e-commerce refers to a novel business model that takes communities as service units and provides a more convenient manner in online shopping than traditional e-commerce for community residents [2,3]. On the one hand, unlike traditional e-commerce that provides products and services all over the world or a country, community e-commerce focuses on a relatively stable group of consumers in a local area as a compatible complement for B2B, B2C and C2C models. On the other hand, like traditional e-commerce, the huge amount of online information and items brings about a heavy burden for online consumers, the users of community e-commerce also suffer from the endless choices and decisions in online shopping and the merchants in community e-commerce are still struggling to predict the interests of users in online items beforehand, in order to manage their inventories. For this reason, it is urgent to develop a recommendation system for community e-commerce platforms to predict the items that a user may possibly purchase in the near future based on the user's purchase history [4].
In community e-commerce, it is a usual case that a user would purchase the same item repeatedly and periodically. In the scenario of traditional e-commerce, these items will not be recommended to the user repeatedly in the future. However, with the focus on limited number of users in a local area, the recommendation for repeat purchase is crucial for the success of community e-commerce. For instance, by observing user behaviors on the community e-commerce platform T-app (see Section 5.1), we find that from 1 January 2018 to 1 April 2019, among 955 users who have made purchases on T-app, 58.74% have repeat purchases. For these users with repeat purchase, their average repurchase is 3.61 times, and 10.33% of them repurchase the same item six times. In an extreme case, we find that one user has repurchased the same item up to 43 times during the investigated time duration. Among all the 105 types of items, 82 (78.10%) have been repurchased by users. Therefore, it can be seen that repeated purchase behavior is an essential user characteristic that should be paid enough attention to when community e-commerce platforms make recommendation plans.
Existing studies have proposed many recommendation algorithms to predict users' potential interests in items by characterizing user preferences and item characteristics, e.g., the nearest neighborhood based recommendation algorithm [5][6][7], the matrix factorization based recommendation algorithm [8,9] and the context aware recommendation algorithm [10,11]. Clearly, the basic idea of these algorithms is straightforward-that if a user purchased an item in the past, he or she will also purchase similar items, or items purchased similar users at that time, in the future. However, if an item has already been purchased by a user, then the item will not be recommended by theses algorithms to the user. That is to say, the repeated purchase behavior of users has not yet been thoroughly studied. To fill in this research gap, this paper proposes a novel approach called ReRec (Repeat purchase Recommender) for recommending items to users in community e-commerce. To the best of our knowledge, this paper is the first to conduct item recommendation in community e-commerce. For industrial applications, the proposed method can help manage and identify loyal users and segment users and to improve customer relationship management (CRM) processes. In addition, for managers, this method can also help them formulate precision marketing strategies, recognize the market, and advance the sustainable development of products.
Specifically, ReRec comprises two components. The first component is to model the repeat purchase behaviors of different types of user. This research models the repeat purchase behaviors of the users in community e-commerce. based on their activity in the community and the stability of their interests in items, in a divide-and-conquer manner, using these categories: active users with stable interest (ASI), active users with unstable interest (AUSI), inactive users with stable interest (IASI) and inactive users with unstable interest (IAUSI). The second component is to recommend items to users based on repeat purchase behaviors. This research proposes the ReRec approach in four variants to deal with different types of users and interests, i.e., recommendation for active users with stable interest (ReRec-ASI), recommendation for active users with unstable interest (ReRec-AUSI), recommendation for inactive users with stable interest (ReRec-IASI) and recommendation for inactive users with unstable interest (ReRec-IAUSI). Finally, extensive experiments based on a real community e-commerce platform are conducted and the experimental results demonstrate that the proposed ReRec approach outperforms state-of-the-art techniques significantly.
The rest of this paper is organized as follows. Section 2 states the problem. Section 3 presents related works. Section 4 proposes the ReRec approach. Section 5 conducts the experiments. Section 6 concludes the paper and indicates future work.

Problem Statement
The problem studied in this paper is one of recommendation for repeat purchase in community e-commerce, which is different from that of traditional recommendation, such as collaborative filtering [5,6,12]. Essentially, this research can formulate the problem as follows. Assume that there are a set of users as U = {u k |1 ≤ k ≤ m}, and a set of items as I = {i s |1 ≤ s ≤ n} in community e-commerce. The historical sales data until time t is recorded as a matrix R t U I = r t u k i s 1 ≤ k ≤ m, 1 ≤ s ≤ n , where r t u k i s is the number of cumulative purchases of the user u k of the item i s at t. Note that the user u k has purchased the item i s repeatedly and periodically. Let R t+1 u k i s be the possibility that the user u k purchases the item i s on t + 1. We need to speculate the possibilities of user u k purchasing all the possible items i s (1 ≤ s ≤ n) on t + 1, i.e., R t+1 u k i s for all the items i s on t + 1. After deriving the R t+1 u k i s , it sorts all the possibilities in descending order for user u k , and uses the top N items as the recommendation list to him or her.

Nearest Neighborhood Based Recommendation
On the aspect of nearest neighborhood recommendation, the user-based nearest neighbor method and item-based nearest neighbor method are usually adopted. Resnick et al. [13] propose user-based collaborative filtering to recommend internet news to readers according to readers' rating scores of the internet news. This algorithm firstly calculates the similarity between users, and then for a given user it recommends items that are of interest to similar users to him or her. Considering the large number of items in a recommender system, Sarwar et al. [14] propose item-based recommendation to compute and store items' similarities beforehand in the system and use these similarities in real time when needed to produce a recommendation list for a user. The basic idea of the item-based algorithm is to assume that people will like items that are similar to those items they have purchased before. Since a user has purchased an item in history, he or she would also purchase similar items in the future. The item-based algorithm is very similar to the user-based algorithm. More details about user-based collaborative filtering and item-based collaborative filtering approaches can be found in the available literature [5][6][7]12,15]. The advantage of the nearest neighborhood algorithms is that they are easy to implement in real practice because of their simple mathematical form and consolidated intuitiveness. However, due to the sparse nature of the historical purchasing data, it is difficult to measure similarities between users and items [8]. Moreover, because the users' interests in items can change very frequently, it makes the computation complexity of real-time recommendation intractable [4].

Matrix Factorization Based Recommendation
On the aspect of matrix factorization based recommendation, SVD (Single Value Decomposition), SVD++ and NMF (non-negative Matrix Factorization) are the most representative techniques. SVD is a basic matrix decomposition method used in the recommender systems proposed by Chen et al. [9] and Brand [16]. It decomposes the original matrix R with higher dimensions into three matrix multiplication forms with lower dimensions, which brings convenience to matrix calculation and storage. Specifically, SVD decomposes the rating matrix R m×n into three matrices: left singular vector P m×n , right singular vector Q m×n and singular value diagonal matrix S m×n as in Equation (1). Both P and Q matrices are orthogonal and matrix S is a diagonal matrix composed of singular values where all the singular values are aligned in descending order from the largest to the smallest. For all the singular values S ii ≥ 0, the rank of the rating matrix R is a, and the number of ranks that can be taken is {a h |1 ≤ h ≤ min(m, n)}.
SVD++ is an extension of traditional SVD that takes into account both explicit and implicit information for recommendation [17]. Here, explicit information refers to the users' rating of an item, and implicit information refers to the users' implicit feedback, such as browsing, buying, and clicking history [8]. The prediction ratingγ ui of SVD++ is defined in Equation (2).γ The prediction ratingγ ui is composed of two parts: one is the deviation of different users to different products b ui , the other is the product of the user preference vector p u and the product feature vector q i , where µ denotes the benchmark value in the score, b u is the deviation value of user rating, and b i is the score deviation of the product. These parameters need to be trained to obtain specific values.
As for NMF, the rating matrix R is approximated by the product of two low-dimensional matrices P and Q, as shown in Equation (3). The NMF problem is non-convex and is usually solved by the gradient descent method [18].
The advantage of the matrix decomposition method is that the users' preference in the item is regarded as the product of two components, i.e., as the users' latent vector representing the user preference and the item's latent vector representing the item's characteristics. Both the user's latent vector and the item's latent vector can be stored in the memory of the recommender system in advance, so it is convenient to compute and predict the user's preference in the item in real time. However, the matrix factorization method also has some defects. Because most view the user item rating matrix from a global perspective and perform matrix decomposition, their performance will be affected due to the large scale of the original user project scoring matrix and the sparse data.

Context-Aware Recommendation
The collaborative filtering algorithm for recommendation only considers the interactive information between users and items, such as the users' rating matrix for items. Meanwhile, other information, such as contextual situation information during interactive behavior, is generally not considered. A context-aware recommender system (CARS) is used to recommend items to users based on relevant contextual information such as time, weather and location. Contextual information can improve the performance of recommendation and user satisfaction when it is combined with the recommendation algorithm. Gorgoglione et al. [19] report that the context-aware recommendation system can achieve more accurate recommendation by adding contextual information in the experiments, and this recommendation system can significantly increase the platform profit and users' stickability. Time information can consist of the time when users purchase, comment, search or perform other behaviors, or the time of the season or holiday. For instance, around the time of the Dragon Boat Festival in China, users may have a higher preference for rice dumplings than usual.
There are also some studies showing that reasonable use of time information can improve the performance of the recommendation algorithm. Zimdars et al. [20] make use of time series forecasting in collaborative filtering for recommendation. Campos et al. [21] find that there is a time-dependent characteristic of user behaviors in online shopping. For instance, the same user may have different preference patterns on different dates, months and seasons. Liang et al. [22] propose the Time SVD algorithm to integrate four kinds of time-affected factors into time functions and they find that the performance of the Time SVD algorithm is significantly better than that of the traditional SVD algorithm. Qin et al. [23] claim that users of different professions have obvious differences in understanding items, and there is an important relationship between user hierarchy classification and user interest. Traditional collaborative filtering algorithms do not consider change in users' interests. However, in real practice, users' interests are constantly changing with time and the influence of the environment. Therefore, some studies introduce the concept of user interest drift [24,25]. Chen et al. [26] provide a matrix decomposition optimization model that is constructed to think about the score matrix and combines time information and the original score matrix to improve the recommendation efficiency. Wu et al. [27] include the time factor in order optimize the weights of users' ratings based on time and user similarities.

The Overview of the ReRec Approach
The overall structure of the proposed ReRec approach is shown in Figure 1. As can be seen, the proposed ReRec approach is composed of two components, i.e., repeat purchase behavior analysis and item recommendation. Before the analysis, this research collects the user-item purchase records as a basic data matrix, i.e., the original user-item interaction matrix. In the original user-item interaction matrix, the row label is user ID, the column label is item ID and the element is the cumulative purchase quantity of an item by the corresponding user at time t. Then, users are classified according to activeness and useritems are classified according to stableness. As shown in the yellow area of Figure 1, users are partitioned by mathematical modeling as the active and inactive users, and the items are partitioned as stable and unstable interest. The nodes with black circles denote the users. The nodes with blue circles denote the items. The nodes with red circles denote user-item interaction. The nodes with dotted circles denote the immediate process. In addition, the partition process can be visualized as the user partition matrix and the item partition matrix derived from the original user-item interaction. As for the user partition matrix, a user ID with yellow indicates an active user and a user ID with green indicates an inactive user. As for the item partition matrix, an item ID with red indicates the stable interest of its user and an item ID with blue indicates the unstable interest of its user. Results of the combined user and item classification can be seen in the joint user-item partition matrix. With the above joint user-item partition matrix at hand, this research conducts the item recommendation by using a divide-and-conquer approach. That is, it partitions the repeat purchase behaviors of users into four types: active users with stable interest (ASI), inactive users with stable interest (IASI), active users with unstable interest (AUSI), and inactive users with unstable interest (IAUSI). Furthermore, this research proposes the ReRec recommendation algorithm with its four variants to deal with the repeat purchase behaviors of the four types one by one: the ReRec-ASI approach, the ReRec-IASI approach, the ReRec-AUSI approach and the ReRec-IAUSI approach, which are shown in the blue area of Figure 1.

Repeat Purchase Behavior Modeling
As community e-commerce focuses on the residents in the local community, the characteristics of user purchase data are different from that of the large-scale e-commerce platform, such as Alibaba, JD and Amazon. Firstly, the consumer group for community e-commerce is relatively stable. That is, the users of community e-commerce are local residents in a limited area such as a residential area, an office area or a campus. Secondly, the number of item types in a community e-commerce is relatively small. Therefore, it can study the characteristics of user-item interactions in a finer granularity than that of the traditional recommendation algorithms and this research holds that the study of fine-grained interactions between users and items is beneficial for improvement of the recommendation algorithm. For this purpose, this research classifies and studies the repeat purchase behaviors of users based on their historical purchase data.

The Classification Models
As the activeness of users is related to the transaction volume of the users' base over time [28], this research adopts a mathematical modeling method to model the behaviors of users along with user-item by purchase volume and the length of time in using community e-commerce.
The mathematical models of user classification are shown in Equations (4)-(6), where h t (u k ) is the user activeness. h t (u k ) is positively related to the number of item types purchased by users u k at time t and the number of days of user u k when using community e-commerce. This research standardizes these factors to eliminate inconsistent dimensions. Equations (4)- (6) can divide all the users of the e-commerce platform into two types, as active users and inactive users.
Meanwhile, the mathematical models of item classification are shown in Equations (7)-(9), where g t (i s |u k ) is the interest stableness. g t (i s |u k ) is positively related to the total number of item i s purchased by user u k before time t and the time interval between the last purchase of user u k as well as the earliest purchase of item i s . This research also standardized these factors to eliminate inconsistent dimensions. Equations (7)-(9) can divide users' interests in items into stable interest and unstable interest.
The symbolic definitions of the classification models are shown in Table 1. This research defines the four types of user repeat purchase behaviors based on user activeness and item stableness.
The activeness of user u k (in using community e-commerce) at time t The activeness of user u k at time t after standardization The number of item types purchased by users u k at time t The first time that user u k purchased an item in using community e-commerce The stability of user u k purchasing item i s after standardization The stability of user u k purchasing item i s

User-Item Interaction
The user interacts with the item when a purchase record occurs. This section defines the user-item interactions theoretically by using mathematical modelling. It calculates the activeness of a user by mathematical model h t (u k ), and the stableness of user-item by g t (i s |u k ). The following shows the definitions of active user and inactive user, and the definitions of stableness interest and unstableness interest. Definition 1. Assume that U A denotes a set of active users. If a user u k from U A uses the community e-commence software for a relatively long time and purchases a variety of items, the user is an active user, where if h t (u k ) ≥ δ, user u k ∈ U A ; δ is the threshold of user activeness, δ ∈ (0, 1), and δ is decided by the cumulative distribution of h t (u k ) of all users.

Definition 2.
Assume that U B denotes a set of inactive users. If a user u k uses the threshold of user activeness for a relatively short time or purchases fewer types of item, the user is an inactive user, where if h t (u k ) < δ, user u k ∈ U B . So the set of all users U consists of U A and U B , i.e., U = U A ∪ U B . Definition 3. Let I A (u k ) be a set of stable interests of user u k . If the number of item i s purchased by user u k is relatively large and the time span of the purchase behavior is long, item i s is users with stable interest, where g t (i s |u k ) ≥ θ , i s (u k ) ∈ I A (u k ). θ is the threshold of user-item stableness, θ ∈ (0, 1), and the value of θ is decided by the cumulative distribution of g t (i s |u k ) of all items. Definition 4. Let I B (u k ) be a set of unstable interests of user u k . If the number of items i s purchased by user u k is relatively small or the time span of the purchase behavior is short, item i s is users with unstable interest, where g t (i s |u k ) < θ and i s (u k ) ∈ I B (u k ). Thus, the set of all items for user u k i.e., I(u k ) consists of I A (u k ) and I B (u k ), With the above definitions, the user-item interactions can be divided into four categories. The notation (I A |U A ) denotes the active users with stable interest (ASI). The notation (I B |U A ) denotes the active users with unstable interest (AUSI). The notation (I A |U B ) denotes the inactive users with stable interest (IASI). The notation (I B |U B ) denotes the inactive users with unstable interest (IAUSI). Figure 2 shows the classification process as a whole. Mathematical functions of the classification are shown as Equation (10). The overall interests of ASI users remain active and they have stable interests in items in I A |U A . This improves the algorithm upon the repurchase cycle of items. Generally, when a user has just purchased an item, the possibility of repeating the purchase immediately is very low. However, as time goes on, with the user running out of the item, he/she is more likely to make repeated purchase. For this reason, this research could prioritize the recommendation of the item to the user. This research develops a time incentive factor w α t u k i s based on relationship of the last purchase time and the repurchase cycle to improve the user-KNN recommendation algorithm. Due to users in ASI having stable purchase interests, it assumes that their stable interests do not change over time, and the time incentive factor w α t u k i s is a periodic piecewise constant function. The model of the time incentive function is as shown in Equation (11).
Here, t u k i s last+1 = t u k i s last + T i s , T i s is the repurchase cycle of item i s , αT i s is the best time to recommend from time t u k i s last to the next purchase time t u k i s last+1 , and α is a lead-time factor and α ∈ (0, 1).
To be specific, as users in ASI have stable purchasing interest and obvious repeat purchase behavior, it considers a periodic time incentive factor for item recommendation in ASI. That is, the time incentive factor changes with the repurchase cycle. In particular, if the last time user u k purchases item i s is time t u k i s last , he/she will purchase item i s repeatedly at time t u k i s last + T i s , i.e., t u k i s last+1 . When the recommendation time t u k i s ∈ t u k i s last , t u k i s last + αT i s , it is very unlikely for user u k to make a repeat purchase. Thus, a negative time incentive factor −w should be combined with the recommendation algorithm. However, when the recommendation time t u k i s is close to the next time of repeat purchase t u k i s last+1 , and t u k i s ∈ t u k i s last + αT i s , t u k i s last+1 , it is very likely for user u k to repeat purchase item i s . Thus, a positive time incentive factor w should be combined with the recommendation algorithm. This time incentive process is carried out periodically with repeated purchase.
Next, this research employs cosine similarity to calculate the similarity between users. The similarity between user u k and user u k at time t is shown in Equation (12): where u k , u k are the vectors of historical purchase records of user u k and user u k before time t, respectively. The R t+1 u k i s function of this kind of items is established as Equation (13).
Here, q t u k i s is the cumulative purchase of item i s by user u k at time t. sim(u k , u k ) t is the similarity between user u k and user u k at time t. w α t u k i s is the time incentive factor if user u k purchased item i s at time t. If user u k did not purchase item i s before time t, it uses w α t u k i s to incentive the recommendation process, where w α t u k i s is the time incentive factor by users u k in U A except user u k and w α t u k i s is the average time incentive factor by all other users u k . w α t u k i s is established as Equation (14). x u k i s is a 0-1 variable.
Here, it regulates x u k i s = 1 0 i f user u k ever purchased item i s , else .

Model of ReRec-AUSI
The overall interests of the AUSI users remain active, but they purchase items in I B |U A of their random interest, where the activeness of users is more than threshold δ but the stableness of user-item interest is less than threshold θ. The repeat purchase behavior of users is not significant. Hence, the proposed ReRec-ASI based on the repeat purchase cycle of items will be invalid for item recommendation in AUSI. For this reason, this research considers the recommendation algorithm for the AUSI users by combining the user-KNN algorithm and the one-time hot-sale index, assuming that items with higher one-time hot-sale index in AUSI may be preferred by users. In particular, one-time hot-sale index of item i s , denoted by τ t i s , refers to an index that is the largest single sales quantity before time t of item i s , after the range standardized calculation. The calculation of τ t i s is as Equation (15) It is similar to the ReRec-ASI approach that this research considers the ReRec-AUSI method by adding one-time hot-sale index to the user-KNN recommendation algorithm. However, as users in AUSI have unstable interest, this research recognizes the similarity by reversing it from 1, and then multiplying by the cumulative purchase amount of other users for item i s . The improved similarity can pledge that not only the recommended items were purchased by similar users, but also are not always recommended. This is in line with the characteristics of unstable purchase interest of users in AUSI. Moreover, combined with the one-time hot-sale index, the improved similarity will further better the hit rate of recommended items. The R t+1 u k i s function of ReRec-AUSI is established as Equation (16), where q t u k i s is the cumulative purchase quantity of item i s by user u k at time t. sim(u k , u k ) t is the similarity between user u k and user u k at time t based on KNN algorithm. τ t i s is the one-time hot-sale index at time t of item i s .

Model of ReRec-IASI
The overall interests of users in IASI remain inactive, but they purchase items in I A |U B of their stable interest. This research improves the algorithm upon repurchase cycle of items. Especially, it is similar to the behavior of users in ASI in that when a user has just purchased an item the possibility of repeating the purchase immediately is very low, but, as time goes on, with the user running out of the item, he/she is more likely to make repeated purchase. However, as the users in IASI remain inactive, the proposed ReRec-ASI for active users will be invalid for item recommendation in IASI, and the similarity based on users is unreliable. For this reason, this research prioritizes the item-KNN recommendation algorithm by adding a time incentive factor. Considering the characteristic of users in IASI, it assumes that the trajectory of their purchasing interest conforms to the Eibinghaus forgetting curve [29] and the interest declines over time. So, similar but different from the time incentive function in ReRec-ASI is that the principal of function segmentation of time incentive factor w b t u k i s of ReRec-IASI is the same, but is improved by the Eibinghaus forgetting curve, and is a periodic piecewise exponential function. The model of the time incentive function is as shown in Equation (17).
Here, t u k i s last+1 = t u k i s last + T i s , T i s is the repurchase cycle of item i s . αT i s is the best time to recommend from time t u k i s last to the next purchase time t u k i s last+1 , where α is a lead-time factor and α ∈ (0, 1). σ is the forgetting rate, and σ ∈ (0, 1).
To be specific, as users in IASI have stable purchasing interest in items and obvious repeat purchase behavior, this research considers a periodic time incentive factor to item recommendation in IASI, i.e., the time incentive factor according to improved Eibinghaus forgetting curve changes with the repurchase cycle. In particular, if the last time user u k purchases item i s is time t u k i s last , generally he/she will purchase item i s repeatedly at time t u k i s last + T i s , i.e., t u k i s last+1 . When the recommendation time is t u k i s ∈ t u k i s last , t u k i s last + αT i s , it is very unlikely for user u k to make a repeat purchase. For this reason, a negative time incentive factor −e − t u k is −t u k is last σ should be considered in the recommendation algorithm. However, when the recommendation time t u k i s is close to the next time of repeat purchase t u k i s last+1 , where t u k i s ∈ t u k i s last + αT i s , t u k i s last+1 , it is very likely for user u k to repeat purchase item i s , so a positive time incentive factor 1 − e − t u k is −t u k is last σ should be considered in the recommendation algorithm. This time incentive process is also carried out periodically with repeated purchase.
Next, it uses cosine similarity to calculate the similarity between items. The similarity between item i s and item i s at time t is shown in Equation (18).
where i s , i s are the vectors of historical purchase records of item i s and item i s before time t, respectively. So, the R t+1 u k i s function of this kind of items is established as Equation (19).
Here, q t u k i s is the cumulative purchase of item i s by user u k at time t. sim(i s , i s ) t is the similarity between item i s and item i s at time t. w b t u k i s is the time incentive factor when user u k purchases item i s at time t. If user u k did not purchase item i s before time t, this research uses w b t u k i s to incentivize the recommendation process, where w b t u k i s is the time incentive factor by users u k in U B except user u k . w b t u k i s is the average value of the time incentive factor when user u k who is not user u k , purchases item i s at time t. x u k i s is a 0-1 variable and it is modeled as Equation (20).
x u k i s = 1 0 i f user u k ever purchased item i s , else

Model of ReRec-IAUSI
The overall interests of the IAUSI users remain inactive and they usually purchase items in I B |U B of their random interests, where the activeness of users is less than threshold δ and the stableness of user-item interest is also less than threshold θ. Users do not have declining repeat purchase behavior. Hence, the proposed ReRec-IASI based on declining repeat purchase cycle of items will be invalid for item recommendation in IAUSI. For this reason, this research considers the recommendation algorithm for the IAUSI users by combining the item-KNN algorithm and total hot-sale index, where it assumes that items with higher total hot-sale index in IAUSI may be preferred by users. In particular, the total hot-sale index of item i s , denoted by ϕ t i s , refers to an index that is the largest total sales quantity before time t of item i s , after the range standardized calculation. The calculation of ϕ t i s is as in Equation (21), where C i s t is the largest total sales before time t of item i s , max ∑ i s ∈I C i s t is the largest C i s t among all the C i s t of items in I B |U B , and min ∑ i s ∈I C i s t is the smallest C i s t among all the C i s t of items in I B |U B . The bigger the largest total sales quantity, the greater the total hot-sale index. ϕ t i s is a decimal between 0 and 1.
Similar to the ReRec-IASI approach, this research considers the ReRec-IASUI method by adding an incentive factor which is a hot-sale index to the item-KNN recommendation algorithm. However, as users in IAUSI have unstable interest, the research recognizes the similarity by reversing it from 1, and then multiplying by the cumulative purchase amount of other users for item i s . The improved similarity can show not only that the recommended items were purchased by similar users, but also that the recommended items are diverse. This is in line with the characteristics of unstable purchase interest of users in IAUSI. Moreover, combined with the total hot-sale index, the improved similarity will further increase the hit rate of recommended items. The R t+1 u k i s function of ReRec-IAUSI can be formed as Equation (22).
where q t u k i s is the cumulative purchase of item i s by user u k at time t. sim(i s , i s ) t is the similarity between item i s and item i s at time t. ϕ t i s is the hot-sale index at time t of item i s .

The Dataset
The dataset used in this paper comes from a community e-commerce platform T-app, with 11,350 purchase records from June 2017 to August 2019. It contains 1064 users and 137 kinds of items. The characteristics of each record include user ID, item ID, purchase time, purchase quantity, price, payment method and other attributes. Specifically, the data from June 2017 to April 2019 (10,343 records) are used as the training set, and the data from April 2019 to August 2019 (1007 records) are used as the test set. The user-item recommendation models are trained on the training set, and are tested on the test set.
The purchase behavior of users on the T-app platform has obvious characteristics of repurchase. For instance, by analyzing the data of a time phase, it is found that among 955 users who have made purchases, 58.74% have repeat purchases. In Figure 3, it can be seen that the total repurchases of 23% of repurchase users is larger than 15. The average repurchase time of repurchase users is 3.61. Among the repurchase users, 10.33% repurchase the same item more than six times. In an extreme case, it is found that one user has repurchased the same item up to 43 times under the investigated time duration. In Figure 4, it can be seen that, among all the types of item (105 types), 78.10% (82 types) have been repurchased by users, and in 17% of the repurchased items, the total number of times repurchased by users is more than 120.

Experimental Setup
In the traditional collaborative filtering recommendation, the user-item score matrix is usually used as the original data for the recommendation calculation. This paper adopts offline experiments for verification, and the user's cumulative purchase is used as the score. First, according to the user classification model, the user-item is classified into four categories: active users with stable interest, active users with unstable interest, inactive users with stable interest and inactive users with unstable interest. Then, the recommendation calculation is carried out for each category, and the improved recommendation algorithms for active users and inactive users are evaluated respectively. The results are then compared with that of the traditional CF, SVD, SVD++, and NMF algorithms.
The repurchase cycle refers to the time interval between the nth and the (n + 1)th purchase of item i s by user u k . For an item, the repurchase cycle of different users at the same time period is different, and that of the same user at different time periods is also different. So, if the items' repurchase cycle is calculated by each user by time, it could be highly random and prone to overfitting. Therefore, for the active users' stable purchase behavior, the average repurchase cycle of the top three users in purchase quantity of a certain item is used as the repurchase cycle. For the items included in I A |U B , as the overall interest of users is inactive, the repurchase cycle of the user who purchases the largest quantity of an item is regarded as the repurchase cycle of this item. Examples of repurchase cycle for some items included in I A |U A are shown in Table 2 and for some items included in I A |U B in Table 3.  In the experiments, each type of user behavior model can produce a corresponding item recommendation list. After sorting in descending order according to the purchase possibility, the recommended items can be selected according to the top N method. N (U A ) is the number of active users and N (U B ) is the number of inactive users, and they can be expressed as Equations (23) and (24), respectively.
Here, N (I A |U A ) is the recommended item quantity from items included in I A |U A .
are similar in meaning to N (I A |U A ) . So, it is easy to discover that the recommendation list of active users is composed of N (I A |U A ) stable interests and N (I B |U A ) unstable interests. Similarly, the recommendation list of inactive users is composed of N (I A |U B ) stable interests and N (I B |U B ) unstable interests.
Considering the actual situation of T-app, its operators should select the best combination of items in different user-item classifications for recommendation. Hence, here this research uses the grid search method to test the models. Firstly, let the total number of recommendation items be less than the number of all items, N max , for each type of user. Both the number of stable items and unstable items should be less than N max . That is to say, it has constraints (25) and (26). In the test experiment, N max is set as 25. Secondly, with constraints (25), N (U A ) has multiple combinations of N (I A |U A ) and N (I B |U A ) , and it is the same as N (U B ) . For instance, when the total number of recommended items N max is 5, (N (I A |U A ) , N (I B |U A ) ) can be able to (0,5), (1,4), (2,3), (3,2), (4,1), (5,0). It can select the optimal combination among the six combinations as the recommended combination when

Evaluation Metrics
Three evaluating indicators are used to gauge the algorithm performance, precision (Pre), recall (Rec) and F-measure, defined in Equations (27)- (29). Precision is defined as the ratio of items that users like to all recommended items in the recommended list. Recall is defined as the ratio of the items that users like in the recommended list to all the items that users like in the system. Generally, precision and recall must be used at the same time to fully evaluate the quality of the algorithm. Some researchers have proposed an indicator called F-measure that comprehensively integrates the precision and the recall. Therefore, the evaluation indicators used in this paper are precision, recall, and F-measure to measure the precision of item recommendation. The three expressions are shown as (27)- (29).
Here, TP is the number of items that have been recommended and purchased; FP is the number of items that are recommended but not purchased; and FN is the number of items that have not been recommended but purchased. Figure 5 shows the comparison results of the proposed ReRec algorithm on active users (i.e., the combination of ReRec-ASI and ReRec-AUSI) compared with four baseline methods, traditional User CF, SVD, SVD++ and NMF algorithms. It sets w = 1, and N (U A ) ∈ [5,25]. It can be seen from Figure 5 that, on the purchase prediction of active users, the proposed ReRec algorithm performs better than the traditional User CF, SVD, SVD++ and NMF algorithms in terms of the three evaluation indicators, precision, recall and F-measure. This indicates that the proposed ReRec algorithm for active users in this paper improves the hit rate of item recommendation and ensures the precision of recommendation results.  Figure 6 shows the comparison results of the proposed ReRec approach with the baselines on inactive users (the combination of ReRec-IASI and ReRec-IAUSI). It sets the parameters α and σ as 0.75 and 0.2284, respectively. The total number of recommendation items of N (U B ) is the same as N (U A ) . It can be seen that, in the purchase prediction of inactive users, when N (U B ) ∈ [6,25], the improved Item CF algorithm proposed in this paper is superior to the evaluation indicators of traditional Item CF, SVD, SVD++ and NMF algorithms in terms of precision, recall and F-measure. Because the number of item type in the test data is relatively smaller than the number of users, the purchase prediction performance for inactive users is not as good as that for active users. However, the purchase prediction of inactive users based on the improved Item CF algorithm still improves the hit rate of item recommendation within a certain range, and also ensures a higher precision of recommendation results. The poor performance of the baselines can be explained because all ratings in the user item rating matrix are regarded as equal, ignoring the heterogeneity of users' interests, i.e., user's personalized interest and users' public interest. The SVD method, which is derived from linear algebra, has a solid mathematical foundation in matrix approximation. However, it lacks a user's preference model and an item's preference model of the user's interest in the item. In the SVD++ method, a bias model and the latent vectors of the user and the item are used to model the user's interest in the item. Using stochastic gradient descent to update the bias vector and latent vector of each observed rating in the user item rating matrix can result in a large amount of computation. The advantage of the NFM model is that the elements of latent users and item vectors can be non-negative, while its disadvantage is that the precision of rating prediction is reduced.

Experimental Results
In summary, none of the baselines improve the recommendation algorithms according to different types of user behavior on the temporal horizon. Although some scholars have added the user's personalized behavior into the item recommendation algorithm, they more often than not ignore user loyalty in recommendations that may drive the users' repeat purchase. It holds that the users' loyalty to the shopping platform and items has a non-negligible impact on the successful recommendation of items. Following this line of thought, this research proposes the ReRec algorithm based on user behavior classification and item repurchase cycle. The proposed ReRec algorithm can predict the possibility of repeat purchase in order to recommend the top N items to users and improve the user experience of the recommendation system.

Sensitivity Analysis of Parameter w
In the proposed ReRec approach for active users, incentive factor w is an important parameter. In order to analyze the influence of w on the recommendation process, it conducts sensitivity analysis on the parameter w.     Figure 9 illustrates the evaluating indicators (precision, recall and F-measure) with the total recommended quantity N (U A ) when w ∈ [0, 5]. It can be seen that when N (U A ) increases in the range [0, 5], the variation trend of precision is relatively unstable. In comparison, the recall and F-measure go up firstly and then go down. While N (U A ) increases in the range [5,25], the precisions gradually decrease, while the recall increases. As a result, the F-measures decrease. It is evident that when N (U A ) > 7, the performances of three evaluating indicators at w = 1 are better than that at other values of w. Therefore, the ReRec algorithm should be used with the setting as w = 1.

Discussion of Important Results
The proposed methods are trained in the training set and evaluated in the test set. Three evaluating indicators are used to gauge the algorithm performance as precision, recall and F-measure (Equations (27)-(29)). We conduct our experiments on a real-life community e-commerce platform. Results show that the proposed ReRec method provides better performance compared to the existing methods (namely traditional CF, SVD, SVD++, NMF). The discussion of the important results of the proposed methods is analyzed as follows.
Four types of user-item interactions are obtained before applying ReRec: active users with stable interest (ASI), inactive users with stable interest (IASI), active users with unstable interest (AUSI), and inactive users with unstable interest (IAUSI). For active users, the hit rate of item recommendation shows a marked improvement, while for inactive users, the hit ratio increased slightly. Compared with inactive users, active users use the platform more frequently, so it is easier to detect their buying interest. The reason for the poor performance of the baselines may be that none of the baselines improves the recommendation algorithms according to different types of user behavior on the temporal horizon.
The performance of ReRec is analyzed based on varying the values of incentive factor w. With the value of w increasing in [0,5], the value of F-measure first increases and then decreases. When w > 5, the values of the F-measure are kept stable and low. When w = 1, the ReRec algorithm shows the highest precision. It is evident that when N (U A ) > 7, the performances of three evaluating indicators at w = 1 are better than that at other values of w. Therefore, the ReRec algorithm should be used with the setting as w = 1.
Finally, the practical contribution is summarized. The result of recommendation is stable, which can provide support for business management decision-making in enterprises, and the effectiveness of the algorithm is verified. For instance, precise marketing strategies based on customer heterogeneity can be implemented, thus reducing the operating costs of community e-commerce platforms.

Concluding Remarks
To fill in the research gap from the perspective of repeated purchase behavior and improve the process of the generation of a recommendation list, this research proposed a novel approach called ReRec (Repeat purchase Recommender) to recommending items to users in a divide and conquer manner. The proposed method includes ReRec-ASI, ReRec-AUSI, ReRec-IASI and ReRec-IAUSI. Experiments are conducted on a real dataset collected from a community e-commerce platform. Compared with well-known existing methods (e.g., SVD, SVD++) the ReRec method improves the recommend performance by at least 13.6% (measured by F-measure). Specifically, for active users, with w = 1 and N (U A ) ∈ [5,25], the ReRec-ASI, ReRec-AUSI shows a significant improvement (at least 50%) in recommendation. With α and σ as 0.75 and 0.2284, respectively, the proposed ReRec-IASI and ReRec-IAUSI are also superior to (by at least 13.6%) the evaluation indicators of traditional Item CF when N (U B ) ∈ [6,25].
Although the proposed ReRec approach performs well in this study, there are still some gaps to be explored in the future: Firstly, the size of test set needs to be expanded, because this paper only uses four months of consumption data to test the algorithm at present. The amount of data that can be used now on T-app is limited. In the future, there will be more consumption data available this large-scale data can be used to verify the algorithm.
Secondly, when it has consumption data over a long time, such as consumption data for several years, it would attempt to improve the recommendation algorithms with centralized consumption behaviors such as seasonal consumption and holiday consumption, which is an interesting problem in recommendation.

Conflicts of Interest:
The authors declare no conflict of interest.