Target sequence pattern mining-based commodity recommendation method and system

By using a target sequence pattern mining method, and leveraging the guidance of negative target query sequences for matching and pruning, the time-consuming mining problem caused by pseudo-target sequence patterns in traditional systems is solved, and efficient target sequence pattern generation is achieved.

CN121366023BActive Publication Date: 2026-03-17QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Traditional product recommendation systems generate a large number of pseudo-target sequence patterns that meet the support criteria but do not match the target semantics in terms of sequence structure when mining negative target query sequences, resulting in long mining time.

Method used

A target sequence pattern mining method is adopted. By cleaning and encoding user shopping data, and using the negative target query sequence as a guide, the current prefix sequence is matched with the predecessor positive partner and the successor positive partner of the negative item. Pruning and pattern expansion are then performed to generate a highly consistent target sequence pattern.

Benefits of technology

It effectively reduces the generation of pseudo-target sequence patterns, improves mining efficiency, ensures that the generated target sequence patterns are highly consistent with the target query sequence in terms of support and sequence structure, and shortens the mining time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121366023B_ABST
    Figure CN121366023B_ABST
Patent Text Reader

Abstract

The application discloses a commodity recommendation method and system based on target sequence pattern mining, and belongs to the technical field of data mining. The user shopping behavior sequence is encoded to obtain an encoded shopping sequence, and a sequence candidate pattern with a length of 2m+1 is mined from the encoded shopping sequence; the patterns not containing a target query sequence are deleted, and the remaining patterns are target sequence patterns, and the support of the target sequence patterns is calculated; in the process of mining the sequence candidate pattern with the length of 2m+1 from the encoded shopping sequence, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence. The application has a shorter time consumption in mining the target sequence pattern.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data mining technology, specifically relating to a product recommendation method and system based on target sequence pattern mining. Background Technology

[0002] Traditional product recommendation systems, in the process of mining candidate patterns containing negative target sequences, generally do not match the current prefix sequence with the predecessor and successor positive partners of the negative item based on the negative target query sequence. This results in the generation of a large number of pseudo-target sequence patterns, which, although meeting the support requirements, do not match the target semantics of the target sequence pattern containing the negative target query sequence in terms of sequence structure. The large number of pseudo-target sequence patterns leads to the problem of long mining time for target sequence patterns. Therefore, this application provides a product recommendation method and system based on target sequence pattern mining. Summary of the Invention

[0003] To address the shortcomings and deficiencies in the existing technologies, this application proposes a product recommendation method and system based on target sequence pattern mining.

[0004] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:

[0005] A product recommendation method based on target sequence pattern mining includes the following steps:

[0006] S1. Collect user shopping data, clean the collected user shopping data to obtain cleaned data; then, classify and serialize the cleaned data to obtain uncoded user shopping behavior sequences and an uncoded element data table; then, according to the time sequence, count the uncoded user shopping behavior sequences and their corresponding user IDs into the shopping behavior sequence data table.

[0007] S2. Encode the user shopping behavior sequences in the shopping behavior sequence data table and the behavior elements in the element data table to obtain the encoded shopping behavior sequence data table and the encoded element data table. Then, mine candidate sequence patterns of length 2m+1 from the encoded shopping sequences in the encoded shopping behavior sequence data table. Then, delete the candidate sequence patterns of length 2m+1 that do not contain the target query sequence. The remaining candidate sequence patterns of length 2m+1 are the target sequence patterns. Calculate the support of the target sequence patterns.

[0008] In step S2, during the process of mining candidate patterns of sequence length 2m+1 from the encoded shopping sequence in the encoded shopping behavior sequence data table, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence.

[0009] S3. Sort the target sequence patterns according to their support levels, and then adjust the content displayed on the platform interface based on the corresponding user ID.

[0010] Preferably, step S2 includes the following specific steps:

[0011] S2-1. Encode the uncoded user shopping behavior sequences in the shopping behavior sequence data table and the uncoded behavior element types in the element data table to obtain the encoded element data table and the encoded shopping behavior sequence data table. Based on the encoded shopping sequences in the encoded shopping behavior sequence data table, obtain positive sequence candidate patterns of length 1 and negative sequence candidate patterns of length 1, and use the positive sequence candidate patterns of length 1 and negative sequence candidate patterns of length 1 as initial candidates.

[0012] S2-2. Prune the initial candidate items to obtain the processed candidate items;

[0013] S2-3. Based on the type of the target query sequence, i.e., whether the target query sequence is a positive or negative target query sequence, the candidate options obtained in step S2-2 are expanded to obtain a sequence candidate pattern of length 2. In step S2-3, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner and the successor positive partner of the negative item under the guidance of the negative target query sequence.

[0014] S2-4. Based on the candidate sequence pattern of length 2, recursively expand according to the steps described in step S2-3 until a candidate sequence pattern of length 2m+1 is obtained. Store the candidate sequence pattern of length 2m+1 in the sequence pattern table; where m is equal to the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table.

[0015] S2-5. Delete the candidate sequence patterns in the sequence pattern table with a length of 2m+1 that do not contain the target query sequence. The remaining candidate sequence patterns with a length of 2m+1 are the target sequence patterns. Calculate the support of the target sequence patterns.

[0016] Preferably, step S2-1 specifically includes the following steps:

[0017] S2-1-1. Encode the uncoded user shopping behavior sequences in the shopping behavior sequence data table and the uncoded behavior element types in the element data table.

[0018] S2-1-2. Delete the coded shopping sequences in the coded shopping behavior sequence data table that do not contain the target query sequence; then, create a corresponding bitmap for each item in the coded shopping behavior sequence data table.

[0019] S2-1-3. Obtain the support of each item, where the support of each item is equal to the number of times "1" appears in the bitmap corresponding to each item; filter out items with support ≥ preset minimum support (preset minimum support is 2 in this embodiment) as positive sequence candidate patterns of length 1.

[0020] S2-1-4. Perform a negative transformation on the positive sequence candidate pattern of length 1 to obtain a negative sequence candidate pattern of length 1; use both the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 as initial candidates for obtaining the column candidate pattern of length 2; and save the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 in the sequence pattern table.

[0021] Preferably, in step S2-1-2, the length of the bitmap is equal to the sum of the number of all user shopping behavior sequences. If an item appears in a sequence, the corresponding bit in the bitmap is set to 1; otherwise, it is set to 0.

[0022] Preferably, step S2-2 includes the following steps: taking each initial candidate as the current prefix sequence and obtaining the bitmap of the current prefix sequence; taking each initial candidate as an extension item and obtaining the bitmap of the extension item; obtaining the bitmap of the maximum positive subsequence of the target query sequence; and performing pruning based on the bitmap of the current prefix sequence, the bitmap of the extension item, and the bitmap of the maximum positive subsequence to obtain the processed candidate.

[0023] Preferably, in step S2-2, pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the extended term, and the bitmap of the maximum positive subsequence, specifically including the following steps:

[0024] 1) When the expansion term is a positive expansion term, pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the expansion term, and the bitmap of the largest positive subsequence to obtain the pruned and filtered candidate terms, including the following steps:

[0025] Combine the bitmap of the current prefix sequence, the bitmap of the extended term, and the bitmap of the largest positive subsequence of the target query sequence. Figure 3The algorithm performs a logical AND operation to obtain the final bitmap. Then, it calculates the support of the final bitmap. If the support of the final bitmap is less than the preset minimum support, it is pruned directly. Positive expansion items that are not pruned are used as candidates after pruning and filtering.

[0026] 2) When the extension term is a negative extension term, this application does not prune the negative extension term;

