Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.
45,349 characters · 24 sections · 27 citation commands
CATS: Clustering-Aggregated and Time Series for Business Customer Purchase Intention Prediction
\email{[email removed]} \orcid{0009-0001-9115-4106}
\email{[email removed]} \orcid{0009-0001-8440-4488}
\email{[email removed]} \orcid{0009-0009-2941-3152}
\email{[email removed]} \orcid{0009-0002-3339-1004}
\email{[email removed]} \orcid{0009-0006-6813-3637}
\email{[email removed]} \orcid{0000-0001-5089-4637}
\authornote{Corresponding authors.} \email{[email removed]} \orcid{0000-0003-4794-9961}
Customer purchase intention prediction is a time-series prediction task based on historical customer behavior data to determine whether a customer will make a purchase in a future period luo2019user. In a realistic model of e-commerce, the groups of customers will tend to be very diverse. As illustrated in \figurename (ref), the distribution of the number of customers corresponding to different activity levels in the past 100 days of an e-commerce enterprise is counted. It contains customer groups with different degrees of activity such as low, medium and high, and generally shows the phenomenon of head-to-tail distribution. Most of the customer population are mainly concentrated in the low and high activity zones, which correspond to occasional customers and loyal customers, respectively. For enterprises, on the one hand, they need to prevent the loss of loyal customers. On the other hand, it is necessary to dig out potential effective customers in the customer base. In the medium and low active customers there may be a low frequency of purchase but the transaction amount is large, and there is a regularity of the purchase pattern of the potential value of the customer. Therefore, the ability of effectively predicting the purchase intention of customers is very important for enterprises to make decision management. However, customers' purchase intentions are subjectively influenced by factors such as interest drive srivastava2023customer, satisfaction artana2022repurchase, and loyalty meyer2008influence, and they are objectively susceptible to external factors such as market activities and seasonal changes. These complexities make accurate modeling of customers a huge challenge.
Based on different processing strategies, existing approaches to customer purchase intention can be broadly summarized as statistical models, machine learning models, and deep learning models. Statistical methods make predictions by analyzing in advance the relationship between the influencing factors and the prediction objectives bringula2018factors, bag2019predicting. However, it is difficult for a single statistical model to achieve the desired prediction accuracy because the complex relationships between variables are often difficult to describe in advance. The machine learning methods can alleviate the overfitting problem that statistical models are prone to saranya2020prediction, esmeli2021towards, khandokar2023gradient. However, the methods cannot achieve positive results when facing data imbalance problems such as the intertemporal and highly sparse data distributions that occur in large-scale datasets. Moreover, it is time-consuming and difficult to capture customer behavioral preferences. Owing to the time effect of customer behavior, methods based on deep learning models have been widely used in recent years liu2021tpgn, huang2021purchase, chaudhuri2021platform, khattak2021applying. Deep learning methods effectively capture the long and short-term preferences of customers and alleviate the data distribution imbalance problem, achieving better customer prediction results.
Although these methods have achieved good results, they focus on the characteristics of the customers themselves or among them and do not take into account the differences between groups of customers. In terms of purchasing behavior, loyal customers usually show strong repeat purchasing behavior, which is usually influenced by the demand for a stable supply of certain products over time. And there are potential groups among the medium and low active people whose buying patterns are characterized by certain regularity. It is a challenge to accurately identify customer groups and the purchasing patterns of different customer segments. Potential connections between customers and differences between customer groups need to be considered in customer modeling. In order to cope with these challenges, this paper proposes a new approach to customer model based on clustering for the phenomenon of head-to-tail distribution of customer groups as well as the regularity, similarity, and other characteristics of customers' purchasing behaviors.
In this paper, we analyze customer behavior, demonstrating the feasibility of clustering customers to improve the prediction accuracy. For the prediction of customers' purchase intentions, we propose a unified Clustering and Attention mechanism GRU model (CAGRU). Specifically, the method first constitutes a time series of the customer's historical purchase records, and the node of each sequence is represented as the corresponding supplier of the order placed by the customer on the same day. Through the company sales records and multi-modal data, a multivariate time series can be constructed between the customers to mine out their similarities. Subsequently, the customers are clustered using the k-shape clustering algorithm, which delineates distinct clusters of customers exhibiting similar characteristics. Then, a strategy combining attention and GRU is used to extract time series features and predict customers' purchase intentions, where the attention mechanism improves the prediction performance by capturing customers' short-term purchase preferences. To evaluate the effectiveness of the proposed model, we constructed four datasets with different customer sizes based on marketing data provided by a poultry company, and extensive experiments and ablation studies were conducted to demonstrate the effectiveness of our proposed approach.
This work makes the following main contributions:
Customer purchase intention prediction is a key issue in marketing and customer relationship management in e-commerce. In recent years, researchers have proposed a variety of methods, such as decision trees, random forest, and gradient boosting trees liu2020machine, yang2021rf, satu2023modeling, which are mainly used to improve the prediction accuracy by capturing complex feature relationships and processing non-linear patterns. However, these models lack the ability to capture temporal features. To further enhance performance, many deep learning methods have been proposed liu2021tpgn, huang2021purchase, ling2019customer, kim2021deep. Recent work huang2021purchase developed a convolutional hierarchical transformer network to enable the modeling of buying patterns with multigranularity temporal dynamics. Different from the above methods, this paper uses clustering methods to capture the preferences of the different customer groups by analyzing the customers' multivariate similarities.
Time series clustering and forecasting play important roles in data analysis. The purpose of time series clustering is to group time series with similar patterns. This mainly includes the distance-based methods petitjean2011global, paparrizos2015k, lloyd1982least, feature-based methods zhou2018clustering, du2018multivariate, liang2017clustering, and deep learning-based methods vaquez2020preliminary, yang2024bidirectional, ienco2020deep. The goal of time series forecasting is to predict future values via historical data, and existing time series forecasting models are mainly based on deep learning models, such as RNNs hochreiter1997long, chung2014empirical, CNNs bai2018empirical, franceschi2019unsupervised, eMLPs ekambaram2023tsmixer, das2023long, Transformers zhang2022crossformer, zhou2021informer, and so on. These models show strong capabilities in feature extraction and processing non-linear relationships. Some works have also combined the above techniques bandara2020forecasting, bhaskaran2020future, zhu2018correlation, and the accuracy and the reliability of time series prediction can be significantly improved through the rational use of clustering information. For example, Bhaskaran et al. bhaskaran2020future proposed an oil pipeline fault identification and prediction method. This work used k-means to cluster the pipeline pressure data, followed by the use of linear regression combined with time series prediction to predict the future failure rate. In this paper, we combine time series clustering and forecasting to predict customers' purchase intentions.
In this section, we analysis the regularity of customer behavior and the similarity between customers based on a real marketing dataset provided by a poultry company. To measure customer behavior information, we define the following key concepts.
Customer Activeness: To quantify the level of customer purchases, we define an indicator metric on the number of recent purchases made by customer $u$ for a company $c$ as follows:
where $d(u, c, i)$ denotes whether customer $u$ visited company $c$ on day $i$, $t$ represents the total time duration, and $p(u, c)$ indicates the engagement level of customer $u$ with company $c$. In addition, we examine the relationship between company engagement and customer count. As illustrated in \figurename (ref), the relationship between engagement and customer count follows a long-tail distribution. Most customers belong to the category of nonactive customers and are considered nontarget customers in business terms. Another segment of customers exhibits moderate to high engagement levels, representing the target audience for businesses. These customers often demonstrate certain regularities and similarities in their attendance behavior.
To further explore these properties, based on the historical purchase information of these customers, we select one of the companies and extract the purchase time series of the customers under the company, as shown below:
where $X_u$ denotes the attendance behavior sequence of customer $u$ over $t$ days, and $d_u^t$ indicates whether customer $u$ visited the company on day $t$, denoted by 0 or 1.
Customer Hamming distance: To measure the similarity between customer sequences, we subsequently extract the attendance sequences of 500 customers within this company and analyze the Hamming distance between these sequences. Given two customer sequences, $x_1$ and $x_2$, the Hamming distance (HD) is defined as follows:
where $X$ denotes the set of all customer attendance sequences, $i$ denotes the position in the sequences, $n$ is the length of the sequences, and $\delta(\cdot)$ is an indicator function that takes a value of 1 when $a \neq b$ and is 0 otherwise. We compute the Hamming distance between all the sequences. As shown in \figurename (ref), we give both a plot of the distribution results of the Hamming distance as well as five of the customers selected for sequence visualization in \figurename (ref).
In the Hamming distance distribution plot, the horizontal and vertical coordinates represent the customers, and the color size represents the variability between two customers. For example, if the value is 50, it means that the variability of the two customers corresponding to the point is quantified as 50. Two conclusions can be drawn from the figures:
To further investigate the similarity among these customers, we employ a clustering approach to uncover resemblances among these groups. Specifically, we conduct k-means clustering on the engagement levels of all the customers, resulting in $n$ clusters. Subsequently, we analyze the Hamming distance of attendance sequences corresponding to customers in different clusters. Here, $n$ is set to 3. As shown in \figurename (ref)- (ref), we visualize the Hamming distance for the three clusters and give the results of sequence visualization for five customers selected from each cluster in Figure (ref)- (ref). As can be seen from the figure, the similarity of the customers is further reflected in the four different groups. Overall, the more consistent the color, the smaller the difference, reflecting a higher degree of similarity between different customers within the group. When viewed in a separate column or row, the variability between customers is also significantly reduced. This is further evidence of the effectiveness of clustering.
To effectively utilize customers' historical interaction data and to meet the business requirements of real-world scenarios, we propose a unified Clustering and Attention mechanism GRU model(CAGRU). As shown in \figurename (ref), the framework consists of two main modules: a cluster module and a customer purchase intention prediction module. First, the clustering module is designed to aggregate similar customers and classify different customer groups, and then the customer purchase intention prediction module is designed to extract the time series characteristics of customer groups and make prediction. The details of the two modules are described below.
In this section, we introduce the clustering module we constructed, as shown in \figurename (ref). The module consists of two components: sequence encoder and k-shape clustering. The details of the two components are described below.
A user information network can be constructed on the basis of the transmission records of customers and companies. Customers generate different behavioral patterns based on different transactional behaviors, and we obtain an embedding of the customer's behavioral patterns by encoding them with a sequence encoder. We use $c_k$ to represent the $k$ shops under the company, and use $d_{u, c_k}^t \in \{0, 1\}$ to represent whether customer $u$ has made a purchase of shop $c_k$ on day $t$. Then, the purchases made by customer $u$ on day $t$ for $k$ shops under the company can be expressed as:
where $N_t(u)$ denotes the customer's purchase interactions for each shop on day $t$ so that we can obtain the set of shop purchase behavior patterns for all customers for a total of $t$ days. Then a sequence encoder function is used to encode the behavioral patterns of the customers, and all the behavioral patterns constituted by the customer are jointly generated into a pattern dictionary $S$, denoted as follows:
where $S_t(u_i)$ represents the encoding mapping value corresponding to the sequence of purchasing behaviors generated by customer $u$ on day $t$. Eventually, we can obtain the sequence of patterns $X_n(u)$ for customer u on day n through the pattern set $S$, denoted as follows:
where $S_n(u)$ represents the buying behavioral pattern of customer $u$ corresponding to day $n$.
With the above encoder, we obtain a time series dataset containing the buying behavior patterns of all customers. Then we use the k-shape paparrizos2015k algorithm to cluster the time series, which is a distance metric based on shape-based distance (SBD) to capture the similarity of sequence shapes. For two sequences $x$ and $y$, their SBD distances are represented as follows:
where $CC_w(x, y)$ denotes the covariance of $x$ and $y$ under weight $w$, $R_0(x, x)$ and $R_0(y, y)$ denote the autocorrelation matrices of $x$ and $y$, respectively. The SBD obtained takes values ranging from 0 to 2, where 0 means that $x$ and $y$ are perfectly similar. Next, we compute the centre of mass according to the SBD algorithm. k-shape is used to find the centre of mass by computing the minimum of the sum of the squared distances between sequences, which will subsequently be divided to the centre of mass with the smallest distance to update the cluster membership. In this way, the clustered labels of the different customer groups are obtained. Based on the labels, we classify customer groups with similar characteristics, which are fed into the customer purchase intention prediction module for training and prediction.
The customer purchase intention prediction module is used to extract the time series features of different customer groups and predict them. As shown in \figurename (ref), the module consists of four layers, including an input layer, an embedding layer, an attentionGRU layer and a prediction layer. The details are expressed as follows.
The customer attributes include personal information, purchasing patterns, and recent transactions. For a customer, we aggregate its transaction sequence characteristics through a user information network, as described below:
where $h_u$ represents the transactional features of the customer, $p_u$ represents the personal attributes of the customer, and $q_u$ represents the attributes of the company, and $\oplus$ represents the aggregation operation. Preprocessing these features, we obtain the inputs $X^{(i)} \in \mathbb{R}^L$ to the model.
User Embedding. Given a customer sequence channel $X^{(i)} \in \mathbb{R}^L$, sequences are obtained as user embedding $X_d^{(i)} \in \mathbb{R}^d$ through a layer of learnable linear projections, and d denotes the input dimension of the GRU.
Positional Embedding. Practical marketing scenarios need to consider the timeliness of the customer's purchase, which day the customer arrives is often strongly associated with the recent trading activities. To this end, we introduce the relative position embedding method, which is calculated as follows:
where $l$ denotes the maximum length of the sequence, $m$ denotes the position index, and $n$ denotes the dimension index. We incorporate temporal weighting into the positional encoding of the sequence, and obtain the final sequence positional embedding $PE^{(i)} \in \mathbb{R}^d$ by multiplying the relative positional embedding of the sequence by a temporal decay factor, denoted as follows:
where $\alpha$ denotes the temporal decay factor. Moreover, we concatenate the user embedding and positional embedding to represent the final sequence embedding $\overline X_d^{(i)} \in \mathbb{R}^d$, represented, denoted as follows:
We aggregate the user embedding and location embedding to obtain the inputs to the GRU. The GRU is a gate recursive unit based approach that employs a GRU to capture the temporal information of temporal data at different dates. The transformed $\overline X_d^{(i)}$ is fed into the GRU for loop iteration to capture temporal features. Specifically, for $x_t \in \mathbb{R}^d$ in $\overline X_d^{(i)}$, after $n$ iterations, the final hidden layer state feature $h_n$ can be obtained, which contains the historical features of the original sequence. We use $Y_w^{(i)} \in \mathbb{R}^w$ to denote the final output of the GRU, where $w$ denotes the output dimension of the GRU. The features of this part are passed to the attention mechanism module, which computes the relevance of the different elements in the input sequence through the attention mechanism and generates context vectors to enhance the model's understanding of the sequence. This module contains the linear transformation layer of the query, key and value. The attention weights are calculated via the $softmax$ function. The value vectors are weighted and summed according to the weights to obtain the context vectors. The output $\overline Y_w^{(i)} \in \mathbb{R}^w$ is obtained by the compression operation, and the computational process is represented as follows:
where $q$, $k$ represent the query and key weight matrices, respectively. Finally, $\overline Y_w^{(i)} \in \mathbb{R}^w$ goes through a linear projection layer and a sigmoid layer to obtain the final output probability $\overline Y^{(i)} \in \mathbb{R}^H$.
Our task is to predict customer purchase intention, which is a binary classification task. Therefore, we choose Binary CrossEntropy(BCE) loss as the loss function for our model, defined as follows:
where $\mathcal{L}_{\text{BCE}}(y, \hat{y})$ denotes BCE loss, $y$ denotes the true label vector, $\hat{y}$ denotes the label vector predicted by the model, and $N$ denotes the number of samples. $y_i$ and $\hat{y}_i$ denote the $i$ elements in the true label vector and the predicted label vector, respectively.
This section initially outlines the experimental setup and performance metrics, followed by a comparison of the results with those of the state-of-the-art time series prediction models. Additionally, we conduct ablation studies to analyze the impact of clustering on the experimental performance. We also investigate the influence of crucial parameters on the CAGRU. All the experiments in this section are implemented in PyTorch and executed on a NVIDIA 1080Ti GPU with 11 GB of memory.
As mentioned above, we conducted a study on a poultry company that mainly provides e-commerce services, and constructed different sizes of marketing datasets for this company according to the number of customer's company interactions, including CUSTOMER_16K, CUSTOMER_20K, CUSTOMER_25K, and CUSTOMER_30K. We divided each dataset into training, validation, and test sets based on the date length at a common ratio of 7:2:1. The validation set is used to tune the model parameters and the test set is used for performance comparison. The properties of the datasets are shown in Table (ref).
Customer purchase intention prediction is essentially a binary classification task, where we predict whether a customer will make a purchase in the coming day. In this section we use common classification metrics to comprehensively measure the performance of our model, including accuracy (Acc), area under the curve (Auc), Precision, Recall, and F1Score. To fairly compare the metrics across the datasets, we take the top-$N$ of the prediction results to calculate the corresponding evaluation metrics. We define $N$ as 0.3 based on the average proportion of positive and negative samples in the dataset, i.e., the top 30% of the probability of willingness to the output is set as 1, and the remaining values are set as 0. For model performance, a higher value of the five metrics represents a better performance.
In this section we describe the baseline methods used for the comparison experiment and analyze for the validity of the CAGRU by comparing it with the existing baselines.
We choose seven well-known forecasting models as our baselines, including PatchTST nie2022time, LSTM hochreiter1997long, Informer zhou2021informer, Transformer vaswani2017attention, Dlinear zeng2023transformers, TimesNet wu2022timesnet, and LSTNet lai2018modeling. In all the methods, we use the same embedding with the size set to 16. In our model, a different number of clustering clusters are used for each dataset for the best result, and the activation functions for the output and prediction layers are GeLU and Sigmoid, respectively. For the rest of the parameter settings, we follow the defaults suggested by the authors.
The prediction results of the proposed CAGRU and other baselines on the four datasets are shown in Table (ref). We give the comparative results for the five categorical metrics, with the best, as well as the next best, scores as shown in bold and with underlined fonts, respectively. As seen from the table, the proposed CAGRU model outperforms all the baseline methods on all five metrics on these four datasets, which proves the validity of the model. Specifically, more significant improvements were achieved on the CUSTOMER_30K dataset compared to the other three datasets. It can be seen that on the CUSTOMER_30K dataset, compared to the next best baseline, the CAGRU method improves the Acc by 5.67%, the Auc by 2.42%, and the F1Score, by 11.28%. This is because compared to the other three datasets, CUSTOMER_30K dataset is richer in customer information and transaction records, and the clustering effect is more accurate. This suggests that the proposed CAGRU can effectively learn the similarity of customers, reduce the noise between sequences through clustering, and incorporate the attention mechanism to effectively learn the contextual information in the sequences, which can easily capture the short-term preferences of customers.
In addition, among all the methods, the LSTM achieves sub-optimal results on all four datasets. Because the nature of our task is short-term sequence prediction, the LSTM can take full advantage of capturing short-term customer preferences by using control gates without losing too much temporal information. Similarly, the proposed CAGRU method can maximize the retention of key information of the sequence through the gate mechanism, which proves that, compared with Transformers, CNNs, and MLPs, RNNs has certain advantages in short sequence prediction. Overall, the LSTNet method, which also incorporates LSTM and CNN, achieved the third best results among all the baselines, which further confirms that the RNN model has a strong advantage on our task.
Furthermore, our comparison of the Transformer model and the Transformer-based models, namely, Informer and PatchTST, shows that Transformer performance is poor on all datasets, indicating that the initial Transformer prediction ability is weak. On the one hand, the Transformer architecture's dot product attention is insensitive to the local context, which may make the model prone to anomalies in the time series. On the other hand, the large size of the CUSTOMER dataset but the sparse nature of the data leads to a severe category imbalance problem, resulting in Transformer's inability to identify key information effectively. Similarly, Informer model underperforms because it focuses more on the long sequence prediction problem, owing to its generative decoder, which can effectively alleviate the context dependency problem of long sequences. However, it loses its advantage for short sequence prediction. Notably, PatchTST performs well on all four datasets because of its strategies of dividing the time series into patches and adopting channel independence, which can significantly reduce the computational complexity and retain key information.
In this section, we explore the effects of the clustering module and the attention mechanism on model performance on each of the four datasets. To this end, we conduct three ablation studies that compare the proposed CAGRU with each of its three simplified variants. The first simplified variant, AGRU, removes the clustering module, which uses an attention mechanism to capture the similarity of customer sequences. The second variant is the CGRU, which removes the attention mechanism module and captures important contextual information by capturing key information about sequence positions. The third variant is the GRU, which retains only the original GRU structure, and captures the contextual dependencies in the sequences through the gate mechanism. The results are shown in \figurename (ref). According to the figure, the proposed CAGRU clearly outperforms the three simplified variants. The GRU is the worst, and the CGRU outperforms the AGRU. Moreover, a comparison of the CGRU and AGRU results reveals that the improvement of CGRU is more higher, which implies that adding a clustering module contributes more to model performance improvement than only considering the attention mechanism. The reason for this is that clustering captures the similarity of customer sequences and reduces the impact of customer plurality. Overall, the clustering module contributes more significantly to the proposed CAGRU method, which mitigates the effect of data sparsity on the model to a certain extent, and reduces the influence of groups with less feature information as well as the interaction information on other customer groups.
In this section, we analyze the effect of the number of clusters $n$ on CAGRU. We keep all other parameters constant and run CAGRU on the four datasets, varying the range of $n$ to $\{2, 3, 4, 5\}$. \figurename (ref) shows the impact of different cluster numbers on the metrics of each dataset. Except for CUSTPOMER_30K, the other three datasets all achieve the best results at $n=2$, which basically matches the phenomenon of the long-tailed distribution of customer behaviors discussed in Section (ref), where most of the customers belong to the long-term loyal customers or the occasional customers with low purchase frequency. The best results were achieved on the largest CUSTOMER_30K on $n=3$, which shows that the clustering effect varies with the size of the customer. Overall, there is a fluctuating effect of different numbers of clusters on the performance of the proposed CAGRU model.
In this paper, we propose a clustering-based time series prediction algorithm for customer purchase intention called CAGRU. Aiming at the phenomenon that customer groups show head-to-tail distribution, we explore the similarities and differences among customers to classify them into different groups via a clustering algorithm. Then, incorporating multi-modal data, we input them into GRU network incorporating the attention mechanism to effectively capture the sequential features of customers' purchasing behaviors, facilitating the prediction accuracy of customer purchase intention. We conducted extensive experiments on four e-commerce datasets to validate the superiority and effectiveness of the proposed CAGRU model. Future research could explore long sequence customer purchase intention prediction. It is also interesting to extend the proposed method to other scenarios, where scenarios involving multivariate time series and multi-modal data can also make use of time series clustering to reduce the instability of the downstream task in capturing the features among the multivariate variables.
\balance