A Data Analysis Method Based on Repeated Negative Sequence Patterns
By using an adaptive non-overlapping repeated negative sequence pattern mining method, the occurrence frequency of patterns is calculated using a bitmap, generating frequent positive sequence patterns and generating negative sequence candidates. This solves the problem of difficulty in obtaining repeated negative sequence patterns in transaction mining and enables customer purchase behavior analysis and personalized recommendations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies cannot effectively mine repeating negative sequence patterns in transaction mining, especially when there are strict constraints in the transaction sequence, making it impossible to obtain more valuable information and unable to be applied to transaction sequences whose elements contain itemsets.
An adaptive non-overlapping repeating negative sequence pattern mining method is adopted. The pattern occurrence information is stored in a bitmap, and the number of occurrences of the pattern is calculated by the operation between the bitmaps. Frequent positive sequence patterns are generated and negative sequence candidates are generated from them. The repetition of negative sequences in different and the same customer purchase sequences is considered.
It can quickly obtain repeating negative sequence patterns from the database, which can be applied to customer purchase behavior analysis to provide personalized recommendations and improve product sales and user experience.
Smart Images

Figure CN117112555B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data mining technology and relates to a data analysis method based on repeating negative sequence patterns. Background Technology
[0002] Sequence pattern mining aims to discover frequent subsequences with support levels at least equal to a user-specified threshold from a sequence database. This focus on sequence patterns that occur (positive) events is called a Positive Sequential Pattern (PSP). In contrast, focus on sequence patterns that do not occur (negative) events is called a Negative Sequential Pattern (NSP). NSP mining uncovers more valuable information than PSP mining and plays an irreplaceable role in many applications, such as disease prediction, health and medical care, manipulation of transactions, and debt detection. A key characteristic of sequence patterns is that they may appear multiple times within a sequence. For example, negative sequences... This sequence represents a customer experiencing a car collision and not having their car repaired at a repair shop recommended by the insurance company. Here, x represents the collision caused by the customer, y represents the insurance company's damage assessment, z represents the repair being done at the insurance company's recommended repair shop, and w represents the insurance company paying compensation. This sequence reflects a normal situation because insurance companies allow customers to have their cars repaired at non-recommended repair shops. However, negative sequences... The reported situation may be abnormal because... The recurrence of the same customer could be a sign of car insurance fraud. Therefore, considering this characteristic, the Repetitive Negative Sequential Pattern (RNSP) mining method has been proposed, with two types: gap-constrained and adaptive gap. Gap constraints require the user to specify the gap value between two consecutive positive elements in the pattern. Adaptive gaps, on the other hand, determine the gap value adaptively based on the sequence, eliminating the need for users to precisely set gap constraints using prior knowledge, thus yielding more valuable information. However, research on RNSP mining is limited and conducted under strict constraints, failing to help decision-makers obtain more valuable information. One-off negative sequence pattern mining targets biological sequences where elements contain only a single item. Typically, a DNA sequence consists of A, C, G, and T, representing four nucleotides—adenine, cytosine, guanine, and thymine, respectively. It does not consider the generality of the mining object, meaning it cannot be applied to transaction sequences where elements also contain itemsets. Typically, a customer, preparing for a friend's party, first buys a cake stand and gift bags, then playing cards, and finally desserts. A purchase sequence <(ab)cd> is formed according to the order of purchases, where items a, b, c, and d represent four items: a cake stand, a gift bag, playing cards, and desserts, respectively. Elements (ab), c, and d correspond to the customer's three purchases. Although "e-rnsp: An efficient method for mining repetition negative sequence patterns" is transaction-sequence oriented, its occurrence constraints are very strict, resulting in the loss of many valuable patterns. Summary of the Invention
[0003] This invention proposes a data analysis method based on repeating negative sequence patterns to address the problems existing in current transaction mining. Transaction data refers to a data set composed of multiple sequences, where each sequence contains elements arranged in chronological order; the elements are a set of events or items. Each sequence represents a specific transaction or process, which can be a time series, a user behavior sequence, a transaction sequence, etc.
[0004] To achieve the above objectives, the present invention is implemented using the following technical solution:
[0005] Note: Transaction data refers to a data collection consisting of multiple sequences, where each sequence contains elements arranged in chronological order. The elements are a collection of events or items; each sequence represents a specific transaction or process, which can be a time series, a user behavior sequence, a transaction sequence, etc.
[0006] A data analysis method based on repeating negative sequence patterns, comprising the following steps:
[0007] (1) Define the relevant parameters
[0008] A. Define a positive sequence <a1a2...a m >In positive sequence <b1b2...b n One appearance in > <l1,l2,...,l m >, where m≤n, and positive integers 1≤l1<l2<...<l m ≤n makes the element
[0009] B. Define the sequence pattern p = adaptive gap constraint <e1*e2*...e n >, where * represents any number of wildcards, and a single wildcard can match any element in the sequence; <e1e2...e n A simple representation of the adaptive sequence pattern p; if any element e k If the element is positive, then p is a positive sequence pattern; if there exists an element e... k If all elements are negative and no two or more negative elements are allowed to be adjacent, then p is a negative sequence pattern, 1≤k≤n;
[0010] C. For the positive sequence pattern p = <e1e2...e n If the two occurrences of the k-th element in any sequence satisfy... If 1 ≤ k ≤ n, then correspondingly, p has two occurrences in any sequence. and No overlap;
[0011] D. Set a support threshold to filter frequent patterns, requiring that the support sup(p) of pattern p is not less than the specified minimum support min_sup, i.e. sup(p)≥min_sup;
[0012] (2) Traverse the sequence database DB
[0013] The items in the sequence database DB are represented by letters and arranged in alphabetical order. A bitmap is constructed for each item, recording its position in each database sequence. If an item appears in a database sequence... <e1e2...e n The k-th (1≤k≤n) element e k If the item is included, the k-th position in the bitmap corresponding to the database sequence is 1; otherwise, the position is 0.
[0014] (3) Generate positive sequence candidates through depth-first expansion of itemset and sequence expansion: For each frequent positive sequence pattern with n elements (n-size), set an itemset expansion set I and a sequence expansion set S. The itemset expansion set I consists of frequent items that can be added to the last element, and the sequence expansion set S consists of frequent items that can be appended to the last element; for frequent positive sequence patterns... <e1e2...e n >, the itemset expansion is in the last element e n Add a frequent item i from the itemset extension set I to obtain the extended element (e n i), thereby generating sequence candidates <e1e2...(e n i)>;Sequence expansion at the last element e n Then, a frequent term i from the sequence extension set S is added to generate a sequence candidate. <e1e2...e n i>;
[0015] (4) For positive sequence patterns <e1e2...e n Using bitmaps <e1e2...e n >. The bitmap records the position of the pattern in each database sequence, and the number of 1s in the bitmap is recorded as the support of the positive sequence pattern; in the itemset expansion process of step (3), the bitmap (e n i) Bitmap record candidate <e1e2...(e n i)> The information about the last element is used for the next itemset expansion, by... <e1e2...e n >Bitmap of the last element and added items, e n Performing a bitwise AND operation on .bitmap and i.bitmap yields: (e n i).bitmap=e n .bitmap&i.bitmap; <e1e2...(e n bitmap of i)> <e1e2...(e n The `bitmap` constructor is as follows: (Setting...) <e1e2...e n The index of the first 1 value in the bitmap is k; the function clear(index) is defined to set the bit at index k to 0, and the function set(index) is defined to set the bit at index k to 1; a bitmap nb is generated, where... nb.clear(d) and implement <e1e2...(e n i)>.bitmap.set(q), where q is nb&(e ni). The index of the first 1 value in the bitmap; simultaneously execute (e n i) Perform a bitmap.clear(q) operation to satisfy the no-overlap condition; repeat the operation to process... <e1e2...e n Other bits in the bitmap that are 1; during the sequence expansion process in step (3), <e1e2...e n bitmap of i> <e1e2...e n The `i>.bitmap` constructor is as follows: (Setting...) <e1e2...e n The index of the first 1 value in the bitmap is k; a bitmap nb is generated, where... nb.clear(d) and Then, execute <e1e2...e n The code `i>.bitmap.set(q)` is executed, where `q` is the index of the first 1 value in `nb&i.bitmap`. The `i.bitmap.clear(q)` operation is then performed to satisfy the no-overlap condition. This process is repeated to handle the remaining bits. <e1e2...e n Other bits in the bitmap that are 1;
[0016] (5) Statistical analysis of candidate occurrence positions of positive sequences in step (4) Figure 1 The number of values; if the number is not less than min_sup, then the candidate is a frequent positive sequence pattern.
[0017] (6) Focus only on the negative sequence candidate ns that correspond frequently to the positive sequence, where negative sequence candidate ns = <e1e2...e n The corresponding positive sequence for > is p(ns) = <p(e1)p(e2)...p(e n )>, Represents negative elements The corresponding positive element is e; for n-size frequent positive sequence patterns, change k (∈[1,n / 2]) non-contiguous elements to generate negative sequence candidates;
[0018] (7) Calculate the support of negative sequence candidate ns;
[0019] If ns contains only one element, the support of ns is calculated using the following formula:
[0020] Where s j This represents the j-th sequence in the database DB;
[0021] If the number of elements in ns is greater than 1, first obtain a database sequence containing ns using the following formula:
[0022] Where n is the number of negative elements in ns, MPS(ns) represents the maximum positive subsequence of ns, which is an ordered list of all positive elements in ns; 1-negMS ns 1-negMS represents a 1-negative maximum subsequence, which is a subsequence consisting of MPS(ns) and a negative element; v Let be the 1-negative maximum subsequence consisting of MPS(ns) and the v-th negative element, where 1 ≤ v ≤ n; then calculate the support of ns using the following formula;
[0023] Where RtpTimes(MPS(ns),s j ) represents the largest positive subsequence in the database sequence s. j The number of times it appears in;
[0024] (8) If the support of negative sequence candidate ns satisfies sup(ns)≥min_sup, then the candidate is a frequent negative sequence pattern. It not only considers the repeated occurrence of negative sequence patterns in different database sequences, but also considers the repeated occurrence in a certain database sequence. The transaction behavior is analyzed by the obtained frequent negative sequence pattern, and the next behavior is predicted based on the transaction behavior, so as to provide personalized recommendation display for the platform.
[0025] Preferably, the negative sequence candidate support calculation process is as follows: A hash table is used to store information about frequent positive sequence patterns; the key of the hash table is the sequence identifier containing the frequent positive sequence pattern in the database, and the value of the hash table is the number of repetitions of the frequent positive sequence pattern in the corresponding database sequence; a bitmap seqBitmap with a bit count of |DB| is created for each frequent positive sequence pattern to record its position in the database DB; a set of database sequences containing ns is quickly obtained by performing bitwise operations on the bitmap seqBitmap corresponding to the largest positive subsequence and the positive subsequence of 1-the largest negative subsequence; first, all database sequences not containing ns are obtained, and a bitwise OR operation is performed on the bitmap seqBitmap corresponding to the positive subsequence of 1-the largest negative subsequence; then, a bitmap reflecting the position information of ns in the DB is obtained, and a bitwise XOR operation is performed on the bitmap seqBitmap of the largest positive subsequence and the bitmap obtained by the OR operation; finally, the bitmap of ns is used to quickly index the hash table to obtain the number of repetitions of ns in each database sequence, and these are summed to obtain the support of ns.
[0026] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0027] This invention enables rapid extraction of repeating negative sequence patterns from databases for data analysis, applicable to tasks such as customer purchase behavior analysis. First, it proposes an adaptive non-overlapping repeating positive sequence pattern mining method. This method uses bitmaps to store pattern occurrence information and calculates the frequency (support) of patterns through operations between bitmaps. The non-overlapping requirement states that each element cannot be reused in the same position, a more lenient condition than existing methods, resulting in more valuable PSPs. Second, it proposes an adaptive non-overlapping repeating negative sequence pattern mining method. This method generates sequence candidates based on PSPs and calculates support through bitmaps of the corresponding PSPs. Under the adaptive non-overlapping condition, more valuable NSPs can be obtained. Taking customer purchase behavior analysis on shopping websites or apps as an example, this invention not only focuses on the recurrence of a purchase sequence pattern in different customer purchase sequences but also considers its recurrence in a single customer's purchase sequence. By using these patterns to analyze customer purchase behavior, shopping platforms can understand which product combinations are frequently purchased based on past sales data. This allows them to increase sales by providing different strategies for recommending and selling related products in the platform's push notification module. Attached Figure Description
[0028] Figure 1 This is the overall framework for SN-RNSP.
[0029] Figure 2 This is a bitmap representation of the database in Table 1.
[0030] Figure 3 Generate on <(abd)(bd)c(cd)> <bc>The S-step.
[0031] Figure 4 Generate on <(abd)(bd)c(cd)><b(cd)> The I-step.
[0032] Figure 5 For about Bit operations. Detailed Implementation
[0033] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described below with reference to specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0034] Numerous specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways than those described herein, and therefore the invention is not limited to the specific embodiments disclosed in the following specification.
[0035] Example 1
[0036] To obtain non-overlapping and adaptive gap-constrained Repetitive-Negative Sequential Patterns (RNSPs) in a short running time within a transaction sequence, an efficient two-stage mining algorithm, SN-RNSP (Self-adaptive and Nonoverlapping Repetitive-Negative Sequential Pattern), is proposed. Figure 1 As shown, it mainly includes two tasks: mining repeating positive sequence patterns and mining repeating negative sequence patterns.
[0037] First, the relevant definitions are introduced as follows:
[0038] If there exist positive integers 1 ≤ l1 < l2 < ... < l m ≤n and m≤n, such that the element Then such a sequence of positive integers <l1,l2,...,l m >is a positive sequence <a1a2...a m >In positive sequence <b1b2...b n One appearance in >.
[0039] The positive sequence pattern p of adaptive gap constraint is denoted as <e1*e2*...e m >, where * represents any number of wildcards, and a single wildcard can match any element in the sequence. This example uses p= <e1e2...e m > to concisely represent the adaptive gap pattern.
[0040] For pattern p = <e1e2...e m Two occurrences in a sequence and if Therefore, they are non-overlapping.
[0041] The negative sequence pattern p is a sequence <e1e2...e m >, among which e k Elements can be positive or negative; two or more negative elements are not allowed to be adjacent.
[0042] The technical solution is detailed below:
[0043] Table 1 shows a transaction sequence database consisting of three customer purchase sequences. Each purchase sequence is assigned a unique identifier sid; each purchased item is an item, uniquely identified by a letter, such as sequence s1 containing four items a, b, c, and d; all items purchased by the customers at a specific time constitute an element, with items within the element arranged lexicographically, such as s1 containing four elements (abd), (bd), c, and (cd). A support threshold is set to filter frequent patterns, requiring that the support sup(p) of pattern p should not be less than the specified minimum support min_sup.
[0044] Table 1 Purchase of Sequence Database
[0045]
[0046] Iterate through the purchase sequence database to obtain all items (products) and sort them lexicographically. For each item, construct a bitmap recording its position in each sequence, such as... Figure 2 As shown. First, obtain the maximum value Smax of the purchased sequence in the database; then, allocate an equal size (Smax bits) to the bitmap corresponding to each sequence; finally, if an item is positively sequenced... <e1e2...e n The k-th (1≤k≤n) element e k If it is included, then the item corresponds to the k-th position 1 in the bitmap of the sequence; otherwise, the position is 0.
[0047] By using itemset expansion and sequence expansion depth-first to generate candidate repeating positive sequences, all possible combinations of product sales are explored. First, to reduce the search space size, for each frequent positive sequence pattern containing n elements (n-size),... <e1e2...e n Set an itemset extension set I and a sequence extension set S, consisting of frequent items that can be added to the last element and frequent items that can be appended to the last element, respectively. Given a frequent positive sequence pattern... <e1e2...e n Itemset expansion adds a frequent item from i to the last element of the sequence; for example, itemset expansion adds the frequent item i to e. n In this way, candidate sequences are generated. <e1e2...(e n i)>. Sequence expansion adds a frequent term from S after the last element of the sequence; for example, sequence expansion adds the frequent term i to e. n Then, sequence candidates are generated. <e1e2...e n i>.
[0048] A bitmap is used to record the position of the pattern in each sequence; the number of 1s in the bitmap represents the pattern's support. Consider the simple case of only one sequence. Given a pattern p = ... <e1e2…e n > and items i and their bitmap representations p.bitmap and i.bitmap. Use & to represent the AND operation, set(index) means setting the bit at the specified index to 1, and clear(index) means setting the bit at the specified index to 0.
[0049] In the itemset expansion procedure (I-step), e is executed first. n .bitmap&i.bitmap, the resulting bitmap temp .bitmap records candidate p temp = <e1e2…(e n i)> Information on where the last element will appear will be used as the le.bitmap for the next itemset expansion. Next, p temp The bitmap representation of p temp The .bitmap constructor is as follows. First, it generates a bitmap nb, where... nb.clear(d) and Then, execute p temp .bitmap.set(q), where q is an integer. temp The index of the first 1 value in the bitmap. Also, to satisfy the no-overlap condition, execute le temp The `.bitmap.clear(q)` operation is then performed. Next, the above steps are repeated to process the other bits in `p.bitmap` that are 1.
[0050] In the sequence expansion process (S-step), firstly, le temp .bitmap is equal to i.bitmap. Next, p temp = <e1e2...e n The bitmap representation of i> p temp The .bitmap constructor is as follows. First, it generates a bitmap nb, where... nb.clear(d) and Then, execute p temp The function `.bitmap.set(q)` is called, where `q` is the index of the first 1 value in `nb&i.bitmap`. Simultaneously, to satisfy the no-overlap condition, the `i.bitmap.clear(q)` operation is executed. Next, the above steps are repeated to process the other bits in `p.bitmap` that are 1.
[0051] The number of 1 values in the bitmap of the candidate positive sequence is counted (support). If the support is not less than min_sup, the candidate is a frequent positive sequence pattern, which reflects the combination of products that are frequently purchased in sequence, and provides the underlying basis for product recommendation and sales.
[0052] To avoid generating meaningless negative sequence candidates, we only focus on frequently purchased items and their combinations, i.e., negative elements. Corresponding positive element and negative sequence ns = <e1e2...e n The corresponding positive sequence p(ns) of > <p(e1)p(e2)...p(e n The support must be no less than min_sup. The negative sequence candidate generation process is as follows: For n-size frequent positive sequence patterns, change... Use non-contiguous elements to generate negative sequence candidates.
[0053] A hash table `sidHash` is used to store information about positive sequence patterns. The storage structure of the relevant data is shown in Table 2. The key is the sequence identifier `sid` containing the corresponding positive sequence pattern, and the value is the number of times the positive sequence pattern appears in the corresponding sequence. A bitmap `seqBitmap` with a bit count of |DB| is created for each frequent repeating sequence pattern, which records the position of the pattern in the database `DB`. If `ns` contains only one element, the support of `ns` is calculated using Formula 3. If `ns` contains more than one element, the support is calculated by combining the set of sequences containing the largest positive subsequence (an ordered list of all positive elements in `ns`, denoted as `MPS(ns)`) and the 1-negative largest subsequence (a subsequence containing `MPS(ns)` and a negative element, denoted as `1-negMS`). ns The set of sequences containing the positive sequence is subtracted to obtain the set of sequences {ns} containing ns (corresponding to Formula 1). Then, the number of times MPS(ns) is repeated in each sequence of {ns} is accumulated to obtain the support (corresponding to Formula 2).
[0054] Formula 1:
[0055] Formula 2:
[0056] Formula 3:
[0057] like Figure 3 As shown, firstly, an OR operation is performed on the bitmap seqBitmap corresponding to the positive sequence of the largest negative subsequence to obtain a sequence set that does not contain ns. Then, an XOR operation is performed on the bitmap seqBitmap of the largest positive subsequence and the bitmap obtained by the OR operation to obtain a sequence set that contains ns. Finally, the bitmap obtained by the XOR operation is used to quickly index the number of times ns repeats in each sequence in sidHash and accumulate them.
[0058] Table 2 storage structure
[0059]
[0060] Determine if the support of each negative sequence candidate is not less than min_sup. If sup(ns) ≥ min_sup, then the candidate is a frequent negative sequence pattern. Analyze customer purchasing behavior using the obtained negative sequence patterns, and predict the products customers may need next based on their current purchasing behavior, thereby improving personalized recommendation capabilities and product sales.
[0061] Example 2
[0062] (1) Taking the customer purchase sequence database shown in Table 1 as an example, set the minimum support min_sup = 2. Traverse the sequence database and obtain a total of 4 items, namely a, b, c, and d. First, in the sequence database DB, sequence s1 has a maximum element value Smax = 4; then, allocate 4 bits to the bitmap corresponding to each sequence. For example Figure 2 As shown, taking item b as an example: because item b appears in the first and second elements of sequence s1, this item corresponds to the first and second positions of 1 in the bitmap of this sequence, and the remaining positions are 0, i.e., 1100. Similarly, construct the corresponding bitmaps for the remaining items.
[0063] (2) The support level of each item can be obtained based on the number of 1s in the bitmap. For example... Figure 2 As shown, the support for items a, b, c, and d are 3, 6, 5, and 5, respectively, with the most frequent items being a, b, c, and d.
[0064] (3) Generate candidate repeating positive sequences through itemset expansion and sequence expansion, and calculate the support of each candidate. The specific steps are as follows: First, generate frequent positive sequence patterns from a, b, c, and d. 、 、 <c>and <d> Their S is all initially set to {a,b,c,d}, because each frequent item can potentially be appended to the end of their sequence. I are {b,c,d}, {c,d}, {d}, and {}, with support of 3, 6, 5, and 5 respectively. Next, we will use the pattern...< / d> < / c> Taking depth-first downward search as an example, the pattern Candidates are generated through sequence expansion. <aa> 、 <ab> 、 <ac>and <ad>The support scores were 0, 2, 3, and 2, respectively, with the most frequent positive sequence patterns being... <ab> 、 <ac>and <ad>The corresponding S values are {b,c,d}, {b,c,d}, and {b,c,d}, respectively, and the I values are {c,d}, {d}, and {}, respectively. Pattern <ab>Candidates are generated through sequence expansion. <abb> 、 <abc>and <abd>The support scores were 0, 1, and 2, respectively, with the most frequent positive sequence patterns being... <abd>The corresponding S is {d}, and I is {}. Pattern <abd>Candidates are generated through sequence expansion. <abdd>Support is 0, infrequent. Pattern <ab>Candidates are generated through itemset expansion.<a(bc)> and<a(bd)> The support scores are 1 and 2 respectively, with the frequent positive sequence pattern being...<a(bd)> The corresponding S is {d}, and I is {}. Pattern<a(bd)> Candidates are generated through sequence expansion.<a(bd)d> The support is 2, it is frequent, and the corresponding S is {d}, I is {}. Pattern<a(bd)d> Candidates are generated through sequence expansion.<a(bd)dd> Support is 0, infrequent. Pattern <ac>Candidates are generated through sequence expansion. <acb> 、 <acc>and <acd>The support scores were 0, 1, and 2, respectively, with the most frequent positive sequence patterns being... <acd>The corresponding S is {d}, and I is {}. Pattern <acd>Candidates are generated through sequence expansion. <acdd>Support is 0, infrequent. Pattern <ac>Candidates are generated through itemset expansion.<a(cd)> The support is 2, it is frequent, and the corresponding S is {d}, I is {}. Pattern<a(cd)> Candidates are generated through sequence expansion.<a(cd)d> Support is 1, infrequent. Pattern <ad>Candidates are generated through sequence expansion. <adb> 、 <adc>and <add>The support scores were 0, 1, and 2, respectively, with the most frequent positive sequence patterns being... <add>The corresponding S is {d}, and I is {}. Pattern <add>Candidates are generated through sequence expansion. <addd> Support is 0, infrequent. Pattern< / addd> < / add> < / add> < / add> < / adc> < / adb> < / ad> < / ac> < / acdd> < / acd> < / acd> < / acd> < / acc> < / acb> < / ac> < / ab> < / abdd> < / abd> < / abd> < / abd> < / abc> < / abb> < / ab> < / ad> < / ac> < / ab> < / ad> < / ac> < / ab> < / aa> Candidates <(ab)>, <(ac)>, and <(ad)> are generated through itemset expansion, with support of 3, 1, and 1 respectively. The frequent positive sequence pattern is <(ab)>, with corresponding S values of {b,c,d} and I values of {}. Candidates <(ab)b>, <(ab)c>, and <(ab)d> are generated through sequence expansion, with support of 2, 3, and 2 respectively. The frequent positive sequence patterns are <(ab)b>, <(ab)c>, and <(ab)d>, with corresponding S values of {b,c,d}, {b,c,d}, and {b,c,d}, and I values of {c,d}, {d}, and {} respectively. Candidates <(ab)b>, <(ab)bc>, and <(ab)bd> are generated through sequence expansion, with support of 0, 1, and 2 respectively. The frequent positive sequence pattern is <(ab)bd>, with corresponding S values of {d} and I values of {}. The pattern <(ab)bd> generates candidate <(ab)bdd> through sequence expansion, with a support of 0, indicating infrequent occurrence. The pattern <(ab)b> generates candidates <(ab)(bc)> and <(ab)(bd)> through itemset expansion, with supports of 1 and 2 respectively. The frequent positive sequence pattern is <(ab)(bd)>, with corresponding S = {d} and I = {}. The pattern <(ab)(bd)> generates candidate <(ab)(bd)d> through sequence expansion, with a support of 2, indicating frequent occurrence. The corresponding S = {d} and I = {}. The pattern <(ab)(bd)d> generates candidate <(ab)(bd)dd> through sequence expansion, with a support of 0, indicating infrequent occurrence. The pattern <(ab)c> generates candidates <(ab)cb>, <(ab)cc>, and <(ab)cd> through sequence expansion, with supports of 0, 1, and 2 respectively. The frequent positive sequence pattern is <(ab)cd>, with corresponding S = {d} and I = {}. The pattern <(ab)cd> generates the candidate <(ab)cdd> through sequence expansion, with a support of 0, indicating infrequent occurrence. The pattern <(ab)c> generates the candidate <(ab)(cd)> through itemset expansion, with a support of 2, indicating frequent occurrence. The corresponding S is {d}, and I is {}. The pattern <(ab)(cd)> generates the candidate <(ab)(cd)d> through sequence expansion, with a support of 1, indicating infrequent occurrence. The pattern <(ab)d> generates the candidates <(ab)db>, <(ab)dc>, and <(ab)dd> through sequence expansion, with supports of 0, 1, and 2 respectively. The frequent positive sequence pattern is <(ab)dd>, with a corresponding S of {d} and I of {}. The pattern <(ab)dd> generates the candidate <(ab)ddd> through sequence expansion, with a support of 0, indicating infrequent occurrence. Thus, all sequence patterns searched starting from 'a' have been found. Similarly, the sequence patterns searched starting from 'b', 'c', and 'd' are shown in Table 3 below.
[0065] Table 3 shows the sequence patterns searched starting from a, b, c, and d, respectively.
[0066]
[0067] The specific method for calculating bitmap support is as follows. Figure 3 This demonstrates the generation on s1 <bc>The S-step process. In s1, and <c>The bitmap representations are 1100 (corresponding to { <1> , <2>}) and 0011 (corresponding to { <3> , <4>}).for The first 1 value in the bitmap is first generated as bitmap 0111, representing all possible occurrences of the item. Then, 0111 & 0011 = 0011 is executed, indicating that there are two occurrences of 'c' after the current 'b', but only the first one is selected as the support, corresponding to <1,3>. For the second 1 value in the bitmap, bitmap 0011 is first generated. Then, 0011 & 0001 is executed, resulting in bitmap 0001, because the first 1 value in 0011 has already been used by the first 1 value in 1100. The first 1 value is selected as the support, corresponding to <2,4>. Therefore, <bc>The bitmap representation in s1 is 0011. Figure 4 This demonstrates the generation on s1<b(cd)> The I-step process. All occurrences of c in s1 are 0011 (corresponding to { <3> , <4> The bitmap representation of d in s1 is 1101 (corresponding to { <1> , <2> , <4> Therefore, first executing 0011&1101 results in the bitmap representation of <(cd)> being 0001. For <bc>The first 1 value in bitmap 0011 is first generated, representing all possible occurrences of the extended element. Then, 0011 & 0001 = 0001 is executed, indicating that there is an occurrence of (cd) after the current 'b', corresponding to <1,4>. For the second 1 value in the bitmap, bitmap 0001 is first generated. Then, 0001 & 0000 is executed to obtain bitmap 0000, because the first 1 value in 0001 has already been used by the first 1 value in 0011. Therefore,<b(cd)> The bitmap representation in s1 is 0001 (corresponding to {<1,4>}).
[0068] (4) Focus only on the negative sequence ns that corresponds frequently to the positive sequence, i.e., sup(p(ns))≥2. In other words, generate repeating negative sequence candidates from the repeating positive sequence pattern. To avoid generating meaningless negative sequence candidates, the negative sequence candidate generation process is as follows: For the n-size positive sequence pattern, change... Use non-contiguous elements to generate negative sequence candidates, in positive sequence mode. <abd>For example, when k=1, candidate generation... and When k=2, candidates are generated. In this example, negative sequence candidates can be generated as shown in Table 4 below.
[0069] Table 4 Negative Sequence Candidates
[0070]
[0071] (5) Calculate the support of negative sequence candidates to determine their frequency. For 1-size negative sequence candidates, their support is calculated using Formula 3. (The last sentence appears to be incomplete and possibly refers to a separate step.) For example, the database contains its corresponding positive sequence pattern. The sequence set is {s1, s2, s3}, therefore its support is |DB| - |{s1, s2, s3}| = 3 - 3 = 0. For n-size (n>1) negative sequence candidates, first obtain a set of sequences containing ns; then, obtain the number of times ns repeats in each sequence and sum them to obtain the support. For example, firstly, ns has two 1-negative maximum subsequences. and And its largest positive subsequence is .Include Corresponding positive sequence <ab>The sequence set is {s1, s3}, containing Corresponding positive sequence <bd>The sequence set is also {s1, s3}, containing The sequence set is {s1, s2, s3}. Therefore, it contains... The set of sequences is {s1, s2, s3} - {s1, s3} ∪ {s1, s3} = {s2}. The support level is in s2 The number of times it appears. In the database DB, It appears twice in s2, namely <1> and <2> Therefore, the support of ns is 2.
[0072] (6) To facilitate the calculation of negative candidate support, a hash table `sidHash` is used to store information about positive sequence patterns. The key is the sequence identifier `sid` containing the corresponding positive sequence pattern, and the value is the number of times the positive sequence pattern appears in the corresponding sequence. A bitmap `seqBitmap` of size |DB| is created for each frequently repeating positive sequence pattern, recording the position of the repeating positive sequence pattern in DB. For example, positive sequence pattern... The data storage structure is shown in Table 2. < / bd> < / ab> Figure 5 As shown, with Taking support calculation as an example, this section explains how to use the above data structure to calculate support. First, ns has two 1-negative maximum subsequences. and And its largest positive subsequence is .because It is contained in the sequences s1 = <(abd)(bd)c(cd)> and s3 = <(ab)(bcd)d>, so its bitmap seqBitmap is 101. It is also contained in s1 and s3, so its bitmap seqBitmap is 101. Included in s1, s2 =<b(abc)c> In s3, its bitmap seqBitmap is 111. Next, an OR operation is performed on 101 and 101. Then, an XOR operation is performed on the results 101 and 111. The final result 010 indicates that ns is contained in s2 because the second bit is 1. Therefore, it can be directly derived from s2. Find the number of times ns appears in s2 in sidHash. In the database DB, It is contained in sequences s1, s2, and s3, and appears twice in s1, namely... <1> and <2> It appears twice in s2, namely... <1> and <2> It appears twice in s3, namely... <1> and <2> .therefore, The sidHash is {1:2,2:2,3:2}, from which we can obtain the number of occurrences of ns as 2.
[0073] (7) The pattern of frequently repeated negative sequences is as follows: The support rates were 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3 and 2, respectively.
[0074] Transaction sequence patterns mined from customer purchase databases reflect customers' likely purchasing behavior over a period of time after purchasing or not purchasing certain items. For example, positive sequence patterns. <abd>This reflects that products a, b, and c are often purchased in sequence; negative sequence pattern. This reflects that if a customer hasn't purchased product a before buying product b, they are unlikely to consider purchasing product d later. Based on this analysis, stores can predict what products customers might need next by analyzing current customer purchasing behavior, enabling personalized recommendations, providing a better user experience, increasing sales, and assisting users in decision-making. Specifically, personalized product recommendation systems on e-commerce platforms can utilize negative sequence patterns to identify user purchasing behavior. For example, a pattern can be obtained through negative sequence pattern mining. When a customer buys a gaming laptop and then subsequently purchases a mechanical keyboard, it reflects their high pursuit of a superior digital product experience. Therefore, they should be recommended a low-latency, high-performance mouse, or even a programmable-button gaming mouse, rather than a compact, low-performance business wireless mouse. A more personalized and satisfying purchase recommendation experience can then be provided through methods such as sending recommendation emails, text messages, or displaying relevant promotional advertisements on the website.
[0075] A vast amount of sequence data exists in real life, such as biological sequences like DNA sequences and transaction sequences like customer purchase sequences. However, existing methods for transaction sequences are subject to strict constraints and fail to extract more useful information. To address this issue, a two-stage adaptive gap-free non-overlapping repeating negative sequence pattern mining method is proposed. First, a bitmap structure is used to represent the database and maintain pattern candidates, eliminating the need for repeated database scans to calculate pattern support. Second, a bitmap-based repeating positive sequence pattern mining method is proposed, which can obtain gap-adaptive and more non-overlapping repeating positive sequence patterns in the transaction database with a shorter runtime. Finally, based on the repeating positive sequence patterns, set theory and bitmap indexing are used to quickly mine repeating negative sequence patterns. This method can obtain gap-adaptive and more non-overlapping repeating negative sequence patterns in the transaction database with a shorter runtime. Taking customer purchase behavior analysis as an example, by not only focusing on the recurrence of a certain purchase sequence pattern in different customer purchase sequences, but also considering the recurrence in a certain customer purchase sequence, comprehensive information can be obtained to predict the products that customers may need next based on their current purchase behavior. This provides a better user experience, saves time and effort, increases sales and conversion rates, enhances user loyalty, and supports users' decision-making and discovery of new things.
[0076] "Onp-miner: One-offnegative sequence pattern mining" aims to mine repetitive negative sequence patterns in item sequences, such as gene sequences, which are long and contain few items. However, it cannot solve the task of mining repetitive negative sequence patterns in itemset sequences, such as transaction sequences, and lacks generality. This method generates positive sequence candidates through itemset expansion and sequence expansion, selects frequent positive sequence patterns, and generates negative sequence candidates from them. It can simultaneously address both item sequence and itemset sequence mining tasks and has generality.
[0077] "e-RNSP: An efficient method for forming repetition-negative sequential patterns" mines disjoint repeating negative sequence patterns. The disjointness condition, where the pattern is found in the next adjacent remainder if a part of the sequence contains it, is currently the strictest constraint. However, this method mines non-overlapping repeating negative sequence patterns, and the number of repeating negative sequence patterns mined by the former is greater than or equal to the number mined by the disjointness condition. Furthermore, e-RNSP uses hash tables to record information about repeating positive sequence patterns and calculates the support of repeating negative sequence patterns by traversing the corresponding hash tables, which is time-consuming. However, this method utilizes a bitmap index to determine the repetition count of a repeating negative sequence pattern in each sequence, which facilitates efficient support calculation.
[0078] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.< / abd> < / abd> < / bc> < / bc> < / c> < / bc> < / bc>
Claims
1. A method of data analysis based on repeated negative sequence patterns, characterized by, The steps are as follows: (1) defining relevant parameters A. Definition of positive sequence <a1a2...a m > in positive sequence <b1b2...b n > one occurrence <l1,l2,...,l m > where , positive integers 1≤l1 m ≤n, such that each element satisfies the following conditions: B. Define the sequence pattern p= of adaptive gap constraints <e1*e2*...e n > and * represent any number of wildcards; a single wildcard can match any element in the sequence. <e1e2...e n A simple representation of the adaptive sequence pattern p; if any element e k If the element is positive, then p is a positive sequence pattern; if there exists an element e... k If all elements are negative and no two or more negative elements are allowed to be adjacent, then p is a negative sequence pattern, 1≤k≤n; C.For a positive sequence pattern p = <e1e2...e n >, if the kth element of p satisfies , 1≤k≤n, then the two occurrences of p in any sequence > and > do not overlap, and the two occurrences are denoted by α and β, respectively. D. setting a support threshold for screening frequent patterns, the support of p is denoted as sup(p), and sup(p) is required to be not less than a specified minimum support min_sup; (2) traversing the sequence database DB, the items contained in the sequence database DB are represented by letters, and are arranged in English alphabetical order; a bitmap is constructed for each item, which records the position of the item in each database sequence; If an item is the kth element e n of a database sequence <e k 1≤k≤n, then the kth position in the bitmap corresponding to that database sequence for that item is 1, otherwise it is 0. (3) Generating positive sequence candidates by itemset extension and sequence extension depth-first downwards: setting an itemset extension set I and a sequence extension set S for each frequent positive sequence pattern, the itemset extension set I is composed of frequent items that can be added to the last element, the sequence extension set S is composed of frequent items that can be appended after the last element; for a frequent positive sequence pattern <e1e2...e n >, the itemset extension adds a frequent item i from the itemset extension set I in the last element e n , to obtain an extended element (e n i), thereby generating a sequence candidate <e1e2...(e n i>); the sequence extension adds a frequent item i from the sequence extension set S after the last element e n , thereby generating a sequence candidate <e1e2...e n i>. (4) For positive sequence patterns <e1e2...e n Using bitmaps <e1e2...e n >. The bitmap records the position of the pattern in each database sequence, and the number of 1s in the bitmap is recorded as the support of the positive sequence pattern; in the itemset expansion process of step (3), the bitmap (e n i) Bitmap record candidate <e1e2...(e n i)> The information about the last element is used for the next itemset expansion, by... <e1e2...e n >Bitmap of the last element and added items, e n Performing a bitwise AND operation on .bitmap and i.bitmap yields: (e n i).bitmap =e n .bitmap&i.bitmap; <e1e2...(e n i) bitmap of <e1e2...(e n i)>.bitmap is constructed as follows: Set <e1e2...e n The index of the first 1 value in.bitmap is k; define the function clear(index) to set the bit at index in the bitmap to 0, and the function set(index) to set the bit at index in the bitmap to 1; generate a bitmap nb, where , adopt and ; execute (e n i).bitmap.set(q), where q is the index of the first 1 value in (e n i).bitmap; at the same time, execute the (e n i).bitmap.clear(q) operation to meet the non-overlapping condition; repeat the execution to process other bits with a value of 1 in (e n ).bitmap; In the sequence extension process of step (3), the <e1e2...e n i> bitmap <e1e2... e n i>.bitmap is constructed as follows: set up <e1e2...e n The index of the first 1 value in the bitmap is k; generate bitmap nb; if ,use ,like use Then, execute. <e1e2... e n The code `i.bitmap.set(q)` is executed, where `q` is the index of the first 1 value in `nb&i.bitmap`. The `i.bitmap.clear(q)` operation is then performed to satisfy the no-overlap condition. This process is repeated to handle the remaining values. <e1e2...e n Other bits in the bitmap that are 1; (5) counting the number of 1 values of the positive sequence candidate appearance bitmap in step (4), if the number is not less than min_sup, the candidate is a frequent positive sequence pattern; (6) only focus on negative sequence candidates ns, where the corresponding positive sequence of ns is p(ns) = <p(e1)p(e2)...p(e n )>, p(¬e) = e means that the corresponding positive element of negative element ¬e is e. n )>, p(¬e) = e means that the corresponding positive element of negative element ¬e is e. changing the non-continuous elements of the frequent positive sequence pattern to generate a negative sequence candidate; (7) calculating the support of the negative sequence candidate ns; if ns contains only one element, the support of ns is calculated by the following formula: , where s j represents the jth sequence in the database DB; if the number of elements contained in ns is greater than 1, first obtain a set of database sequences containing ns by the following formula: where n is the number of negative elements in ns, MPS(ns) denotes the maximum positive subsequence of ns, which is an ordered list of all positive elements in ns; 1-negMS v denotes a 1-negative maximal subsequence of ns, which is a subsequence consisting of MPS(ns) and the vth negative element, 1≤v≤n; and then the support of ns is calculated by the following formula: , where RtpTimes(MPS(ns), s j ) represents the number of times the ns maximum positive subsequence occurs in the database sequence s j . (8) if the support of the negative sequence candidate meets sup(ns)≥ min_sup, the candidate is a frequent negative sequence pattern, which not only considers the repeated occurrence of the negative sequence pattern in different database sequences, but also considers the repeated occurrence in a certain database sequence; analyze the transaction behavior through the obtained frequent negative sequence pattern, predict the next behavior according to the transaction behavior, and thus provide personalized recommendation display for the platform.
2. The data analysis method based on repeated sequence pattern of claim 1, wherein, The negative sequence candidate support calculation process is as follows: a hash table is used to store the information of the frequent positive sequence pattern; the key of the hash table is the sequence identifier containing the frequent positive sequence pattern in the database, and the value of the hash table is the number of repeated occurrences of the frequent positive sequence pattern in the corresponding database sequence; a bitmap seqBitmap with a bit number of |DB| is created for each frequent positive sequence pattern to record the position of the frequent positive sequence pattern in the database DB; the database sequence set containing ns is quickly obtained by performing bit operation on the bitmap seqBitmap of the maximum positive subsequence and the corresponding positive sequence of the 1-negative maximum subsequence; first, obtain all database sequences not containing ns, and perform bit OR operation on the bitmap seqBitmap of the corresponding positive sequence of the 1-negative maximum subsequence; then obtain the bitmap reflecting the position information of ns in DB, and perform bit XOR operation on the bitmap seqBitmap of the maximum positive subsequence and the bitmap obtained by OR operation; finally, the repeated number of ns in each database sequence is obtained by quickly indexing the hash table using the bitmap of ns, and the support of ns is obtained by adding.
Citation Information
Patent Citations
Clinical medication behavior analysis system based on efficient negative sequence mining mode and working method thereof
CN110277172A
One-time condition negative sequence pattern mining method
CN113076356A