[0027] In step S2-2 of this application, the processed candidate items are composed of the pruned and screened candidate items and negative expansion terms.

[0028] Preferably, step S2-3 includes the following steps:

[0029] S2-3-1. When the target query sequence is a positive target query sequence, the processed candidate options are expanded to obtain a sequence candidate pattern of length 2.

[0030] S2-3-2. When the target query sequence is a negative target query sequence, the processed candidate options are expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table. In step S2-3-2, the current prefix sequence is matched with the predecessor positive partner and the successor positive partner of the negative item under the guidance of the negative target query sequence.

[0031] Preferably, step S2-3-2 specifically includes the following steps:

[0032] When the target query sequence is a negative target query sequence, first construct a position list for the target query sequence; then, identify the negative items in the target query sequence, find the corresponding positive partners based on the negative items, and identify the predecessor and successor positive partners of the negative items from the target query sequence.

[0033] This application sets a dynamic anchor value to track the matching status between the current prefix sequence and the target query sequence, wherein the initial value of the dynamic anchor value is set to 0;

[0034] (1) If both the predecessor and successor positive partners of the negative term exist, the processed candidate terms are expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table.

[0035] (2) If there is only a predecessor positive partner of the negative item, perform pattern expansion on the processed candidate items to obtain a sequence candidate pattern of length 2, and save the above sequence candidate pattern of length 2 in the sequence pattern table.

[0036] (3) If there are only positive successors of negative items, the processed candidate items are expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table.

[0037] Preferably, in step S2-3-2, the predecessor positive partner refers to the positive item in the target query sequence that is before the negative item and closest to the negative item, and the successor positive partner refers to the positive item in the target query sequence that is after the negative item and closest to the negative item. When the negative item has no predecessor positive partner, the position value of the predecessor positive partner is 0 by default. When the negative item has no successor positive partner, the position value of the successor positive partner is not counted in the position list.

[0038] Preferably, step (1) specifically includes the following steps:

[0039] Determine whether the current prefix sequence matches the predecessor positive partner of the negative term;

[0040] When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is incremented by 1. At this point, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, indicating that the current prefix sequence has matched the predecessor positive partner in the target query sequence. In this case, the application removes the candidate corresponding to the negative item, that is, removes the candidate corresponding to the negative item from the processed candidate list without further expanding the candidate corresponding to the negative item. The remaining candidate items after removing the candidate corresponding to the negative item are expanded to obtain a sequence candidate pattern of length 2. The aforementioned sequence candidate patterns of length 2 are stored in the sequence pattern table. Then, the current prefix sequence is matched with the successor positive partner of the negative item. When the current prefix sequence matches the successor positive partner of the negative item, the dynamic anchor value is incremented by 1. At this time, the dynamic anchor value is equal to the position value of the successor positive partner of the negative item in the position list minus 1. This indicates that the current prefix sequence has completely matched the target query sequence. This application adds the positive partner corresponding to the negative item in the target query sequence to the processed candidate options. These candidate options are used as the initial candidate options for obtaining the sequence candidate patterns of length 3, so as to continue to expand.

[0041] When the current prefix sequence does not match the preceding positive partner of the negative item, the dynamic anchor value remains unchanged regardless of whether the current prefix sequence matches the succeeding positive partner of the negative item in the target query sequence. This indicates that the current prefix sequence has not yet started to match the target query sequence. The candidate options obtained in step S2-2 are directly expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table. At this time, the candidate options obtained in step S2-2 are all used as the initial candidate options for obtaining a sequence candidate pattern of length 3, and continue to participate in the expansion.

[0042] Preferably, step (2) specifically includes the following steps:

[0043] Match the current prefix sequence with the predecessor positive partner of the negative term;

[0044] When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is incremented by 1. At this time, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, indicating that the current prefix sequence has matched the predecessor positive partner in the target query sequence. This application removes the positive partner corresponding to the negative item in the target query sequence from the candidates. Then, the remaining candidates after removing the positive partner corresponding to the negative item from the processed candidates are expanded to obtain a sequence candidate pattern of length 2. The above sequence candidate pattern of length 2 is stored in the sequence pattern table.

[0045] Preferably, when there is only a successor positive partner of the negative item but no predecessor positive partner of the negative item, the position of the predecessor positive partner is set to 0. At this time, the dynamic anchor value is equal to the position value of the predecessor positive partner. Since there is no predecessor positive partner of the negative item in the target query sequence, it means that this application only needs to process the positive partner corresponding to the negative item. The processing method is to remove the candidate of the positive partner corresponding to the negative item. Then, the remaining candidates after removing the positive partner corresponding to the negative item from the processed candidates are expanded to obtain a sequence candidate pattern of length 2. The above sequence candidate pattern of length 2 is stored in the sequence pattern table.

[0046] A product recommendation system for implementing the above-mentioned product recommendation method based on target sequence pattern mining includes a data storage layer, an algorithm layer, and an application layer:

[0047] The data storage layer is used to collect user shopping data and clean the collected user shopping data to obtain cleaned data. Then, the cleaned data is classified and serialized to obtain user shopping behavior sequences. Then, the uncoded user shopping behavior sequences and their corresponding user IDs are counted in the shopping behavior sequence data table according to the time sequence. The data storage layer transmits the shopping behavior sequence data table and its corresponding element data table to the algorithm layer.

[0048] The algorithm layer encodes the user shopping behavior sequences in the shopping behavior sequence data table and the behavior elements in the element data table output by the data storage layer, resulting in an encoded shopping behavior sequence data table and an encoded element data table. Then, it mines candidate sequence patterns of length 2m+1 from the encoded user shopping behavior sequences in the encoded shopping behavior sequence data table (hereinafter referred to as encoded shopping sequences). Candidate sequence patterns of length 2m+1 that do not contain the target query sequence are then deleted, leaving the remaining candidate sequence patterns of length 2m+1 as the target sequence patterns. The support of the target sequence patterns is calculated, and the target sequence patterns and their support are passed to the application layer.

[0049] The application layer receives the target sequence patterns and their support scores from the algorithm layer, sorts the target sequence patterns output by the algorithm layer according to their support scores, and then adjusts the content displayed on the platform interface in conjunction with the corresponding user ID. At the same time, the adjustment records are saved, a log file is generated, and the log file is transmitted to the data storage layer for archiving and storage.

[0050] Compared with the prior art, the beneficial technical effects of this application are as follows:

[0051] This application, in the process of sequence pattern mining containing negative target query sequences, can achieve matching between the current prefix sequence and the predecessor positive partner and the successor positive partner of the negative item based on the guidance of the negative target query sequence. This application can not only effectively ensure that the generated target sequence pattern containing the target query sequence meets the support requirements, but also make the generated target sequence pattern containing the target query sequence highly consistent with the target query sequence in terms of sequence structure. The target sequence pattern mining time of this application is short. This application effectively solves the problem that most existing product recommendation systems cannot achieve matching between the current prefix sequence and the predecessor positive partner and the successor positive partner of the negative item based on the guidance of the negative target query sequence during the process of sequence pattern mining containing negative target query sequences. This results in the generation of a large number of pseudo-target sequence patterns that meet the support requirements, but whose sequence structure does not match the target semantics of the target sequence pattern containing the target query sequence, thus leading to a long target sequence pattern mining time. Attached Figure Description

[0052] Figure 1 The mining time test results are for the SC-NSP method, TaNSP method, and the method described in this application when mining target sequence patterns containing positive target query sequences <(70,91)> on the Data1 dataset under the condition that the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360.

