User purchase behavior analysis method and device based on repetitive sequence pattern mining
By using a repetitive sequence pattern mining method, an inverted index table and pattern connection strategy are constructed to discover frequent repetitive patterns in user purchasing behavior. This addresses the shortcomings of traditional analysis methods and enables more accurate user behavior analysis and personalized marketing strategy formulation.
Patent Information
- Application Number
- CN202310987510.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-07
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-08-07
AI Technical Summary
Traditional purchasing behavior analysis methods cannot delve into the inherent patterns and potential dynamics of user purchasing behavior, and therefore cannot provide businesses with precise marketing strategies and personalized product recommendations.
By employing a recurring sequence pattern mining method, and constructing an inverted index table and a pattern connection strategy, we can discover frequent recurring patterns in user purchasing behavior, analyze customer purchasing behavior, and provide strategy support.
It reveals users' purchasing habits, behavioral patterns, and association patterns, helping companies optimize product portfolios, develop personalized marketing strategies, and improve market competitiveness and user satisfaction.
Smart Images

Figure CN116843369B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data mining technology, specifically a method and apparatus for analyzing user purchase behavior based on repeated sequence pattern mining. Background Technology
[0002] In the e-commerce environment, understanding user purchasing behavior is crucial for a company's development and competitiveness. With the rapid development of internet and mobile technologies, more and more consumers are choosing to shop online, generating a vast amount of purchasing data. This data contains valuable information that can reveal user preferences, purchasing habits, and product needs, thereby helping companies develop precise marketing strategies and personalized product recommendations.
[0003] However, traditional purchase behavior analysis methods typically focus only on statistical indicators such as purchase frequency and amount, failing to delve into the underlying patterns and potential dynamics of user purchasing behavior. For example, simply knowing whether a user purchased a product is insufficient to understand their true purchasing preferences and behavioral patterns. Therefore, businesses need a more refined and accurate purchase behavior analysis method to obtain more comprehensive user insights and business intelligence.
[0004] This patent proposes a method for mining recurring sequence patterns, aiming to discover recurring sequence patterns and regularities in user purchasing behavior. User purchase data often contains recurring purchase sequences, i.e., combinations of goods frequently purchased by users at different times or combinations of goods purchased in batches in the same order. These recurring sequences reveal users' purchasing habits, preferences, and behavioral patterns, providing businesses with in-depth user insights and industry trend analysis. The proposed user purchasing behavior analysis method and device based on recurring sequence pattern mining provides more accurate and valuable references for business decision-making. By mining recurring sequence patterns, this method can reveal important characteristics such as user purchasing preferences, purchase cycles, and cross-category purchases, providing guidance for businesses to optimize product layout and develop personalized marketing strategies. Simultaneously, this method can also help businesses discover potential correlation patterns between users, such as collaborative purchasing behavior and user group characteristics, supporting precise recommendation systems and social marketing.
[0005] In conclusion, the user purchase behavior analysis methods and devices based on repeating sequence pattern mining have significant practical implications in e-commerce and marketing. They can not only enhance a company's competitiveness and profitability but also improve the user's shopping experience and satisfaction, achieving a win-win situation for both businesses and users. Summary of the Invention
[0006] This invention addresses the shortcomings of existing analysis methods by providing a user purchase behavior analysis method and apparatus based on repeated sequence pattern mining. It represents purchase behavior as a sequence and analyzes customer purchase behavior by discovering frequent repetition patterns in the sequence data, thereby providing strategic support for enterprises.
[0007] The technical solution of the present invention to solve the above-mentioned technical problems is as follows:
[0008] In a first aspect, the present invention provides a method for analyzing user purchase behavior based on repeated sequence pattern mining, the analysis method comprising the following steps:
[0009] Step 1: Input a database of customer purchase behavior sequences over a period of time, D, and define the minimum support threshold minsup for the merchant.
[0010] Step 2: Scan the database and construct an inverted index table II-List for each item, recording the sales records of each product, including which customer's purchase sequence it appears in and at which timestamp it was purchased; different purchases of different products are called different items, and the item is represented by i. Calculate the support sup(i,D) of each item in turn. If sup(i,D)≥minsup, then the item is recorded as a frequent repetition pattern with adaptive gaps in a 1-itemset of length 1. Frequent repetition patterns with adaptive gaps are represented by NFP, and the length of NFP is represented by j.
[0011] Step 3: Using the internal pattern connection strategy of itemsets, recursively connect frequently repeated patterns of length j with adaptive gaps to generate candidate patterns of length j+1 until no new candidate patterns can be generated; calculate the pattern support sup(p,D) of each candidate pattern in turn and compare it with minsup. If sup(p,D)≥minsup, then the candidate pattern is a one-itemset NFP of length j+1. Obtain all one-itemset NFPs of different lengths, which represent the combinations of goods that customers frequently purchase at the same time. Let the size of one-itemset NFPs be r.
[0012] The process of the itemset internal schema join strategy is as follows: if two given schemas have the same prefix, the last item of the second schema is directly appended to the last item of the first schema to achieve itemset internal schema join; otherwise, internal schema join cannot be performed.
[0013] Step 4: Using the external pattern join strategy, recursively join pairs of NFPs of size r itemsets to generate candidate patterns of size r+1 itemsets until no new candidate patterns can be generated.
[0014] The pattern support sup(p,D) of the candidate patterns is calculated sequentially and compared with minsup to obtain the NFPs of all itemset sizes, which are the combinations of items that customers frequently purchase, including simultaneous purchases and non-simultaneous purchases.
[0015] The process of the itemset external schema joining strategy is as follows: given two schemas containing multiple itemsets, if the last m-1 itemsets of the first schema containing multiple itemsets are the same as the first m-1 itemsets of the second schema containing multiple itemsets, then the m-th itemset of the second schema containing multiple itemsets is appended to the end of the first schema containing multiple itemsets to achieve itemset external schema joining; otherwise, external schema joining cannot be performed.
[0016] Step 3 includes the following sub-steps:
[0017] Step 3.1: The 1-itemset NFPs of length 1 generated in Step 2 are combined pairwise using the itemset internal pattern join strategy to generate candidate patterns. The size of the generated candidate patterns remains unchanged, but the length is increased by 1.
[0018] Step 3.2: Calculate the pattern support sup(p,D) of the candidate patterns generated in step 3.1. If sup(p,D)≥minsup, then the candidate pattern is a 1-itemset NFP of length 2. Store the candidate pattern and its corresponding occurrence position in the frequent repetition pattern dictionary. In the frequent repetition pattern dictionary, the key corresponds to the NFP and the value corresponds to the occurrence position of the pattern.
[0019] The process of calculating the support of a 1-itemset pattern is as follows: obtain the array of the occurrence positions of the items contained in the candidate pattern in the inverted index table, take the intersection of the occurrence position arrays of all items, and the resulting set is the occurrence position of the candidate pattern. The number of elements contained in the set is the pattern support sup(p,D).
[0020] Step 3.3: For 1-itemset NFPs of length 2, use the internal pattern join strategy of the itemset to combine them pairwise to generate new candidate patterns. Repeat step 3.2 to obtain 1-itemset NFPs of length 3. Perform the next loop recursion until no new candidate patterns can be generated according to the internal pattern join strategy of the itemset. Obtain 1-itemset NFPs of all lengths. The size of 1-itemset NFPs is represented by r.
[0021] Obtain all 1-item set NFPs and store them along with their occurrence positions in a dictionary of frequent recurring patterns.
[0022] Step 4 includes the following sub-steps:
[0023] Step 4.1: Combine the 1-itemset NFPs generated in Step 3 in pairs using the itemset external pattern join strategy to generate candidate patterns of size 2 itemsets. The size of the candidate patterns generated using the itemset external pattern join strategy is increased by 1.
[0024] Step 4.2: Calculate the pattern support of the candidate patterns of size 2 itemset generated in step 4.1. If sup(p,D)≥minsup, then the candidate pattern is a NFP of size 2 itemset. Store the candidate pattern and its corresponding occurrence position in the frequent repetition pattern dictionary.
[0025] The process of calculating the support of a multiset pattern is as follows: obtain the prefix pattern and the occurrence position array of the last itemset of the candidate pattern from the dictionary of frequent repeated patterns, perform a matching operation on the two occurrence position arrays, if the occurrence position of the last itemset is greater than the occurrence position of the prefix pattern, it is counted as a successful match once, and this position is one occurrence position of the candidate pattern. After traversing all occurrence positions, obtain the occurrence position of the candidate pattern and the pattern support sup(p,D).
[0026] Step 4.3: Using the itemset external pattern join strategy, join the NFPs of size 2 itemsets obtained in Step 4.2 to generate candidate patterns of size 3 itemsets. Then iterate through Steps 4.2-4.3 until no new candidate patterns are generated.
[0027] Obtain NFPs of different itemset sizes. All NFPs are stored in a dictionary of frequent repetition patterns, which represent some purchase behaviors that users frequently perform. Merchants formulate marketing plans based on these patterns.
[0028] Secondly, this invention also protects a user purchase behavior analysis device based on repeating sequence pattern mining, used to automatically implement the aforementioned user purchase behavior analysis method based on repeating sequence pattern mining. The device includes a data acquisition module, a single-itemset repeating sequence pattern mining module, a multi-itemset repeating sequence pattern mining module, and a mining result analysis and evaluation module. By integrating these components, a comprehensive analysis and evaluation of user purchase behavior can be achieved.
[0029] The data acquisition module is used to collect data from e-commerce websites in real time, converting user purchase behavior into items and itemsets to form a purchase behavior sequence, which is then transmitted in real time. Simultaneously, data preprocessing is performed: for products already existing in the inverted index table, their positions in the new sequence are updated; for products not yet existing, they are added and their positions are updated.
[0030] The 1-itemset repeating sequence pattern mining module is used to discover all 1-itemset patterns that satisfy the minimum threshold given by the user, i.e., combinations of products that the customer will purchase multiple times at the same time. Taking the inverted index table and the minimum threshold given by the user as input, the module filters products that have been purchased more than the minimum threshold given by the user, generates candidate patterns using the internal pattern connection strategy of the itemset, calculates their support, and filters product combinations with support higher than the threshold. All the product combinations obtained are the products that the customer will purchase multiple times at the same time.
[0031] The multiset repeating sequence pattern mining module is used to discover all multiset patterns that satisfy the minimum threshold given by the user, i.e., the product combinations that customers frequently purchase in batches. The output of the 1-itemset repeating sequence pattern mining module and the minimum threshold given by the user are used as inputs. The external pattern connection strategy of the itemset is used to generate candidate patterns, calculate their pattern support, and filter the product combinations with pattern support higher than the minimum threshold given by the user. The obtained product combinations are the products that customers will frequently purchase in batches.
[0032] The results analysis and evaluation module is used to provide marketing strategies for merchants. It displays product combinations selected by the single-item repeating sequence pattern mining module and the multi-item repeating sequence pattern mining module to merchants and analyzes the results. The results of the single-item repeating sequence pattern mining module indicate that customers have purchased these products multiple times at the same time, and suggests placing these products in adjacent positions. The results of the multi-item repeating sequence pattern mining module indicate product combinations that customers have purchased in multiple batches, and promotes subsequent products to customers who have already purchased earlier products.
[0033] In this invention, step 3 aims to obtain a pattern containing only one itemset, and step 4 obtains a pattern containing multiple itemsets based on the pattern obtained in step 3. In this invention, the length is the number of items in the pattern, and the size is the number of itemsets in the pattern. For example, the pattern [ac][c] has a length of 3 and a size of 2, making it a 2-itemset pattern.
[0034] This invention, based on repeating sequence pattern mining technology, analyzes repeating sequences in user purchase data to deeply uncover patterns and potential dynamics in user purchasing behavior. Compared to traditional purchase behavior analysis methods, this invention offers the following advantages and benefits:
[0035] 1. The method provided by this invention not only considers whether a product has been purchased, but also calculates the actual number of times the product has been purchased, thereby providing a more comprehensive and accurate analysis of user purchasing behavior, revealing users' purchasing habits, behavioral patterns and association patterns, and providing valuable reference and guidance for enterprise decision-making.
[0036] 2. This invention uses an inverted index table to reduce multiple scans of the original purchase sequence, and utilizes the internal and external pattern connection strategies of itemsets to reduce the search space and accelerate the speed of the repeating sequence pattern mining algorithm.
[0037] 3. This invention proposes corresponding pattern support calculation strategies for candidate patterns of 1-itemsets and multi-itemsets, respectively, which quickly calculate the support while ensuring the accuracy of the calculation results, thereby improving computational efficiency.
[0038] 4. The device provided by this invention can automatically perform purchasing behavior analysis, reducing the workload and error rate of manual processing, improving the efficiency and accuracy of analysis, providing enterprises with personalized marketing strategies, and enhancing the market competitiveness and user satisfaction of products.
[0039] In summary, the user purchase behavior analysis method and apparatus based on repeated sequence pattern mining provided by this invention has broad application prospects and significant practical and economic benefits in the fields of e-commerce and marketing. Attached Figure Description
[0040] Figure 1 A flowchart illustrating the user purchase behavior analysis method based on repeated sequence pattern mining provided in this embodiment of the invention;
[0041] Figure 2 Example diagram for calculating the support of a single item set pattern;
[0042] Figure 3 This is an example diagram for calculating support for a multiset pattern. Detailed Implementation
[0043] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] First, we introduce the relevant definitions in repeating sequence pattern mining and two candidate pattern generation strategies:
[0045] Definition 1: Let I = {i1, i2, ..., i t Let} be a set of items in the database, where i represents a user's purchase behavior, i.e., an item; the itemset v is a subset of i, representing the set of purchase behaviors of the user at the same time; the sequence s = s1s2…s n It consists of n itemsets, representing user purchase behavior over a period of time. The purchase behavior sequence database D contains several purchase sequences, denoted as D = {s1, s2, ..., s...}.d}, where d is the number of purchase sequences in the purchase behavior sequence database.
[0046] Definition 2: A purchasing behavior pattern with adaptive gaps can be represented as p = p1 * p2 * ... * p m Or p = p1p2…p m , where p k (1≤k≤m) is a subset of I (that is, an itemset v), and * denotes any number of itemsets.
[0047] Definition 3: Given a purchase sequence s = s1s2…s n and pattern p = p1p2…p m ,l= <l1,l2,…,l m > indicates the occurrence of pattern p in sequence s if and only if (1≤l1<l2<…<l k ≤n). Assume there exists another occurrence l' = <l1',l2',…,l m '>, when any 1≤q≤k, l q ≠l q When l and l' are not overlapping, they are said to occur without overlap.
[0048] Definition 4: The support of pattern p in purchase sequence s is the maximum number of non-overlapping occurrences, denoted as sup(p,s). The support of pattern p in the purchase behavior sequence database D is the sum of the support in each purchase sequence, denoted as
[0049] Definition 5: In a purchase behavior sequence database D, if the support of a pattern is not lower than the minimum support threshold minsup given by the user, i.e. sup(p,D)≥minsup, then p is called a frequently repeated pattern with adaptive gap (NFP).
[0050] Strategy 1: (Itemset Internal Schema Join Strategy) Given two schemas p1 = [i1i2…i...] containing only one itemset each. m- 1i m ] and p2 = [i1'i2'...i m-1 'i m '], if [i1i2…i m-1 i m ] = [i1'i2'…i m-1 'i m '], then two patterns can be joined to generate a new pattern. That is, if the two patterns have the same prefix, the last item of the second pattern p2 is directly appended to the last item of the first pattern p1 to achieve internal pattern connection of the itemset; otherwise, internal pattern connection cannot be performed.
[0051] Strategy 2: (Itemset External Schema Join Strategy) Given two schemas p1 = p1p2 ... p1p1 containing multiple itemsets. m-1 p m and p2 = p1'p2'...p m-1 'p m ', if p2…p m-1 p m =p1'p2'…p m-1 'Then two patterns can be joined to generate a new pattern.' That is, if the last m-1 itemsets of the first pattern containing multiple itemsets are the same as the first m-1 itemsets of the second pattern containing multiple itemsets, then the m-th itemset of the second pattern containing multiple itemsets is appended to the end of the first pattern containing multiple itemsets to achieve external pattern connection of itemsets; otherwise, external pattern connection cannot be performed.
[0052] The following is combined Figure 1 The specific algorithm process in this invention is described below:
[0053] like Figure 1 This illustrates a user purchase behavior analysis method based on repeated sequence pattern mining, applied to the analysis of repeated sequence patterns in user purchase behavior.
[0054] Step 1: Input a database of user purchase behavior sequences over a period of time, and define the minimum support threshold minsup for the merchant.
[0055] The purpose of this invention is to discover frequent recurring patterns in all given purchase behavior sequence databases, taking a multi-sequence sequence database and a custom minimum support threshold as input.
[0056] Step 2: Scan the database and construct an inverted index table (II-List) for each user's purchase behavior. This table records the sales history of each product, including which customer's purchase sequence it appeared in and at what timestamp it was purchased. Different purchases of different products are called different items, denoted by i. Calculate the support sup(i,D) for each item. If sup(i,D)≥minsup, then the item is marked as a frequent recurring pattern, indicating that the product has high sales volume. The length of the frequent recurring pattern is j, where j=1.
[0057] Specifically, a dictionary structure (Key-Value) is created to store the inverted index table. The Key records the items contained in the database, and the corresponding Value is a two-dimensional array recording the position of the item stored in the Key. Each sequence is scanned sequentially. When an item not recorded in the Keys is encountered, a new item is added, and its position is recorded in the corresponding Value. When an item already stored in the Keys is encountered, its position is simply added to the corresponding Value. After one scan, the purchase time record for each product is obtained, i.e., the inverted index table for each item.
[0058] Then, calculate the number of elements in the Value array corresponding to each item in turn, i.e. the support sup(i,D), and determine whether sup(i,D)≥minsup. Record all items that satisfy this condition to obtain a 1-itemset NFPs (frequent repetition patterns with adaptive gaps). For a 1-itemset NFPs of length j=1; i represents an item.
[0059] Step 3: Using an itemset internal pattern joining strategy, recursively iterate through the 1-itemset NFPs, pairwise joining frequent repetition patterns with adaptive gaps of length j to generate candidate patterns of length j+1, until no new candidate patterns can be generated. Pattern support sup(p,D) of candidate patterns of different lengths is calculated sequentially using pattern matching techniques and compared with minsup to obtain all frequent repetition patterns with adaptive gaps for 1-itemsets, i.e., combinations of goods that customers frequently purchase at the same time.
[0060] Specifically, step 3 includes the following sub-steps:
[0061] Step 3.1: Combine the 1-itemset NFPs of length 1 generated in Step 2 pairwise using the itemset internal pattern join strategy to generate candidate patterns. Since the itemsets are internally ordered, this step only requires appending the higher-ranked item to the lower-ranked item. The size of the generated candidate patterns remains unchanged, but the length is increased by 1. Initially, j = 1.
[0062] Step 3.2: Calculate the pattern support sup(p,D) of the candidate patterns generated in step 3.1. If sup(p,D)≥minsup, then the candidate pattern is a 1-itemset NFP of length 2. Store the pattern and its corresponding occurrence position in the frequent repetition pattern dictionary. The key corresponds to the NFP and the value corresponds to the occurrence position of the pattern.
[0063] The process of calculating the support of a 1-itemset pattern is as follows: obtain the array of the occurrence positions of the items contained in the candidate pattern from the inverted index table, take the intersection of the occurrence position arrays of all items, and the resulting set is the occurrence position of the candidate pattern. The number of elements contained in the set is the pattern support sup(p,D).
[0064] Step 3.3: For the 1-itemset NFPs of length 2, use the internal pattern join strategy of the itemset to combine them pairwise to generate new candidate patterns. Repeat step 3.2 to obtain the 1-itemset NFPs of length 3. Perform the next loop recursion until no new candidate patterns can be generated according to the internal pattern join strategy of the itemset. Obtain the 1-itemset NFPs of all lengths. The size of the 1-itemset NFPs is represented by r.
[0065] Obtain all 1-itemset NFPs and store them, along with their occurrence positions, in a dictionary of frequent recurring patterns for use in subsequent steps.
[0066] Step 4: Using the external pattern join strategy, recursively join NFPs of size r itemsets pairwise to generate candidate patterns of size r+1 itemsets until no new candidate patterns can be generated. Then, using pattern matching techniques, calculate the pattern support sup(p,D) of each candidate pattern and compare it with minsup to obtain the NFPs for all itemsets, representing frequently purchased product combinations, including both simultaneous and non-simultaneous purchases.
[0067] Specifically, step 4 includes the following sub-steps:
[0068] Step 4.1: Combine the 1-itemset NFPs generated in Step 3 pairwise using the itemset external schema join strategy to generate candidate patterns of size 2 itemsets. Since there is no order between itemsets, any two 1-itemset NFPs can be joined sequentially, and the size of the candidate patterns generated using the itemset external schema join strategy is increased by 1.
[0069] Step 4.2: Calculate the pattern support of the candidate patterns of size 2 itemsets generated in Step 4.1. If sup(p,D)≥minsup, then the candidate pattern is a NFP of size 2 itemsets. Store the candidate pattern and its corresponding occurrence position in the frequent repetition pattern dictionary. The key corresponds to the NFP and the value corresponds to the occurrence position of the pattern.
[0070] The process of calculating the support of a multiset pattern is as follows: obtain the prefix pattern and the occurrence position array of the last itemset of the candidate pattern from the dictionary of frequent repeated patterns. Perform a matching operation on the two occurrence position arrays. If the occurrence position of the last itemset is greater than the occurrence position of the prefix pattern, it can be recorded as a successful match once. This position is one occurrence position of the candidate pattern. After traversing all occurrence positions, the occurrence position of the candidate pattern and the pattern support sup(p,D) can be obtained.
[0071] Step 4.3: Using the itemset external pattern join strategy, join the NFPs of size 2 itemsets obtained in Step 4.2 to generate candidate patterns of size 3 itemsets. Then iterate through Steps 4.2-4.3 until no new candidate patterns are generated.
[0072] Through the above steps, all NFPs of different itemset sizes are stored in a frequent repetition pattern dictionary. These patterns represent some purchase behaviors that users frequently perform. Merchants can formulate reasonable marketing plans based on these patterns to enhance their market competitiveness.
[0073] In this application, NFPs plus 's' indicates multiple NFPs.
[0074] Preferred embodiment
[0075] Example of the purchase behavior sequence database in this preferred embodiment is shown in Table 1:
[0076] Table 1: Sample Database of Purchase Behavior Sequences
[0077] Sequence ID sequence [s1] [acd][abce][ce][cef][ce] <![CDATA[s2]]> [bd][af][ace][de][acd] <![CDATA[s3]]> [ac][bc][e][f]
[0078] First, according to step 1, input the customer purchase behavior sequence database for a certain period of time as shown in Table 1. This database contains 3 sequences. Taking s3 as an example, this sequence indicates that user 3 first purchases both category a and category c products simultaneously, then purchases both category b and category c products, next purchases category e products, and finally purchases category f products. The merchant defines a minimum support threshold minsup = 5, indicating that it is necessary to discover products and product combinations that the user has purchased more than 5 times.
[0079] Based on step 2, the database is scanned, and an inverted index table II-List for each item is constructed as shown in Table 2:
[0080] Table 2: Inverted Index Table II - List
[0081] Item i Inverted index (occurrence position) a [[1,2],[2,3,5],[1]] b [[2],[1],[2]] c [[1,2,3,4,5],[3,5],[1,2]] d [[1],[1,4,5],[]] e [[2,3,4,5],[3,4],[3]] f [[4],[2],[4]]
[0082] Table 2 shows the purchase time and quantity records of each product. Taking 'd' as an example, [[1],[1,4,5],[]] indicates that user 1 selected product d in the first purchase; user 2 selected product d in the first, fourth and fifth purchases; user 3 did not purchase product d. Product d was purchased a total of 4 times.
[0083] According to the inverted index table, product category a was purchased 6 times; product category b was purchased 3 times; product category c was purchased 9 times; product category d was purchased 4 times; product category e was purchased 7 times; and product category f was purchased 3 times. By comparing with minsup, we can find that [a], [c], and [e] are 1-itemset NFPs of length 1.
[0084] According to step 3.1, the 1-itemset NFPs of length 1 generated in the above steps are first joined in pairs using the itemset internal pattern joining strategy, generating three candidate patterns [ac], [ae], and [ce].
[0085] According to step 3.2, the support of the three candidate patterns is calculated sequentially. Taking pattern [ac] as an example, ... Figure 2 As shown, taking the intersection of the inverted indexes [[1,2],[2,3,5],[1]] corresponding to 'a' and [[1,2,3,4,5],[3,5],[1,2]] corresponding to 'c', we get [[1,2],[3,5],[1], indicating that user 1 purchased both category a and category c items in both the first and second purchases; user 2 purchased both category a and category c items in both the third and fifth purchases; and user 3 purchased both category a and category c items in the first purchase. Therefore, sup([ac],D)=5≥minsup, and this pattern belongs to a 2-length 1-itemset NFP. Similarly, we can obtain all 2-length 1-itemset NFPs as [ac] and [ce], indicating that users are more inclined to purchase both category a and category c items and category c and category e items simultaneously.
[0086] According to step 3.3, the NFPs of length 2 obtained above need to be joined with internal patterns of the itemsets. Since the first item of [ac] is a and the first item of [ce] is c, and a≠c, no new candidate patterns can be obtained in this step. Step 3 ends and the obtained 1-itemset NFPs are: [a], [c], [e], [ac] and [ce].
[0087] According to step 4.1, all 1-itemset NFPs need to be paired together using the itemset external schema join strategy to generate 2-itemset candidate schemas: [a][a], [a][c], [a][e], [a][ac], [a][ce], [c][a], [c][c], [c][e], [c][ac], [c][ce], [e][a], [e][c], [e][e], [e][ac], [e][ce], [ac][a], [ac][c], [ac][e], [ac][ac], [ac][ce], [ce][a], [ce][c], [ce][e], [ce][ac] and [ce][ce].
[0088] The external pattern connection strategy for item sets determines whether the remaining item sets of one pattern in the two patterns of 1-item set NFPs (excluding the first item set) are identical to the remaining item sets of the other pattern (excluding the last item set). If they are all the same, the two patterns are considered spliceable, and the size of the spliced pattern is increased by 1.
[0089] According to step 4.2, the support of candidate patterns is calculated in sequence. Taking [a][a] as an example, the occurrence positions [[1,2],[2,3,5],[1]] of the prefix pattern [a] are matched with the occurrence positions [[1,2],[2,3,5],[1]] of the last item set [a]. As Figure 3 shown in the figure, taking s2 as an example, the first-layer nodes 2, 3, and 5 represent the occurrence positions of the prefix pattern [a], and the second-layer nodes 2, 3, and 5 represent the occurrence positions of the last item set [a]. The first node of the first layer is 2, and the first node greater than 2 in the second layer is 3. Therefore, <2,3> is the first occurrence of the pattern [a][a], and the occurrence position is recorded as 3; Continue to see that the second node of the first layer is 3, and the unused node greater than 3 in the second layer is 5. Therefore, <3,5> is the second occurrence of the pattern [a][a], and the occurrence position is recorded as 5; The last node of the first layer is 5, but there is no node larger than 5 in the second layer, so there is no new occurrence. In summary, the occurrence position of the pattern [a][a] on the sequence s2 is [3,5]. Using the same calculation method, the occurrence positions of [a][a] can be obtained as [[2],[3,5],[]], which means that user 1 repurchased category a goods in the 2nd purchase; User 2 repurchased category a goods in both the 3rd and 5th purchases; User 3 has no repurchases. Therefore, sup([a][a],D)=3<minsup, and this pattern does not belong to NFP. Similarly, by calculating the pattern support of all candidate patterns, all 2-item set NFPs can be obtained as [a][c], [a][e], [c][c], and [c][e], which indicates that users are more inclined to purchase category c or e goods after purchasing category a goods, and more inclined to purchase category c or e goods after purchasing category c goods.
[0090] According to step 4.3, the two itemset NFPs obtained above need to be processed using an itemset external pattern joining strategy. Taking pattern [a][c] as an example, this pattern can be joined with pattern [c][c] to generate [a][c][c], and with pattern [c][e] to generate [a][c][e]. Similarly, the candidate patterns obtained in this step are: [a][c][c], [a][c][e], [c][c][c], and [c][c][e]. Step 4.2 is iterated, and the pattern support of each candidate pattern is calculated sequentially. Since the pattern support of the candidate patterns is less than minsup, no new NFPs are generated, and the mining of repeating sequence patterns ends. The mining results of this embodiment are shown in Table 3, which only contain 1-itemset NFPs and 2-itemset NFPs.
[0091] Table 3: Mining Results
[0092] NFP Location of occurrence Support [a] [[1,2],[2,3,5],[1]] 6 [c] [[1,2,3,4,5],[3,5],[1,2]] 9 [e] [[2,3,4,5],[3,4],[3]] 7 [ac] [[1,2],[3,5],[1]] 5 [ce] [[2,3,4,5],[3],[]] 5 [a][c] [[2,3],[3,5],[2]] 5 [a][e] [[2,3],[3,4],[3]] 5 [c][c] [[2,3,4,5],[5],[2]] 6 [c][e] [[2,3,4,5],[4],[3]] 6
[0093] Table 3 shows the results of repeated sequence pattern mining. The generated NFPs are products or product combinations that users frequently purchase. The occurrence position of the pattern indicates different users' purchasing habits, and the support represents the number of non-overlapping occurrences of the pattern in the given database, indicating the total number of purchases of that product (combination) by all users on this shopping website. Based on the above information, merchants can develop personalized marketing strategies to improve product market competitiveness and user satisfaction.
[0094] The above description is not intended to limit the present invention, nor is the present invention limited to the examples given above. Any changes, modifications, additions, or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.
[0095] Any aspects not covered in this invention are applicable to existing technologies.
Claims
1. A method for analyzing user purchase behavior based on repeated sequence pattern mining, characterized in that, The analytical method includes the following steps: Step 1: Input customer purchase behavior sequence database over a period of time. D Merchants define minimum support threshold minsup ; Step 2: Scan the database and construct an inverted index table (II-List) for each item, recording the sales history of each product, including which customer's purchase sequence it appeared in and at what timestamp it was purchased; different purchases of different products are called different items, and items are represented by... i This means that the support for each item is calculated sequentially. sup ( i , D ),if sup ( i , D )≥ minsup Then, this item is denoted as a frequent repetition pattern with adaptive gaps in a 1-itemset of length 1. Frequent repetition patterns with adaptive gaps are represented by NFPs, and the length of an NFP is denoted by ______. j represents ; Step 3: Recursively loop through the itemset internal schema connection strategy. j Generate pairwise connections of frequently repeating patterns of length with adaptive gaps j+ 1. Select candidate patterns of length 1 until no new candidate patterns can be generated; calculate the pattern support of each candidate pattern in turn. sup (p, D ), and with minsup Compare, if sup (p, D )≥ minsup Then the candidate pattern is j+ Given a 1-itemset NFP of length 1, obtain all 1-itemset NFPs of different lengths, representing combinations of items that customers frequently purchase at the same time. Let the size of the 1-itemset NFPs be denoted as . r ; The process of the itemset internal schema join strategy is as follows: if two given schemas have the same prefix, the last item of the second schema is directly appended to the last item of the first schema to achieve itemset internal schema join; otherwise, internal schema join cannot be performed. Step 4: Recursively loop through the itemset external schema join strategy. r NFP pairwise connection generation for itemset size r+ Candidate patterns of item set size are generated until no new candidate patterns can be generated; Calculate the pattern support of candidate patterns sequentially. sup (p, D ), and with minsup Compare them to obtain the NFPs of all itemsets, which are the combinations of items that customers frequently purchase, including those purchased simultaneously and those not purchased simultaneously. The process of the itemset external schema join strategy is as follows: Given two schemas containing multiple itemsets, if the first schema containing multiple itemsets has a subsequent... m -1 itemset and the second pattern containing multiple itemsets m If -1 itemsets are identical, then the second pattern containing multiple itemsets will have its first itemets... m Each item set is appended to the end of the first schema that contains multiple item sets to enable the external schema join of the item sets; otherwise, the external schema join cannot be performed. Step 4 includes the following sub-steps: Step 4.1: Combine the 1-itemset NFPs generated in Step 3 in pairs using the itemset external pattern join strategy to generate candidate patterns of size 2 itemsets. The size of the candidate patterns generated using the itemset external pattern join strategy is increased by 1. Step 4.2, calculate the pattern support of the candidate patterns of size 2 itemsets generated in Step 4.1, if... sup (p, D )≥ minsup If the candidate pattern is 2 itemset size NFP, then the candidate pattern and its corresponding occurrence position are stored in the frequent repetition pattern dictionary; The process of calculating the support of a multiset pattern is as follows: Obtain the prefix pattern and the occurrence positions of the last itemset of the candidate pattern from the frequent repetition pattern dictionary. Perform a matching operation on the two occurrence position arrays. If the occurrence position of the last itemset is greater than the occurrence position of the prefix pattern, it is counted as a successful match, and this position is considered one occurrence position of the candidate pattern. After traversing all occurrence positions, obtain the occurrence positions of the candidate patterns and the pattern support. sup (p, D ); Step 4.3: Using the itemset external pattern join strategy, join the NFPs of size 2 itemsets obtained in Step 4.2 to generate candidate patterns of size 3 itemsets. Then iterate through Steps 4.2-4.3 until no new candidate patterns are generated. Obtain NFPs of different itemset sizes. All NFPs are stored in a dictionary of frequent repetition patterns, which represent some purchase behaviors that users frequently perform. Merchants formulate marketing plans based on these patterns.
2. The user purchase behavior analysis method according to claim 1, characterized in that, Step 3 includes the following sub-steps: Step 3.1: The 1-itemset NFPs of length 1 generated in Step 2 are combined pairwise using the itemset internal pattern join strategy to generate candidate patterns. The size of the generated candidate patterns remains unchanged, but the length is increased by 1. Step 3.2: Calculate the pattern support of the candidate patterns generated in Step 3.
1. sup (p, D ),if sup (p, D )≥ minsup If the candidate pattern is a 1-itemset NFP of length 2, store the candidate pattern and its corresponding occurrence position in the frequent repetition pattern dictionary. In the frequent repetition pattern dictionary, the key corresponds to the NFP and the value corresponds to the occurrence position of the pattern. The process of calculating the support of an itemset pattern is as follows: Obtain the array of the occurrence positions of items in the candidate pattern from the inverted index table; take the intersection of all the occurrence position arrays; the resulting set represents the occurrence positions of the candidate pattern, and the number of elements in the set is the pattern support. sup (p, D ); Step 3.3: For 1-itemset NFPs of length 2, combine them pairwise using the itemset internal pattern join strategy to generate new candidate patterns. Repeat step 3.2 to obtain 1-itemset NFPs of length 3, and perform the next recursive iteration until no new candidate patterns can be generated according to the itemset internal pattern join strategy. This process yields 1-itemset NFPs of all lengths. The size of the 1-itemset NFPs is determined by... r express; Obtain all 1-item set NFPs and store them along with their occurrence positions in a dictionary of frequent recurring patterns.
3. A user purchase behavior analysis device based on repeated sequence pattern mining, used to automatically implement the user purchase behavior analysis method based on repeated sequence pattern mining as described in claim 1 or 2.
4. The apparatus according to claim 3, characterized in that, The device includes: The system includes a data acquisition module, a single-item set repeating sequence pattern mining module, a multi-item set repeating sequence pattern mining module, and a mining result analysis and evaluation module. The data acquisition module is used to collect data from e-commerce websites in real time, converting user purchase behavior into items and itemsets to form a purchase behavior sequence, which is then transmitted in real time. Simultaneously, data preprocessing is performed: for products already existing in the inverted index table, their positions in the new sequence are updated; for products not yet existing, they are added and their positions are updated. The 1-itemset repeating sequence pattern mining module is used to discover all 1-itemset patterns that satisfy the minimum threshold given by the user, i.e., combinations of products that the customer will purchase multiple times at the same time. Taking the inverted index table and the minimum threshold given by the user as input, the module filters products that have been purchased more than the minimum threshold given by the user, generates candidate patterns using the internal pattern connection strategy of the itemset, calculates their support, and filters product combinations with support higher than the threshold. All the product combinations obtained are the products that the customer will purchase multiple times at the same time. The multiset repeating sequence pattern mining module is used to discover all multiset patterns that satisfy the minimum threshold given by the user, i.e., the product combinations that customers frequently purchase in batches. The output of the 1-itemset repeating sequence pattern mining module and the minimum threshold given by the user are used as inputs. The external pattern connection strategy of the itemset is used to generate candidate patterns, calculate their pattern support, and filter the product combinations with pattern support higher than the minimum threshold given by the user. The obtained product combinations are the products that customers will frequently purchase in batches. The mining results analysis and evaluation module is used to provide marketing strategies for merchants. It displays the product combinations selected by the single-item repeating sequence pattern mining module and the multi-item repeating sequence pattern mining module to merchants and analyzes the results. The results of the single-item repeating sequence pattern mining module indicate that customers have purchased these products multiple times at the same time, and gives the suggestion of "placing these products in adjacent positions". The results of the multi-item repeating sequence pattern mining module indicate the product combinations that customers have purchased in batches multiple times. For some customers who have already purchased the preceding products, the module promotes the subsequent products.