[0053] Figure 2 The mining time test results are for the SC-NSP method, TaNSP method and the method described in this application when mining target sequence patterns containing negative target query sequence <(¬71,91)> on the Data1 dataset under the condition that the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34.

[0054] Figure 3 The test results of the number of target sequence patterns when mining target sequence patterns containing positive target query sequences <(70,91)> on the Data1 dataset using the method described in this application and the TaNSP method under the condition that the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360;

[0055] Figure 4 The test results show the number of target sequence patterns when mining target sequence patterns containing negative target query sequences <(¬71,91)> on the Data1 dataset using the method described in this application and the TaNSP method under the condition that the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34.

[0056] Figure 5 The memory usage test results for the SC-NSP method, TaNSP method, and the method described in this application when performing target sequence pattern mining containing positive target query sequence <(70,91)> on the Data1 dataset under the condition of minimum support thresholds of 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360;

[0057] Figure 6 The memory usage test results for the SC-NSP method, TaNSP method, and the method described in this application when performing target sequence pattern mining containing negative target query sequence <(¬71,91)> on the Data1 dataset under the condition of minimum support threshold of 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34;

[0058] Figure 7 The results show the percentage improvement in the number of crossovers when using the SC-NSP method and the method described in this application to mine target sequence patterns containing positive target query sequences <(70,91)> on the Data1 dataset under minimum support thresholds of 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360.

[0059] Figure 8The results show the percentage improvement in the number of crossovers when using the TaNSP method and the method described in this application to mine target sequence patterns containing negative target query sequences <(¬71,91)> on the Data1 dataset, under the condition that the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34. Detailed Implementation

[0060] A product recommendation system based on target sequence pattern mining includes a data storage layer, an algorithm layer, and an application layer. The method for product recommendation using this system specifically includes the following steps:

[0061] S1. User shopping data is collected using the data storage layer, and the collected user shopping data is cleaned to obtain cleaned data; then, the cleaned data is classified and serialized to obtain uncoded user shopping behavior sequences and uncoded element data tables; then, the uncoded user shopping behavior sequences and their corresponding user IDs are statistically added to the shopping behavior sequence data table according to the chronological order; the data storage layer transmits the shopping behavior sequence data table and its corresponding element data table to the algorithm layer; the user shopping data collected in this application is already arranged in chronological order.

[0062] In this application, data cleaning refers to cleaning data in user shopping data that is unrelated to the recommendation target, and obtaining cleaned data. For example, user shopping data contains user operation timestamps, device information, etc. Since user operation timestamps and device information are unrelated to the system's product recommendations to users, user operation timestamps and device information are data that is unrelated to the system's product recommendations to users. Data cleaning is essentially the deletion of data that is unrelated to the system's product recommendations to users.

[0063] In this application, the cleaned data is classified and serialized, including the following steps:

[0064] (1) Create a user set for each user in the cleaned data and set a unique user ID for each user;

[0065] (2) In the user set, count the types of behavioral elements involved by the user to achieve the purpose of classifying the cleaned data;

[0066] (3) All behavioral element types in the cleaned data (these behavioral element types are uncoded element types) are counted in the uncoded element data table. For example, if user U1 only engaged in three types of behavioral elements at different time periods: purchasing a mobile phone of brand A, purchasing a tablet of brand B, and purchasing headphones of brand C, then user U1's element data table is as shown in Table 1. The behavioral element types in the element data table in Table 1 include purchasing a mobile phone of brand A, purchasing a tablet of brand B, and purchasing headphones of brand C; all behavioral element types shown in Table 1 are uncoded behavioral element types.

[0067] Table 1 is a data table of uncoded elements.

[0068]

[0069] This application categorizes the cleaned data based on the types of behavioral elements, which are determined by the type of goods purchased. For example, purchasing a mobile phone of brand A, a tablet of brand B, and headphones of brand C are three different types of behavioral elements.

[0070] (4) Construct an uncoded user shopping behavior sequence from all the types of behavioral elements of the same user within the same time period in the cleaned data;

[0071] For example, if user U1 first buys a brand A mobile phone, then buys a brand B tablet, and then buys a brand A mobile phone again in the first time period, then user U1's shopping data is transformed by the data storage layer into an uncoded user shopping behavior sequence <buy brand A mobile phone, buy brand B tablet, buy brand A mobile phone>.

[0072] In the second time period, user U1 first buys a tablet of brand B, then a mobile phone of brand A, and finally headphones of brand C. Then, user U1's shopping data is transformed by the data storage layer into an uncoded user shopping behavior sequence <buy a tablet of brand B, buy a mobile phone of brand A, buy headphones of brand C>.

[0073] If user U1 purchases a brand A mobile phone and a brand B tablet in the same order during the third time period, and then purchases brand C headphones separately, then user U1's shopping data is transformed by the data storage layer into an uncoded user shopping behavior sequence <(purchase brand A mobile phone, purchase brand B tablet), purchase brand C headphones>.

[0074] In this application, the above-mentioned uncoded user shopping behavior sequences and their corresponding user IDs are statistically summarized in the shopping behavior sequence data table, as shown in Table 2.

[0075] Table 2 shows the shopping behavior sequence data before encoding.

[0076] User ID Uncoded user shopping behavior sequence U1 <Purchase A brand mobile phone, purchase B brand tablet, purchase A brand mobile phone> U1 <Purchase a tablet of Brand B, purchase a mobile phone of Brand A, purchase a pair of headphones of Brand C> U1 (Buy a brand A mobile phone, buy a brand B tablet, buy brand C headphones)

[0077] S2. The algorithm layer encodes the user shopping behavior sequences in the shopping behavior sequence data table and the behavior elements in the element data table output by the data storage layer, resulting in an encoded shopping behavior sequence data table and an encoded element data table. Then, the encoded user shopping behavior sequences (hereinafter referred to as encoded shopping sequences) in the encoded shopping behavior sequence data table are mined to obtain candidate sequence patterns of length 2m+1. Candidate sequence patterns of length 2m+1 that do not contain the target query sequence are then deleted, leaving the remaining candidate sequence patterns of length 2m+1 as the target sequence patterns. The support of the target sequence patterns is calculated, and the target sequence patterns and their support are passed to the application layer. Specifically, this includes the following steps:

[0078] S2-1. Using an algorithm layer, encode the unencoded user shopping behavior sequences in the shopping behavior sequence data table and the unencoded behavior element types in the element data table to obtain the encoded element data table (as shown in Table 3) and the encoded shopping behavior sequence data table (as shown in Table 4). Based on the encoded user shopping behavior sequences in the encoded shopping behavior sequence data table, obtain positive sequence candidate patterns of length 1 and negative sequence candidate patterns of length 1. Specifically, this includes the following steps:

[0079] S2-1-1. Use the algorithm layer to encode the unencoded user shopping behavior sequences in the shopping behavior sequence data table and the unencoded behavior element types in the element data table.

[0080] For example, the types of behavioral elements appearing in Table 1—buying a brand A mobile phone, buying a brand B tablet, and buying a brand C headphones—are encoded as a, b, and c, respectively. The encoded element data table and the encoded shopping behavior sequence data table are shown in Table 3 and Table 4, respectively.

[0081] Table 3 shows the encoded element data.

[0082]

[0083] Table 4. Encoded Shopping Behavior Sequence Data

[0084]

[0085] S2-1-2. Scan the shopping behavior sequence data table and delete the encoded shopping sequences that do not contain the target query sequence. Then, create a corresponding bitmap for each item in the encoded shopping behavior sequence data table. The bitmap records the position of the item, and its length is equal to the sum of the number of all user shopping behavior sequences. If the item appears in a sequence, the corresponding bit in the bitmap is set to 1; otherwise, it is set to 0. For example, in Table 4... <a ,b, a> ,<b, a, c> The item 'a' appears in all three coded shopping sequences <(a, b), c>, therefore, the bitmap for item 'a' is [1, 1, 1]; for example, <a , b, a> ,<b, a, c> Item b appears in all three coded shopping sequences <(a, b), c>, therefore, the bitmap for item b is [1, 1, 1]; for example, <a , b, a>Item c did not appear in the text.<b, a, c> The item 'c' appears in both the coded shopping sequences <(a, b), c>, therefore, the bitmap of item 'c' is [0, 1, 1]. In this application, the target query sequence is manually defined, and the target sequence pattern refers to a pattern that contains the target query sequence; for example, if you want to find all patterns where user U1 buys a brand A mobile phone, does not buy a brand B tablet, and buys brand C headphones, then the target query sequence can be defined as...<a,¬b,c> All patterns that contain a target query sequence are called target sequence patterns;

[0086] S2-1-3. Obtain the support score for each item, where the support score for each item is equal to the number of times "1" appears in the corresponding bitmap for each item; filter out items with a support score ≥ the preset minimum support score (the preset minimum support score is 2 in this embodiment) as positive sequence candidate patterns of length 1; obviously, by <a , b, a>,<b, a, c> The three coded shopping sequences <(a, b), c> can yield positive sequence candidate patterns of length 1: , , ;

[0087] S2-1-4. Perform a negative transformation on the positive sequence candidate pattern of length 1 to obtain a negative sequence candidate pattern of length 1; use both the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 as initial candidates for obtaining the column candidate pattern of length 2; and store the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 in the sequence pattern table.

[0088] S2-2. Based on the initial candidate items, perform pruning to obtain the processed candidate items, which includes the following steps;

[0089] Each initial candidate is used as the current prefix sequence, and the bitmap of the current prefix sequence is obtained; each initial candidate is used as an extension term, and the bitmap of the extension term is obtained; the bitmap of the maximum positive subsequence of the target query sequence is obtained; pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the extension term, and the bitmap of the maximum positive subsequence to obtain the processed candidate.

[0090] In this application, pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the extended term, and the bitmap of the maximum positive subsequence. Specifically, the pruning process includes the following steps:

[0091] 1) When the expansion term is a positive expansion term, pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the expansion term, and the bitmap of the largest positive subsequence to obtain the pruned and filtered candidate terms, including the following steps:

[0092] Combine the bitmap of the current prefix sequence, the bitmap of the extended term, and the bitmap of the largest positive subsequence of the target query sequence. Figure 3 The final bitmap is obtained by performing a logical AND operation. Then, the support of the final bitmap is calculated. If the support of the final bitmap is less than the preset minimum support (the preset minimum support is 2 in this embodiment), it is determined that the positive expansion item is hopeless in forming a pattern that satisfies the target sequence pattern constraint, and it is directly pruned without further expansion. The positive expansion items that are not pruned are used as candidates after pruning and filtering. This step can effectively avoid wasting computing resources on paths that are unlikely to find the target sequence pattern containing the target query sequence.

[0093] 3) When the extension item is a negative extension item, this application does not prune the negative extension item, so as to ensure that the target sequence pattern mined can effectively cover the negative sequence pattern at the beginning or end of the negative item, and improve the completeness of mining the target sequence pattern containing the target query sequence.

[0094] In step S2-2 of this application, the processed candidate is composed of the pruned and filtered candidate and the negative expansion term (which is a negative sequence candidate pattern of length 1).

[0095] In step S2-2 of this application, when the target query sequence is a positive target query sequence, the largest positive subsequence of the target query sequence is the same as the target query sequence; when the target query sequence is a negative target query sequence, the subsequence formed by all positive items in the target query sequence is taken as the largest positive subsequence of the target query sequence. For example, if the target query sequence is a negative target query sequence...<a,¬b,c> Then the subsequence consisting of all positive items in the negative target query sequence<a,b,c> That is, the largest positive subsequence of the negative target query sequence.

[0096] S2-3. Based on the type of the target query sequence, the candidate items processed in step S2-2 are expanded to obtain a sequence candidate pattern of length 2, and the negative sequence candidate pattern of length 2 is stored in the sequence pattern table; in step S2-3, the current prefix sequence is matched with the predecessor positive partner and the successor positive partner of the negative item under the guidance of the negative target query sequence; step S2-3 specifically includes the following steps;

[0097] S2-3-1. When the target query sequence is a positive target query sequence, the processed candidate options are expanded to obtain a sequence candidate pattern of length 2. The negative sequence candidate pattern of length 2 is stored in the sequence pattern table, including the following steps:

[0098] The processed candidate items are used as new extension items. The current prefix sequence is connected with the new extension items to form new candidate patterns. The bitmap of the current prefix sequence and the bitmap of the new extension items are logically ANDed to update the bitmap of the new candidate patterns. The support of the bitmap of the new candidate patterns is calculated. If the support of the bitmap is less than the preset minimum support (the preset minimum support is 2 in this embodiment), it is determined that the extension item is hopeless in forming a pattern that satisfies the constraints of the target sequence pattern and is directly pruned without further expansion. If the support of the bitmap is greater than or equal to the preset minimum support, the new candidate patterns corresponding to these bitmaps are sequence candidate patterns of length 2. These sequence candidate patterns of length 2 are used as initial candidates for obtaining sequence candidate patterns of length 3, and the above sequence candidate patterns of length 2 are stored in the sequence pattern table. In this embodiment, the target query sequence is a positive target query sequence, indicating that the items contained in the target query sequence are all behavioral elements of the user purchasing goods.

[0099] S2-3-2. When the target query sequence is a negative target query sequence, the processed candidate options are expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table; in step S2-3-2, the current prefix sequence is matched with the predecessor positive partner and the successor positive partner of the negative item based on the guidance of the negative target query sequence; in this embodiment, the target query sequence is a negative target query sequence, which means that the items contained in the target query sequence include behavioral elements of users who have not purchased goods; step S2-3-2 specifically includes the following steps:

[0100] When the target query sequence is a negative target query sequence, first construct a position list for the target query sequence, based on the target query sequence.<a,¬b,c> For example, the position value of 'a' is defined as 1, the position value of 'b' is defined as 2, and the position value of 'c' is defined as 3. The target query sequence is...<a,¬b,c> The list of locations is shown in Table 5:

[0101] Table 5 Target Query Sequence<a, ¬b,c> Location list

[0102] item a ¬b c Location 1 2 3

[0103] Then, the negative items in the target query sequence are identified, and the corresponding positive partners are determined based on the negative items. The preceding and succeeding positive partners of the negative items are then identified from the target query sequence. The preceding positive partner is the closest positive item in the target query sequence that precedes the negative item, and the succeeding positive partner is the closest positive item in the target query sequence that follows the negative item. In this application, when a negative item has no preceding positive partner, the position value of the preceding positive partner is defaulted to 0; and when a negative item has no succeeding positive partner, the position value of the succeeding positive partner is not counted in the position list.

[0104] With target query sequence<a,¬b,c> For example, the negative term in the target query sequence is <¬b>, and the positive partner corresponding to the negative term <¬b> is... ; Identify the predecessor positive partner of the negative item <¬b> from the target query sequence. Identify the positive successor of the negative item <¬b> from the target query sequence. <c>.

[0105] This application sets a dynamic anchor value to track the matching status between the current prefix sequence and the target query sequence, wherein the initial value of the dynamic anchor value is set to 0;

[0106] (1) If both the predecessor and successor positive partners of the negative term exist, the processed candidate terms are expanded to obtain a sequence candidate pattern of length 2. The above sequence candidate pattern of length 2 is stored in the sequence pattern table. Step (1) specifically includes the following steps:

[0107] Determine whether the current prefix sequence matches the predecessor positive partner of the negative term;

[0108] When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is incremented by 1. At this point, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, indicating that the current prefix sequence has matched the predecessor positive partner in the target query sequence. In this case, the application removes the candidate corresponding to the negative item, that is, removes the candidate corresponding to the negative item from the processed candidate list without further expanding the candidate corresponding to the negative item. The remaining candidate items after removing the candidate corresponding to the negative item are expanded to obtain a sequence candidate pattern of length 2. The aforementioned sequence candidate patterns of length 2 are stored in the sequence pattern table. Then, the current prefix sequence is matched with the successor positive partner of the negative item. When the current prefix sequence matches the successor positive partner of the negative item, the dynamic anchor value is incremented by 1. At this time, the dynamic anchor value is equal to the position value of the successor positive partner of the negative item in the position list minus 1. This indicates that the current prefix sequence has completely matched the target query sequence. This application adds the positive partner corresponding to the negative item in the target query sequence to the processed candidate options. These candidate options are used as the initial candidate options for obtaining the sequence candidate patterns of length 3, so as to continue to expand.

[0109] When the current prefix sequence does not match the preceding positive partner of the negative item, the dynamic anchor value remains unchanged regardless of whether the current prefix sequence matches the succeeding positive partner of the negative item in the target query sequence. This indicates that the current prefix sequence has not yet started to match the target query sequence. The candidate options obtained in step S2-2 are directly expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate patterns of length 2 are stored in the sequence pattern table. At this time, the processed candidate options are all used as the initial candidate options for obtaining a sequence candidate pattern of length 3, and continue to participate in the expansion.

[0110] (2) If only the predecessor positive partner of the negative term exists (e.g., the target query sequence is...)<a,¬b> The processed candidate patterns are expanded to obtain a sequence candidate pattern of length 2. The above sequence candidate patterns of length 2 are stored in the sequence pattern table. Step (2) specifically includes the following steps:

[0111] Match the current prefix sequence with the predecessor positive partner of the negative term;

[0112] When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is incremented by 1. At this point, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, indicating that the current prefix sequence has matched the predecessor positive partner in the target query sequence; for example, the target query sequence is...<a,¬b> If the current prefix sequence is< / c> At this point, the current prefix sequence The target query sequence was matched.<a,¬b> In the position of the preceding positive partner of the negative item, b is not allowed after a, that is, the positive partner corresponding to the negative item cannot appear after the preceding positive partner. Therefore, this application removes the positive partner corresponding to the negative item in the target query sequence from the candidates; then, the remaining candidates after removing the positive partner corresponding to the negative item in the processed candidates are expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table.

[0113] (3) If only the successor positive partner of the negative item exists (for example, the target query sequence is <¬b,c>), the processed candidate items are expanded to obtain a sequence candidate pattern of length 2, and the above sequence candidate pattern of length 2 is stored in the sequence pattern table; step (3) specifically includes the following steps:

[0114] When only the successor positive partner of a negative term exists, but no predecessor positive partner exists, the position of the predecessor positive partner is set to 0. In this case, the dynamic anchor value equals the position value of the predecessor positive partner. Since there is no predecessor positive partner for a negative term in the target query sequence, this application currently only needs to process the positive partners corresponding to the negative terms. The processing method is to remove the positive partners corresponding to the negative terms from the candidate list. For example, if the target query sequence is <¬b,c>, and the current prefix sequence is... The target query sequence requires <c>It is not allowed to appear before it appears. Therefore, this application will target the negative items in the query sequence. Corresponding positive partner Remove candidates; then, expand the remaining candidates after removing the positive partners corresponding to the negative items in the processed candidates to obtain a sequence candidate pattern of length 2, and save the above sequence candidate pattern of length 2 in the sequence pattern table;

[0115] The settings in step S2-3-2 enable this application to match the current prefix sequence with the predecessor positive partner and the successor positive partner of the negative item based on the negative target query sequence during sequence pattern mining of sequences containing negative target query sequences. These settings not only effectively ensure that the generated target sequence patterns containing target query sequences meet the support requirements, but also ensure that the generated target sequence patterns are highly consistent with the target query sequence in terms of sequence structure, resulting in a shorter target sequence pattern mining time. This application effectively solves the problem that most existing product recommendation systems cannot match the current prefix sequence with the predecessor positive partner and the successor positive partner of the negative item based on the negative target query sequence during sequence pattern mining of sequences containing negative target query sequences, leading to the generation of a large number of...<a, a> These pseudo-target sequence patterns, although meeting the support criteria, do not match the target semantics of the target sequence pattern containing the target query sequence in terms of sequence structure, thus leading to the problem of long target sequence pattern mining time.

[0116] S2-4. Based on the candidate sequence pattern of length 2, recursively expand according to the steps described in S2-3 until a candidate sequence pattern of length 2m+1 is obtained. Store the candidate sequence pattern of length 2m+1 in the sequence pattern table; where m is equal to the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table. The reason for setting the length of the candidate sequence pattern to 2m+1 in this application is as follows: Since the encoded shopping sequence is composed of the behavior elements of purchasing goods, the encoded shopping sequence is a positive sequence. If the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table is m, the largest target sequence pattern containing the longest encoded shopping sequence is...<N P N P...P N> N represents negative terms, P represents positive terms, and the maximum target sequence pattern length is 2m+1. Therefore, in this application, it is necessary to recursively extend to candidate sequence patterns of length 2m+1.

[0117] S2-5. Delete the sequence candidate patterns in the sequence pattern table with a length of 2m+1 that do not contain the target query sequence. The remaining sequence candidate patterns with a length of 2m+1 are the target sequence patterns. Calculate the support of the target sequence patterns.

[0118] S3. The application layer receives the target sequence patterns and their support scores from the algorithm layer, sorts the target sequence patterns according to their support scores, and then adjusts the content displayed on the platform interface based on the corresponding user ID. Simultaneously, it saves the adjustment records, generates a log file, and transmits it to the data storage layer for archiving. In this application, the application layer automatically optimizes the platform content display strategy based on the target sequence patterns (in this application, the target sequence patterns accurately reflect user behavior preferences) and their support scores, making the recommendation results more aligned with the user's true intent. After completing the content priority adjustment, the application layer presents the recommended content to the user through the platform interface. The display of recommendation information may include detailed information such as content titles, images, and key attributes, ensuring that the user can fully understand the recommended content. After browsing the recommended content, the user can interact according to their interests. If the user becomes interested in the recommended content and makes a purchase, the application layer will record the purchase behavior and update the user's shopping data in real time. The updated user shopping data is then transmitted back to the data storage layer through the application layer. For example,

[0119] The algorithm layer output contains the target query sequence.<a,¬b,c> The greater the support for the target sequence pattern, the higher the frequency of a user's behavior of buying a phone of brand A, not buying a tablet of brand B, and buying headphones of brand C. In this case, the product recommendation system, combined with the corresponding user ID, will display more phones of brand A and headphones of brand C on the platform interface, and less tablets of brand B.

[0120] test:

[0121] This application uses the IBM Data Generator to generate a test set Data1 for testing. This application controls the data size, shopping sequence complexity, and pattern distribution of the test set Data1 by adjusting the parameters of the IBM Data Generator to test the mining efficiency of the method described in this application. The adjusted parameters include: C: number of customers; T: average number of transactions per customer; S: average number of items per transaction; I: length of the maximum pattern, i.e., the size of the largest pattern obtainable through pattern concatenation; DB: number of sequence patterns; N: number of different items.

[0122] The dataset Data1 in this application was obtained as follows: The DS1 dataset was obtained under the following conditions: the parameters of the IBM data generator were configured as C=8, T=8, S=6, I=8, DB=10K (where 10K=10000) and N=100.

[0123] To verify the effectiveness of the recommendation method described in this application (hereinafter referred to as the Ours method), this application selected an existing recommendation method and an ablation experiment comparison method to test the recommendation method described in this application based on the dataset Data1. Among them, the existing recommendation method is the SC-NSP method (from the paper "SC-NSP: An efficient algorithm for mining negative sequential patterns"); the ablation experiment comparison method is referred to as the TaNSP method in this application. The TaNSP method differs from the method described in this application in the following ways: First, steps S2-2 to S2-4 in the method described in this application are deleted; Second, the TaNSP method expands the initial candidate patterns obtained from steps S2-1-4 of the method described in this application and calculates the support of the expanded candidate sequence patterns. The expanded candidate sequence patterns with support greater than or equal to the preset minimum support (the preset minimum support is 2) are taken as candidate sequence patterns with a length of 2. Then, the expansion is recursively performed until a sequence candidate pattern with a length of 2m+1 is obtained, where m is the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table.

[0124] Test 1: This application tests the mining time of the three methods (Ours method, SC-NSP method, and TaNSP method) on the Data1 dataset under the same support threshold condition for mining target sequence patterns containing positive target query sequences <(70,91)>. The test results are as follows:< / c> Figure 1 As shown;

[0125] Test 2: This application tests the mining time of the above three methods on the Data1 dataset under the same support threshold condition for mining target sequence patterns containing negative target query sequences <(¬71,91)>. The test results are as follows: Figure 2 As shown;

[0126] Test 3: This application tests the number of target sequence patterns mined by the three methods mentioned above on the Data1 dataset under the same support threshold condition when mining target sequence patterns containing positive target query sequences <(70,91)>. The test results are as follows: Figure 3 As shown;

[0127] Test 4: This application tested the number of target sequence patterns mined using the Ours method and the TaNSP method on the Data1 dataset under the same support threshold. The test results are as follows: Figure 4 As shown;

[0128] Test 5: This application tests the memory usage of the Ours method and the TaNSP method on the Data1 dataset under the same support threshold conditions when mining target sequence patterns containing positive target query sequences <(70,91)>. The test results are as follows: Figure 5 As shown;

[0129] Test 6: This application tests the memory usage of the three methods mentioned above when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset under the same support threshold. The test results are as follows: Figure 6 As shown;

[0130] Test 7: This application tests the percentage improvement in the number of crossover points when mining target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset using the three methods mentioned above under the same support threshold. The test results are as follows: Figure 7 As shown;

[0131] Test 8: This application tests the percentage improvement in the number of crossover points when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset using the three methods mentioned above under the same support threshold. The test results are as follows: Figure 8 As shown.

[0132] In this application, Figure 7 and Figure 8 In the diagram, the order described on the horizontal axis represents... Figure 1 and Figure 2 The order of minimum support thresholds on the horizontal axis; Figure 7 Taking sequence 1 as an example, sequence 1 means Figure 7 The minimum support threshold used in the test was 1. Figure 1 The first minimum support threshold on the horizontal axis is 0.2350; Figure 7 Taking sequence 2 as an example, sequence 2 means Figure 7 The minimum support threshold used in the test was 1. Figure 1 The second minimum support threshold for the horizontal axis is 0.2352.

[0133] This application, Figure 7 and Figure 8 In the above, Q1 represents the percentage improvement in the number of crossovers achieved by the Ours method compared to the SC-NSP method, and Q2 represents the percentage improvement in the number of crossovers achieved by the Ours method compared to the TaNSP method; Figure 7 Taking Q1 and Q2 as examples, Figure 7 In the formula, the percentage improvement in the number of intersections Q1 is calculated as shown in Equation (1), and the percentage improvement in the number of intersections Q2 is calculated as shown in Equation (2):

[0134] Q1=(|X1-Y1| / X1)×100% (1)

[0135] In Equation (1), X1 represents the number of intersections mined by the SC-NSP method when mining target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset, and Y1 represents the number of intersections mined by the Ours method when mining target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset.

[0136] Q2=(|X2-Y2| / X2)×100% (2)

[0137] In Equation (2), X2 represents the number of intersections mined by the TaNSP method when mining target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset, and Y2 represents the number of intersections mined by the Ours method when mining target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset.

[0138] Figure 8 The calculation methods for Q1 and Q2 are also shown in Equations (1) and (2) respectively, except that... Figure 8 In the Q1 calculation formula, X1 represents the number of intersections mined by the SC-NSP method when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset, and Y1 represents the number of intersections mined by the Ours method when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset. Figure 8 In the Q2 calculation formula, X2 represents the number of intersections mined by the TaNSP method when mining target sequence patterns containing positive target query sequences <(¬71,91)> based on the Data1 dataset, and Y2 represents the number of intersections mined by the Ours method when mining target sequence patterns containing positive target query sequences <(¬71,91)> based on the Data1 dataset.

[0139] from Figure 1It can be seen that when the methods described in this application, the SC-NSP method, and the TaNSP method mine target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset, the mining times of the method described in this application are 204670ms, 190000ms, 186111ms, 149608ms, 139608ms, and 124625ms respectively when the minimum support thresholds are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360; and the mining times of the SC-NSP method are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360 respectively. When the minimum support thresholds are 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360, the mining times are 411908ms, 381346ms, 346155ms, 247040ms, 237661ms, and 227174ms, respectively. When the minimum support thresholds are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360, the mining times are 330444ms, 324300ms, 314735ms, 203344ms, 191160ms, and 179608ms, respectively. Clearly, the method described in this application significantly reduces the mining time compared to the SC-NSP and TaNSP methods when mining target sequence patterns containing positive target query sequences <(70,91)> on the Data1 dataset. Taking mining with a minimum support threshold of 0.2350 as an example, the mining time of the method described in this application is reduced by (381346-204670) / 381346×100%=46.33% and (330444-204670) / 330444×100%=38.06% respectively when mining target sequence patterns containing positive target query sequences on the Data1 dataset. This indicates that the method described in this application has a shorter mining time, higher operating efficiency, and can complete the mining task faster when mining target sequence patterns containing positive target query sequences.

[0140] from Figure 2It can be seen that when the method described in this application, the SC-NSP method, and the TaNSP method mine target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset, the mining times of the method described in this application are 25050ms, 17925ms, 13701ms, 10034ms, 8287ms, and 6781ms respectively when the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34; the mining times of the SC-NSP method are 25050ms, 17925ms, 13701ms, 10034ms, 8287ms, and 6781ms respectively when the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34. When the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34, the mining times are 44473ms, 24282ms, 20148ms, 14249ms, 10551ms, and 10363ms, respectively. When the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34, the mining times for the TaNSP method are 41250ms, 22909ms, 22695ms, 11506ms, 9037ms, and 7027ms, respectively. Clearly, the method described in this application significantly reduces the mining time compared to the SC-NSP and TaNSP methods when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset. Taking mining with a minimum support threshold of 0.24 as an example, the mining time of the method described in this application is reduced by (44473-25050) / 44473×100%=43.67% and (41250-25050) / 41250×100%=39.27% ​​respectively when mining target sequence patterns containing negative target query sequences based on the Data1 dataset. This indicates that the method described in this application has a shorter mining time, higher operating efficiency, and can complete the mining task faster when mining target sequence patterns containing negative target query sequences.

[0141] from Figure 3It can be seen that when the method described in this application and the TaNSP method mine target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset, the number of target sequence patterns mined by the method described in this application when the minimum support thresholds are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360 are 106, 106, 106, 105, 105, and 104, respectively; and the number of target sequence patterns mined by the TaNSP method when the minimum support thresholds are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360 are 106, 106, 106, 105, 105, and 104, respectively. Obviously, compared with the ablation experiment method—TaNSP method, the method described in this application has the same number of target sequence patterns mined as TaNSP method. This shows that this application can not only significantly shorten the mining time of target sequence patterns, but also does not affect the number of target sequence patterns mined.

[0142] Figure 4 It can be seen that when the method described in this application and the TaNSP method mine target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset, the number of target sequence patterns mined by the method described in this application with minimum support thresholds of 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34 are 719, 498, 368, 281, 211, and 171, respectively; while the number of target sequence patterns mined by the TaNSP method with minimum support thresholds of 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34 are 719, 498, 368, 281, 211, and 171, respectively. Clearly, compared to the TaNSP method, the method described in this application achieves the same number of target sequence patterns mined, indicating that this application not only significantly shortens the target sequence pattern mining time but also does not affect the number of target sequence patterns mined.

[0143] from Figure 5It can be seen that when the methods described in this application, the SC-NSP method, and the TaNSP method mine target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset, the memory usage of the method described in this application is 2803.88963MB, 1386.85934MB, 1339.78362MB, 1018.18073MB, 1010.40224MB, and 2904.02102MB respectively when the minimum support thresholds are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360; and the memory usage of the SC-NSP method is 2803.88963MB, 1386.85934MB, 1339.78362MB, 1018.18073MB, 1010.40224MB, and 2904.02102MB respectively when the minimum support thresholds are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360. 4. When the minimum support thresholds are 0.2356, 0.2358, and 0.2360, the memory usage is 3013.37029MB, 2921.68249MB, 2977.42213MB, 3039.42637MB, 2909.54064MB, and 3193.91071MB, respectively. When the minimum support thresholds of the TaNSP method are 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360, the memory usage is 2996.52341MB, 3037.65038MB, 2956.62249MB, 2826.39902MB, 2858.53406MB, and 3017.01343MB, respectively. Clearly, within the minimum support threshold range of 0.235-0.2358, the method described in this application significantly reduces memory usage compared to the SC-NSP and TaNSP methods when mining target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset. Taking mining with a minimum support threshold of 0.2358 as an example, the method described in this application significantly reduces memory usage compared to the SC-NSP and TaNSP methods when mining target sequences containing positive target sequences based on the Data1 dataset. When querying the target sequence pattern <(70,91)>, the memory usage decreased by (2909.54064-1010.40224) / 2909.54064×100%=65.27% and (2858.53406-1010.40224) / 2858.53406×100%=64.65% respectively. This shows that the method described in this application has a small memory usage when mining target sequence patterns containing positive target query sequences, and can effectively save memory resources.

[0144] from Figure 6It can be seen that when the methods described in this application, the SC-NSP method, and the TaNSP method mine target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset, the memory usage of the method described in this application is 1418.72906MB, 300.83718MB, 1139.24693MB, 1029.80030MB, 186.09807MB, and 238.62485MB respectively when the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34; and the memory usage of the SC-NSP method is 1418.72906MB, 300.83718MB, 1139.24693MB, 1029.80030MB, 186.09807MB, and 238.62485MB respectively when the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34. When the minimum support thresholds are 0.28, 0.30, 0.32, and 0.34, the memory usage is 1837.23953MB, 1372.51440MB, 742.51511MB, 519.68388MB, 1045.76758MB, and 585.49432MB, respectively. When the minimum support thresholds are 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34, the memory usage of the TaNSP method is 1922.64864MB, 1666.21246MB, 747.59499MB, 491.96923MB, 941.23230MB, and 944.45656MB, respectively. Clearly, within the minimum support threshold ranges of 0.24-0.26 and 0.32-0.34, the method described in this application significantly reduces memory usage compared to the SC-NSP and TaNSP methods when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset. Taking mining with a minimum support threshold of 0.32 as an example, the method described in this application significantly reduces memory usage compared to the SC-NSP and TaNSP methods when mining target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset. When mining target sequence patterns containing negative target query sequences <(¬71,91)>, memory usage decreased by (1045.76758-186.09807) / 1045.76758×100%=82.20% and (941.23230-186.09807) / 941.23230×100%=80.23% respectively. This indicates that the method described in this application also has a smaller memory footprint when mining target sequence patterns containing negative target query sequences, and can effectively save memory resources.

[0145] from Figure 7It can be seen that when the method described in this application, the SC-NSP method, and the TaNSP method mine target sequence patterns containing positive target query sequences <(70,91)> based on the Data1 dataset, the percentage improvement in the number of crossovers obtained by the method described in this application compared to the SC-NSP method, Q1, is 96.96 for sequence 2; 96.95 for sequence 3; 96.94 for sequence 4; 96.94 for sequence 5; and 96.94 for sequence 6. The percentage improvement in the number of crossovers obtained by the method described in this application compared to the TaNSP method, Q2, is 97.31 for sequence 2; 97.31 for sequence 3; 97.30 for sequence 4; 97.30 for sequence 5; and 97.30 for sequence 6. This indicates that the percentage improvement in the number of intersections between Q1 and Q2 remains at a high level and shows a stable trend across all orders. The percentage of Q2 is slightly higher than that of Q1, but both are in the high proportion range of 96.94% and above. This means that the method described in this application has a high and stable proportion of intersections in the target sequence pattern mining process containing positive target query sequences <(70,91)>, which can ensure the high reliability and accuracy of the target sequence pattern mining results. As a result, the product recommendation system can make more accurate and reliable decisions based on the target sequence pattern mining results.

[0146] from Figure 8 It can be seen that when the method described in this application, the SC-NSP method, and the TaNSP method mine target sequence patterns containing negative target query sequences <(¬71,91)> based on the Data1 dataset, the percentage improvement Q1 in the number of crossovers obtained by the method described in this application compared to the SC-NSP method is as follows: Q1 is 92.19 for sequence 1; Q1 is 90.50 for sequence 2; Q1 is 85.45 for sequence 3; and Q1 is [missing value] for sequence 4. 81.82; Q1 is 83.19 in sequence 5; Q1 is 80.67 in sequence 6; the percentage improvement in the number of crossovers obtained by the method described in this application relative to the TaNSP method, Q2, is 92.76 in sequence 1; 91.30 in sequence 2; 87.09 in sequence 3; 83.99 in sequence 4; 85.31 in sequence 5; and 83.05 in sequence 6.

[0147] Clearly, the percentage improvement in the number of crossovers, Q2, is higher than that of Q1 in all orders, but Q1 still remains at a level of 80.67 or above. This indicates that the method described in this application maintains a certain level of crossover ratio when mining target sequence patterns containing negative target query sequences <(¬71,91)>, thus ensuring the reliability of the target sequence pattern mining results.

Claims

1. A commodity recommendation method based on target sequence pattern mining, characterized in that: The method comprises the following steps: S1, sequentially performing data cleaning, classification and serialization processing on user shopping data to obtain an uncoded user shopping behavior sequence, and counting the uncoded user shopping behavior sequence and the corresponding user ID into a shopping behavior sequence data table according to time sequence; S2, encoding the user shopping behavior sequence to obtain an encoded shopping sequence, mining a sequence candidate mode with a length of 2m+1 from the encoded shopping sequence, wherein m is equal to the length of the longest encoded shopping sequence; deleting modes not containing a target query sequence, and the remaining modes are target sequence modes, and the support of the target sequence modes is calculated; In the process of mining a sequence candidate mode with a length of 2m+1 from the encoded shopping sequence, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence; The predecessor positive partner refers to a positive item in the target query sequence located before the negative item and closest to the negative item, and the successor positive partner refers to a positive item in the target query sequence located after the negative item and closest to the negative item; when the negative item has no predecessor positive partner, the position value of the default predecessor positive partner is 0; and when the negative item has no successor positive partner, the position value of the successor positive partner is not counted in the position list; When the target query sequence is a negative target query sequence, a position list is first constructed for the target query sequence, and then a negative item in the target query sequence is identified, and the positive partner corresponding to the negative item is known according to the negative item, and the predecessor positive partner and the successor positive partner of the negative item are identified from the target query sequence; A dynamic anchor value is set to track the matching of the current prefix sequence and the target query sequence, and the initial value of the dynamic anchor value is 0; (1) If the predecessor positive partner and the successor positive partner of the negative item both exist, the processed candidate items are extended to obtain a sequence candidate mode with a length of 2; Step (1) specifically comprises the following steps: It is judged whether the current prefix sequence and the predecessor positive partner of the negative item are matched and consistent; When the current prefix sequence and the predecessor positive partner of the negative item are matched and consistent, the dynamic anchor value is increased by 1, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, the positive partner corresponding to the negative item is removed from the processed candidate items, the remaining candidate items are extended to obtain a sequence candidate mode with a length of 2, and then the current prefix sequence is continuously matched with the successor positive partner of the negative item, when the current prefix sequence and the successor positive partner of the negative item are matched and consistent, the dynamic anchor value is continuously increased by 1, the dynamic anchor value is equal to the position value of the successor positive partner of the negative item in the position list minus 1, and the positive partner corresponding to the negative item in the target query sequence is added to the processed candidate items, and these candidate items are used as initial candidate items to obtain a sequence candidate mode with a length of 3 for continuous extension. When the current prefix sequence does not match the predecessor positive partner of the negative item, the dynamic anchor value remains unchanged regardless of whether the current prefix sequence matches the successor positive partner of the negative item in the target query sequence, and each candidate in the processed candidate obtained in step S2-2 is directly expanded to obtain a sequence candidate mode with a length of 2; at this time, the processed candidate obtained in step S2-2 is used as an initial candidate for obtaining a sequence candidate mode with a length of 3, and continues to participate in the expansion; (2) If only the predecessor positive partner of the negative item exists, the mode of the processed candidate is expanded to obtain a sequence candidate mode with a length of 2; (3) If only the successor positive partner of the negative item exists, the mode of the processed candidate is expanded to obtain a sequence candidate mode with a length of 2; S3, sort the target sequence mode according to the size of the support, and then adjust the content displayed on the platform interface in combination with the corresponding user ID. 2.The commodity recommendation method based on target sequence pattern mining according to claim 1, characterized in that: Step S2 includes the following specific steps: S2-1, encode the unencoded user shopping behavior sequence to obtain an encoded shopping sequence; based on the encoded shopping sequence, obtain positive and negative sequence candidate modes with a length of 1, and use them as initial candidates; S2-2, prune the initial candidates to obtain processed candidates; S2-3, according to the type of the target query sequence, expand the mode of the processed candidates to obtain a sequence candidate mode with a length of 2; in step S2-3, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence; S2-4, recursively expand the sequence candidate mode with a length of 2 according to step S2-3 until a sequence candidate mode with a length of 2m+1 is obtained; S2-5, delete the sequence candidate modes in the sequence candidate mode with a length of 2m+1 that do not contain the target query sequence, and the remaining sequence candidate modes with a length of 2m+1 are target sequence modes, and the support of the target sequence modes is calculated. 3.The commodity recommendation method based on target sequence pattern mining according to claim 2, characterized in that: Step S2-1 specifically includes the following steps: S2-1-1, perform an encoding operation on the unencoded user shopping behavior sequence to obtain an encoded shopping sequence; S2-1-2, delete the encoded shopping sequence in the encoded shopping behavior sequence data table that does not contain the target query sequence; create a corresponding bitmap for each item in the encoded shopping behavior sequence data table; S2-1-3, obtain the support of each item based on the number of times 1 appears in the corresponding bitmap of each item; The item with a support greater than or equal to a preset minimum support is used as a positive sequence candidate mode with a length of 1; S2-1-4, perform negative transformation on the positive sequence candidate mode with a length of 1 to obtain a negative sequence candidate mode with a length of 1; use the positive and negative sequence candidate modes with a length of 1 as initial candidates for obtaining a sequence candidate mode with a length of 2. 4.The commodity recommendation method based on target sequence pattern mining according to claim 2, characterized in that: Step S2-2 includes the following steps: take each initial candidate as a current prefix sequence and an expansion item respectively, and obtain the bitmap of the maximum positive subsequence of the current prefix sequence, the expansion item and the target query sequence; The pruning processing is performed based on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence to obtain a processed candidate item.

5. The product recommendation method based on target sequence pattern mining according to claim 4, characterized in that: In step S2-2, the pruning processing is performed based on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence, and specifically includes the following steps: 1) When the extension item is a positive extension item, the pruning processing is performed based on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence to obtain a candidate item after pruning screening, including the following steps: The current prefix sequence, the extension item and the bitmap of the maximum positive subsequence are subjected to logical AND operation to obtain a final bitmap, and the support degree of the final bitmap is calculated. If the support degree is less than a preset minimum support degree, pruning is directly performed. The positive extension item that is not subjected to pruning is taken as the candidate item after pruning screening. 2) When the extension item is a negative extension item, the negative extension item is not subjected to pruning. The candidate item after pruning screening and the negative extension item constitute a processed candidate item. 6.The commodity recommendation method based on target sequence pattern mining according to claim 2, characterized in that: Step S2-3 includes the following steps: S2-3-1, when the target query sequence is a positive target query sequence, the processed candidate item is subjected to pattern extension to obtain a sequence candidate pattern with a length of 2; S2-3-2, when the target query sequence is a negative target query sequence, the processed candidate item is subjected to pattern extension to obtain a sequence candidate pattern with a length of 2. In step S2-3-2, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence.

7. A commodity recommendation system for implementing the commodity recommendation method based on target sequence pattern mining according to claim 1, characterized in that: The data storage layer, the algorithm layer and the application layer are included: The data storage layer sequentially performs data cleaning, classification and serialization processing on the user shopping data to obtain an uncoded user shopping behavior sequence, and the user ID corresponding to the uncoded user shopping behavior sequence is counted into a shopping behavior sequence data table in chronological order; The data storage layer transmits the shopping behavior sequence data table to the algorithm layer; The algorithm layer encodes the user shopping behavior sequence to obtain an encoded shopping sequence, and mines a sequence candidate pattern with a length of 2m+1 from the encoded shopping sequence. The patterns not containing the target query sequence are deleted, and the remaining patterns are the target sequence patterns. The support degree of the target sequence patterns is calculated. In the process of mining the sequence candidate pattern with a length of 2m+1 from the encoded shopping sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence. The application layer is used for sorting the target sequence patterns according to the support degree, and then adjusting the content displayed on the platform interface in combination with the corresponding user ID.

Citation Information

Patent Citations

  • News recommendation method and system based on user behavior detection and computer equipment

    CN110489652A

  • Method and system for detecting abnormal operation of client based on Apriori algorithm

    CN117971921A