Commodity recommendation method and system based on negative sequence pattern loose constraint

By adopting a negative sequence pattern mining method with relaxed constraints that allow negative items within itemsets, the problem of soaring support calculation costs in existing technologies is solved. This enables the discovery of more effective negative sequence patterns in a short time, thereby improving the efficiency and accuracy of product recommendations.

CN122222711BActive Publication Date: 2026-07-21QILU 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
QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
Filing Date
2026-05-19
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing negative sequence pattern mining methods suffer from a surge in support calculation costs when constraints are relaxed, making it difficult to discover comprehensive and effective negative sequence patterns in a short period of time.

Method used

A product recommendation method based on relaxed constraints of negative sequence patterns is adopted, which allows negative items to appear within the itemset. By encoding shopping sequences, positive sequence candidate patterns of length 1 to m and negative sequence candidate patterns of length 1 to 2m+1 are mined under relaxed constraints. Valid patterns are retained by support calculation and frequent sequence judgment.

Benefits of technology

The system can discover more comprehensive negative sequence patterns in a shorter time, reduce the cost of support calculation, and improve the efficiency and accuracy of product recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122222711B_ABST
    Figure CN122222711B_ABST
Patent Text Reader

Abstract

The application discloses a commodity recommendation method and system based on negative sequence mode loose constraint, and belongs to the technical field of data mining. The application mines positive sequence candidate modes and negative sequence candidate modes based on coding shopping sequences under relatively loose constraint conditions; the relatively loose constraint condition refers to allowing negative items to appear in an item set; and in the process of calculating the support degree of the negative sequence candidate mode with a length greater than or equal to 2, firstly, it is judged whether the support degree of the positive partner corresponding to the negative subsequence of the candidate mode is greater than or equal to a preset minimum support degree; if yes, the negative sequence candidate mode corresponding to the positive partner is not a frequent sequence, the negative sequence candidate mode that is not a frequent sequence is deleted, the remaining negative sequence candidate modes with a length greater than or equal to 2 are reserved, and the support degrees of the negative sequence candidate modes are calculated; and all the negative sequence candidate modes with a support degree greater than or equal to the preset minimum support degree are taken as negative sequence modes. The application can complete the mining task in a relatively short time while mining more comprehensive negative sequence modes.
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 relaxed constraints of negative sequence patterns. Background Technology

[0002] With the development of e-commerce platforms, the variety and quantity of goods on online shopping platforms are growing exponentially. Existing methods for mining negative sequence patterns often employ strong constraint mechanisms, such as disallowing negative items within itemsets, to control complexity. However, relaxing these constraints by allowing negative items within itemsets can lead to a surge in support computation costs, making it difficult to discover comprehensive and effective negative sequence patterns in a shorter time. Therefore, this application provides a product recommendation method and system based on relaxed constraints for negative sequence patterns. Summary of the Invention

[0003] To address the shortcomings and deficiencies in the existing technology, this application proposes a product recommendation method and system based on relaxed constraints of negative sequence patterns.

[0004] To achieve the above-mentioned objectives, the present invention adopts the following technical solution: A product recommendation method based on relaxed constraints of negative sequence patterns includes the following steps: S1. Collect user shopping data and clean the collected user shopping data to obtain cleaned data; then, classify and serialize the cleaned data to obtain all uncoded behavior element types and uncoded user shopping behavior sequences; store all uncoded behavior element types; then, store the user shopping behavior sequences and their corresponding user IDs in chronological order. S2. Encode the unencoded user shopping behavior sequences and unencoded behavior elements; based on the encoded shopping sequences, mine positive sequence candidate patterns of length 1 to m and negative sequence candidate patterns of length 1 to 2m+1 under relatively relaxed constraints, where m is the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table; the relatively relaxed constraints mean that negative items are allowed within the itemset; calculate the support of the negative sequence candidate patterns, and take all negative sequence candidate patterns with support ≥ preset minimum support as negative sequence patterns. All negative sequence candidate patterns with support ≥ preset minimum support include negative sequence candidate patterns with support ≥ preset minimum support and length ≥ 2 and negative sequence candidate patterns with support ≥ preset minimum support and length 1 as negative sequence patterns; wherein, in the process of calculating the support of negative sequence candidate patterns with length ≥ 2, the negative sub-order of the negative sequence candidate patterns with length ≥ 2 must be determined first. If the support of the corresponding positive partner in the negative subsequence is greater than or equal to the preset minimum support, then the positive partner of the negative subsequence is determined to be a frequent sequence. Furthermore, if the negative sequence candidate pattern corresponding to the positive partner of the negative subsequence is not a frequent sequence, the negative sequence candidate pattern that is determined to be not a frequent sequence is deleted, and the remaining negative sequence candidate patterns are retained. The support of the remaining negative sequence candidate patterns with a length greater than or equal to 2 is calculated. The encoded shopping sequence is the encoded user shopping behavior sequence. The negative subsequence of the negative sequence candidate pattern refers to a sequence that contains any one negative item and all positive items in the negative sequence candidate pattern, and the order in which the negative items and all positive items appear remains unchanged. The positive partner of the negative subsequence of the negative sequence candidate pattern refers to the entire transformed sequence obtained after converting all negative items in the negative subsequence of the negative sequence candidate pattern into their corresponding positive items. S3. Sort the negative sequence patterns in descending order of their support, and then adjust the content displayed on the platform interface in conjunction with the corresponding user ID.

[0005] Preferably, in step S1, data cleaning refers to performing noise filtering, missing value filling, outlier removal, and format standardization on the collected user shopping data to obtain cleaned data.

[0006] Preferably, step S2 specifically includes the following steps: S2-1. Encode the unencoded user shopping behavior sequence and the unencoded behavior elements respectively. Obtain a positive sequence candidate pattern of length 1 based on the encoded shopping sequence. Obtain a negative sequence candidate pattern of length 1 based on the positive sequence candidate pattern of length 1. S2-2. Create a sequence ID inverted list, a bitmap index table, and a sequence hash table. Then, store positive sequence candidate patterns of length 1 and their corresponding sequence ID sets, as well as negative sequence candidate patterns of length 1 and their corresponding sequence ID sets, in the sequence ID inverted list. Store all positive sequence candidate patterns of length 1 and their corresponding bitmap indices, as well as all negative sequence candidate patterns of length 1 and their corresponding bitmap indices, in the bitmap index table. Store positive sequence candidate patterns of length 1 (as keys) and their corresponding support (as values), as well as negative sequence candidate patterns of length 1 (as keys) and their corresponding support (as values), in the sequence hash table. Negative sequence candidate patterns of length 1 with support ≥ the preset minimum support are designated as negative sequence patterns. S2-3. Concatenate positive sequence candidate patterns and negative sequence candidate patterns of length 1 under relatively relaxed constraints to obtain positive and negative sequence candidate patterns of length 2. Then, store the positive sequence candidate patterns of length 2 and their corresponding sequence ID sets, as well as the negative sequence candidate patterns of length 2 and their corresponding sequence ID sets, into a sequence ID inverted list. Store the positive sequence candidate patterns of length 2 and their corresponding bitmap indices, as well as the negative sequence candidate patterns of length 2 and their corresponding bitmap indices, into a bitmap index table. Store the positive sequence candidate patterns of length 2 and their corresponding support, as well as the negative sequence candidate patterns of length 2 and their corresponding support, into a sequence hash table. Select negative sequence candidate patterns of length 2 with support ≥ a preset minimum support as negative sequence patterns. S2-4. Based on the positive sequence candidate patterns of length 1, the negative sequence candidate patterns of length 1, the positive sequence candidate patterns of length 2, and the negative sequence candidate patterns of length 2, the process is recursively expanded according to the steps described in S2-3 until a positive sequence candidate pattern of length m and a negative sequence candidate pattern of length 2m+1 are obtained. Positive sequence candidate patterns of length ≥ 3 and their corresponding sequence ID sets, as well as negative sequence candidate patterns of length ≥ 3 and their corresponding sequence ID sets, are stored in a sequence ID inverted list. Positive sequence candidate patterns of length ≥ 3 and their corresponding bitmap indexes, as well as negative sequence candidate patterns of length ≥ 3 and their corresponding bitmap indexes, are stored in a bitmap index table. Positive sequence candidate patterns of length ≥ 3 and their corresponding support, as well as negative sequence candidate patterns of length ≥ 3 and their corresponding support, are stored in a sequence hash table. Negative sequence candidate patterns of length ≥ 3 and support ≥ a preset minimum support are designated as negative sequence patterns.

[0007] Preferably, step S2-1 specifically includes the following steps: S2-1-1. Encode the uncoded user shopping behavior sequences and the types of uncoded behavior elements; and assign a unique sequence ID to each coded shopping sequence; S2-1-2. Obtain the support of each item based on all coded shopping sequences. The support of each item is equal to the number of times "1" appears in the bitmap corresponding to each item. Items with support ≥ preset minimum support (preset minimum support is 2 in this embodiment) are selected as positive sequence candidate patterns of length 1. S2-1-3. Perform a negative transformation on the positive sequence candidate pattern of length 1 to obtain a negative sequence candidate pattern of length 1.

[0008] Preferably, in step S2-2, the sequence ID set corresponding to the positive sequence candidate pattern of length 1 is obtained as follows: First, retrieve which coded shopping sequences each positive sequence candidate pattern of length 1 is included in; then, construct a sequence ID set by the sequence IDs corresponding to the coded shopping sequences that contain the above-mentioned positive sequence candidate pattern of length 1.

[0009] Preferably, in step S2-2, establishing a bitmap index based on the sequence ID set in the inverted list of sequence IDs as positive sequence candidate patterns of length 1 specifically includes the following steps: A bitmap index is constructed based on the sequence ID set, where n in Sn, representing the sequence ID in the sequence ID set, represents the nth position of the bitmap index corresponding to the positive sequence candidate pattern of length 1. For a positive sequence candidate pattern of length 1 and the sequence ID that appears in its corresponding sequence ID set, its corresponding position in the bitmap index is set to 1. For a positive sequence candidate pattern of length 1 and the sequence ID that does not appear in its corresponding sequence ID set, its corresponding position in the bitmap index is set to 0.

[0010] Preferably, in steps S2-3, the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 are joined under relatively relaxed constraints. Specifically, if the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 occur simultaneously, that is, the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 are within the same itemset, then an intra-item join is performed; if the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 do not occur simultaneously, that is, the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 are not within the same itemset, then an out-of-item join is performed.

[0011] Preferably, in step S2-3, performing an out-of-item join between a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 specifically includes the following steps: appending a negative sequence candidate pattern of length 1 to the end of a positive sequence candidate pattern of length 1 without adding additional parentheses, indicating that the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 do not occur simultaneously, but rather occur sequentially; wherein, the constraint condition for the out-of-item join is: two negative sequence candidate patterns of length 1 are not allowed to be joined out-of-item, but can be joined within the item.

[0012] Preferably, in step S2-3, performing an out-of-item join on a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 includes the following steps: adding a bracket, and directly connecting the negative sequence candidate pattern of length 1 after the positive sequence candidate pattern of length 1 inside the bracket, indicating that the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 occur simultaneously; wherein, the constraint condition for an in-item join is: in an in-item join, it is not allowed for a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 obtained by inverting the positive sequence candidate pattern of length 1 to appear simultaneously in the same itemset.

[0013] Preferably, in steps S2-3, calculating the support of negative sequence candidate patterns of length 2 specifically includes the following steps: 1) Obtain all negative subsequences of a negative sequence candidate pattern of length 2. Then, obtain all corresponding positive partners based on the negative subsequences. Next, obtain the corresponding maximum positive subsequence based on the negative subsequences. The maximum positive subsequence is the sequence obtained by removing all negative terms from a negative sequence candidate pattern of length ≥ 2. Then, query the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the positive partners from the sequence ID inverted list to form the sequence ID set of the positive partners of the negative subsequence. Query the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the maximum positive subsequence from the sequence ID inverted list to form the sequence ID set of the maximum positive subsequence. Perform a difference operation between the sequence ID set of the maximum positive subsequence and the sequence ID set of the positive partners to obtain the sequence ID set of the negative subsequence. All negative subsequences and their corresponding sequence ID sets are counted in the sequence ID inverted list. 2) Based on the set of sequence IDs of the positive partners of the negative subsequence obtained in step 1), obtain the support of the positive partners of the negative subsequence. When the support of the positive partner is greater than or equal to the preset minimum support, the positive partner is determined to be a frequent sequence. When the positive partner is a frequent sequence, the negative sequence candidate pattern corresponding to the positive partner is determined to be a non-frequent sequence. The negative sequence candidate patterns of length 2 that are determined to be non-frequent sequences are deleted, and the remaining negative sequence candidate patterns of length 2 are retained. The support of the remaining negative sequence candidate patterns of length 2 is calculated.

[0014] Preferably, in step 2), the support of the remaining negative sequence candidate patterns of length 2 is calculated. The specific steps are as follows: First, obtain the sequence ID set corresponding to the negative sequence candidate patterns of length 2. Then, obtain the bitmap index of the negative sequence candidate patterns of length 2 based on the sequence ID set corresponding to the negative sequence candidate patterns of length 2. Finally, obtain the support of the negative sequence candidate patterns based on the bitmap index.

[0015] Preferably, in step 2), the sequence ID set corresponding to the negative sequence candidate pattern of length 2 is obtained by taking the intersection of the sequence ID set of the largest positive subsequence corresponding to the negative sequence candidate pattern of length 2 and the sequence ID set of the negative subsequence corresponding to the negative sequence candidate pattern of length 2, and then taking the union of the intersection and the sequence ID set of the positive partner of the negative sequence candidate pattern of length 2 to obtain the sequence ID set corresponding to the negative sequence candidate pattern of length 2.

[0016] Preferably, in steps S2-4, the method for calculating the support of negative sequence candidate patterns with a length ≥ 3 differs from the method for calculating the support of negative sequence candidate patterns with a length of 2 in that: (1) The method for obtaining the sequence ID set corresponding to negative sequence candidate patterns with a length of ≥3 is as follows: Calculate the union of the sequence IDs of all negative subsequences corresponding to the candidate sequence pattern. Then, take the intersection of the sequence IDs of the largest positive subsequence corresponding to the candidate negative sequence pattern and the union of these two sets. Finally, take the union of this intersection with the sequence IDs of the positive partners of the candidate negative sequence pattern to obtain the sequence ID set corresponding to the candidate negative sequence pattern. Here, the positive partner of the candidate negative sequence pattern refers to the sequence obtained by converting all negative terms in the candidate negative sequence pattern into their corresponding positive terms. Then, search the inverted sequence ID list for the sequence IDs of the positive candidate patterns that are completely identical to the positive partners of the candidate negative sequence pattern to form the sequence ID set of the positive partners of the candidate negative sequence pattern. (2) The method of obtaining the negative sequence candidate pattern with a length of ≥3 based on the sequence ID set corresponding to the negative sequence candidate pattern is the same as the method of obtaining the bitmap index based on the sequence ID set as the positive sequence candidate pattern with a length of 1 in step S2-2.

[0017] A product recommendation system based on relaxed constraints of negative sequence patterns is disclosed. This system implements the aforementioned product recommendation method based on relaxed constraints of negative sequence patterns. The system comprises a data storage layer, an algorithm layer, and an application layer. The data storage layer collects user shopping data and cleans it to obtain cleaned data. Then, it classifies and serializes the cleaned data to obtain all uncoded behavioral element categories and uncoded user shopping behavior sequences. All uncoded behavioral element categories are stored in an uncoded behavioral element category data table. Next, user shopping behavior sequences and their corresponding user IDs are stored in an uncoded shopping behavior sequence data table according to chronological order. The data storage layer then transmits the uncoded shopping behavior sequence data table and its corresponding uncoded element data table to the algorithm layer. The algorithm layer encodes the unencoded user shopping behavior sequences in the unencoded shopping behavior sequence data table and the unencoded 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, based on the encoded shopping sequences in the encoded shopping behavior sequence data table, positive sequence candidate patterns of length 1 to m and negative sequence candidate patterns of length 1 to 2m+1 are mined under relatively relaxed constraints. The relatively relaxed constraints allow negative items within itemsets, where m is the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table. Finally, the support of the negative sequence candidate patterns is calculated, specifically in the process of calculating the support of negative sequence candidate patterns with a length ≥ 2. First, it is necessary to determine whether the support of the positive partner corresponding to the negative subsequence of the negative sequence candidate pattern with a length ≥ 2 is ≥ a preset minimum support. If so (when the support of the positive partner corresponding to the negative subsequence is ≥ a preset minimum support), the positive partner corresponding to the negative subsequence is determined to be a frequent sequence, and the negative sequence candidate pattern corresponding to the positive partner corresponding to the negative subsequence is determined to be a non-frequent sequence. The negative sequence candidate patterns that are determined to be non-frequent sequences are deleted, and the remaining negative sequence candidate patterns are retained. The support of the remaining negative sequence candidate patterns with a length ≥ 2 is calculated. The negative sequence candidate patterns with a support ≥ a preset minimum support and a length ≥ 2, as well as the negative sequence candidate patterns with a length of 1, are stored in the negative sequence pattern table. The algorithm layer passes the negative sequence pattern table to the application layer. The application layer receives the negative sequence pattern table output by the algorithm layer, sorts the corresponding negative sequence patterns in the negative sequence pattern table according to their support levels, and then adjusts the content displayed on the platform interface based on the corresponding user ID.

[0018] Compared with the prior art, the beneficial technical effects of this application are as follows: The constraints set in this application are no longer limited to negative items only being allowed to appear outside the entire itemset. This application allows negative items to appear inside the itemset. This form of allowing negative items to appear inside the itemset can provide more effective negative sequence pattern support for product recommendation. In other words, the constraints set in this application are relatively lenient constraints at present, which can effectively solve the problem that most existing product recommendation systems are difficult to discover more negative sequence patterns due to relatively strict constraints (such as not allowing negative items to appear inside the itemset). Furthermore, this application obtains all negative subsequences of a negative sequence candidate pattern based on the negative sequence candidate pattern. Then, it obtains all corresponding positive partners based on the negative subsequences. Next, it obtains the corresponding maximum positive subsequence based on the negative subsequences. Then, it queries the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the positive partners from the sequence ID inverted list to form the sequence ID set of the positive partners of the negative subsequence. It also queries the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the maximum positive subsequence from the sequence ID inverted list to form the sequence ID set of the maximum positive subsequence. Performing a difference operation between the sequence ID set of the maximum positive subsequence and the sequence ID set of the positive partners yields the sequence ID set of the negative subsequence. Then, based on the positive partners of the negative subsequences... The set of sequence IDs is used to obtain the support of the positive partners of the negative subsequence. When the support of the positive partner of the negative subsequence is greater than or equal to the preset minimum support, the positive partner is determined to be a frequent sequence. When the positive partner is a frequent sequence, the negative sequence candidate pattern corresponding to the positive partner is determined to be a non-frequent sequence. The negative sequence candidate patterns of length 2 that are determined to be non-frequent sequences are deleted, and the remaining negative sequence candidate patterns of length 2 are retained. The support of the remaining negative sequence candidate patterns is calculated, and the negative sequence candidate patterns with support greater than or equal to the preset minimum support are stored as negative sequence patterns in the negative sequence pattern table. The above settings enable this application to mine more comprehensive negative sequence patterns and complete the task of negative sequence pattern mining in a shorter time. Attached Figure Description

[0019] Figure 1The results show the number of negative sequence patterns when performing negative sequence pattern mining on the DS1 dataset using the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application, under the condition that the minimum support threshold is 0.315, 0.320, 0.325, 0.330, and 0.335. Figure 2 The results show the number of negative sequence patterns when performing negative sequence pattern mining on the DS2 dataset using the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application, under the condition that the minimum support threshold is 0.315, 0.320, 0.325, 0.330, and 0.335. Figure 3 The results show the number of negative sequence patterns when performing negative sequence pattern mining on the DS3 dataset using the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application, under the condition that the minimum support threshold is 0.315, 0.320, 0.325, 0.330, and 0.335. Figure 4 The mining time test results for the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application when performing negative sequence pattern mining on the DS1 dataset under the condition of minimum support thresholds of 0.315, 0.320, 0.325, 0.330, and 0.335; Figure 5 The mining time test results of the SC-NSP method, NegI-NSP method, VM-NSP method and the method described in this application when mining negative sequence patterns on the DS2 dataset under the condition of minimum support threshold of 0.315, 0.320, 0.325, 0.330 and 0.335; Figure 6 The mining time test results of the SC-NSP method, NegI-NSP method, VM-NSP method and the method described in this application when mining negative sequence patterns on the DS3 dataset under the condition of minimum support threshold of 0.315, 0.320, 0.325, 0.330 and 0.335; Figure 7 The test results per unit time for the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application when performing negative sequence pattern mining on the DS1 dataset under the condition of minimum support thresholds of 0.315, 0.320, 0.325, 0.330, and 0.335; Figure 8The test results per unit time for the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application when performing negative sequence pattern mining on the DS2 dataset under the condition that the minimum support threshold is 0.315, 0.320, 0.325, 0.330, and 0.335; Figure 9 The results are unit-time test results of the SC-NSP method, NegI-NSP method, VM-NSP method, and the method described in this application when performing negative sequence pattern mining on the DS3 dataset under the condition that the minimum support threshold is 0.315, 0.320, 0.325, 0.330, and 0.335. Detailed Implementation

[0020] A product recommendation system based on relaxed constraints of negative sequence patterns includes a data storage layer, an algorithm layer, and an application layer. The method for product recommendation based on relaxed constraints of negative sequence patterns specifically includes the following steps: 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 all uncoded behavior element types and uncoded user shopping behavior sequences; all uncoded behavior element types are stored in the uncoded behavior element type data table; then, the user shopping behavior sequences and their corresponding user IDs are stored in the uncoded shopping behavior sequence data table in chronological order; the data storage layer transmits the uncoded shopping behavior sequence data table and its corresponding uncoded element data table to the algorithm layer; the user shopping data collected in this application is already arranged in chronological order.

[0021] In this application, data cleaning refers to the process of noise filtering, missing value imputation, outlier removal, and format standardization of the collected user shopping data to obtain cleaned data. For example, noise filtering refers to removing duplicate order records submitted by users to achieve the purpose of removing duplicate data; missing value imputation refers to filling in missing product category fields; outlier removal refers to filtering out obviously abnormal large-amount fraudulent consumption data to achieve the purpose of removing invalid data; and format standardization refers to unifying the timestamp and product code formats to achieve the purpose of unifying the data format.

[0022] In this application, the cleaned data is classified and serialized, including the following steps: (1) Create a user set for each user in the cleaned data and set a unique user ID for each user; (2) In the user set, count the types of behavioral elements involved by the user to achieve the purpose of classifying the cleaned data; (3) Store all behavioral element types (these behavioral element types are uncoded shopping types) in the cleaned data into the uncoded behavioral element type data table.

[0023] Table 1. Data table of uncoded behavioral elements

[0024] For example, if user U1 only made four types of purchases at different times: bread, milk, honey, and oatmeal, then the purchase category data table for user U1 would be as shown in Table 1. The uncoded behavior element categories in Table 1 include bread, milk, honey, and oatmeal; all the behavior element categories shown in Table 1 are uncoded behavior element categories.

[0025] 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 bread, milk, honey, and oatmeal constitutes four different types of behavioral elements. (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; For example, if user U1 buys bread and oatmeal in the same order within the first time period, then buys milk, and then buys bread again, then user U1's shopping data is transformed by the data storage layer into an uncoded user shopping behavior sequence <(buy bread, buy oatmeal), buy milk, buy bread>. In the second time period, user U1 first buys milk, then bread, and finally buys honey and oats in the same order. Then, user U1's shopping data is transformed by the data storage layer into an uncoded user shopping behavior sequence <buy milk, buy bread, (buy honey, buy oats)>. If user U1 purchases bread and milk in the same order during the third time period, and then purchases honey separately, then user U1's shopping data is transformed by the data storage layer into an uncoded user shopping behavior sequence <(purchase bread, purchase milk), purchase honey>.

[0026] In this application, the above-mentioned uncoded user shopping behavior sequence and its corresponding user ID are stored in a shopping behavior sequence data table, which is an uncoded shopping behavior sequence data table, as shown in Table 2.

[0027] Table 2 Uncoded Shopping Behavior Sequence Data Table

[0028] S2. The algorithm layer encodes the unencoded user shopping behavior sequences in the unencoded shopping behavior sequence data table and the unencoded 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, based on the encoded user shopping behavior sequences (hereinafter referred to as encoded shopping sequences) in the encoded shopping behavior sequence data table, positive sequence candidate patterns of length 1 to m and negative sequence candidate patterns of length 1 to 2m+1 are mined under relatively relaxed constraints. The relatively relaxed constraints allow negative items within the itemset, where m is the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table. Next, the support of the negative sequence candidate patterns is calculated. All negative sequence candidate patterns with support ≥ a preset minimum support are considered negative sequence patterns. All negative sequence candidate patterns with support ≥ a preset minimum support include those with support ≥ a preset minimum support. Negative sequence candidate patterns with support ≥ 2 and length ≥ 2, and negative sequence candidate patterns with support ≥ 1 and length ≥ 2 are defined as negative sequence patterns. When calculating the support of negative sequence candidate patterns with length ≥ 2, it is first determined whether the support of the positive partner corresponding to the negative subsequence of the negative sequence candidate pattern with length ≥ 2 is ≥ 1. If so (when the support of the positive partner corresponding to the negative subsequence is ≥ 1), the positive partner corresponding to the negative subsequence is determined to be a frequent sequence, and the negative sequence candidate pattern corresponding to the positive partner is determined to be a non-frequent sequence. The negative sequence candidate patterns determined to be non-frequent sequences are then deleted, and the remaining negative sequence candidate patterns are retained. The support of the remaining negative sequence candidate patterns with length ≥ 2 is calculated. Negative sequence candidate patterns with support ≥ 1 and length ≥ 2, and negative sequence candidate patterns with length ≥ 1 are both stored in a negative sequence pattern table. The algorithm layer then passes the negative sequence pattern table to the application layer. In this application, the length of the negative sequence candidate pattern obtained by recursive expansion must be ≤2m+1, where m represents the length of the longest encoded shopping sequence in the shopping sequence data table. This is because the generation of negative sequence candidate patterns with a length greater than 1 is generated by connecting positive sequence candidate patterns with a length of 1 and negative sequence candidate patterns with a length of 1. In this application, it is not allowed to directly connect negative sequence candidate patterns whose last item is negative with negative sequence candidate patterns with a length of 1. For example, if the last item of the current negative sequence candidate pattern is negative, this application does not allow the current negative sequence candidate pattern to be connected with a negative sequence candidate pattern with a length of 1, because the occurrence of two consecutive negative items is a meaningless shopping behavior. In this application, step S2 specifically includes the following steps: S2-1. Using the algorithm layer, encode the unencoded user shopping behavior sequences in the unencoded shopping behavior sequence data table and the unencoded behavior elements in the unencoded element data table output by the data storage layer, respectively, 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 shopping sequences in the encoded shopping behavior sequence data table, obtain positive sequence candidate patterns of length 1, and based on the positive sequence candidate patterns of length 1, obtain negative sequence candidate patterns of length 1; specifically including the following steps: S2-1-1. Use the algorithm layer to encode the uncoded user shopping behavior sequences in the uncoded shopping behavior sequence data table and the uncoded behavior element types in the uncoded element data table; and assign a unique sequence ID to each coded shopping sequence. For example, the uncoded behavioral elements in Table 1, namely buying bread, buying milk, buying honey, and buying oats, are encoded as a, b, c, and d, respectively. The encoded element data table and the encoded shopping behavior sequence data table are shown in Table 3 and Table 4, respectively. Table 3 Encoded Element Data Table

[0029] Table 4. Encoded Shopping Behavior Sequence Data

[0030] In this application, the coded shopping sequence is a sequence hereinafter referred to as the coded shopping sequence.

[0031] S2-1-2, Obtain positive sequence candidate patterns of length 1, specifically: Based on all coded shopping sequences recorded in the coded shopping behavior sequence data table, the support of each item is obtained. The support of each item is equal to the number of times "1" appears in the corresponding bitmap. Items with a support greater than or equal to a preset minimum support (2 in this embodiment) are selected as positive sequence candidate patterns of length 1. For example, based on <(a,d),b,a> recorded in the coded shopping behavior sequence data table...<b,a,(c,d)> From the three coded shopping sequences <(a,b),c>, we know that the bitmap corresponding to item a is [1, 1, 1], the bitmap corresponding to item b is [1, 1, 1], the bitmap corresponding to item c is [0, 1, 1], and the bitmap corresponding to item d is [1, 1, 0]. This means that the number of occurrences of "1" in the bitmap corresponding to item a is 3, indicating that the support for item a is 3. Similarly, we know that the support for item b is 3, the support for item c is 2, and the support for item d is 2. Therefore, the following positive sequence candidate patterns of length 1 are obtained: , , , ; S2-1-3. Perform a negative transformation on the positive sequence candidate pattern of length 1 to obtain a negative sequence candidate pattern of length 1. S2-2. Create a sequence ID inverted list, a bitmap index table, and a sequence hash table. Then, store positive sequence candidate patterns of length 1 and their corresponding sequence ID sets, as well as negative sequence candidate patterns of length 1 and their corresponding sequence ID sets, in the sequence ID inverted list. Store all positive sequence candidate patterns of length 1 and their corresponding bitmap indices, as well as all negative sequence candidate patterns of length 1 and their corresponding bitmap indices, in the bitmap index table. Store positive sequence candidate patterns of length 1 (as keys) and their corresponding support (as values), as well as negative sequence candidate patterns of length 1 (as keys) and their corresponding support (as values), in the sequence hash table. Then, store negative sequence candidate patterns of length 1 with support ≥ the preset minimum support as negative sequence patterns in the negative sequence pattern table. Specifically, 1) This application creates a sequence ID inverted list, which stores all positive sequence candidate patterns and their corresponding sequence ID sets, all negative sequence candidate patterns and their corresponding sequence ID sets, and all negative subsequences of negative sequence candidate patterns and their corresponding sequence ID sets. When the negative subsequences obtained from different negative sequence candidate patterns are the same, to avoid duplicate calculations, the sequence ID inverted list does not store the same negative subsequences repeatedly. Specifically, the sequence ID set corresponding to a positive sequence candidate pattern refers to the set of sequence IDs corresponding to the coded shopping sequence corresponding to the positive sequence candidate pattern; the sequence ID set corresponding to a negative sequence candidate pattern refers to the set of sequence IDs corresponding to the coded shopping sequence corresponding to the negative sequence candidate pattern; and the sequence ID set corresponding to the negative subsequences of a negative sequence candidate pattern refers to the set of sequence IDs corresponding to the coded shopping sequence corresponding to the negative subsequences of the negative sequence candidate pattern. The purpose of setting up the sequence ID inverted list in this application is to effectively avoid repeatedly scanning the shopping behavior sequence data table when calculating the support of negative sequence candidate patterns later. In this application, negative sequence candidate patterns of length 1 do not have negative subsequences; only negative sequence candidate patterns of length ≥ 2 have negative subsequences. The negative subsequence of a negative sequence candidate pattern refers to a sequence containing any one negative term and all positive terms from that negative sequence candidate pattern, and the order in which the negative terms and all positive terms appear remains unchanged. For example, a negative sequence candidate pattern is...<a,(¬b,c,d),¬e,f> If the negative terms in the candidate negative sequence pattern are ¬b and ¬e, and the positive terms are a, c, d, f, then the negative subsequences of the candidate negative sequence pattern are:<a,(¬b,c,d) ,f> and<a,(c,d),¬e,f> And like<f,a,(¬b,c,d)> This sequence is not a negative sequence candidate pattern.<a, (¬b,c,d),¬e,f> The negative subsequence, because<f,a,(¬b,c,d)> The order in which the negative terms and all positive terms appear in this sequence, relative to the candidate pattern of the negative sequence, is...<a, (¬b,c,d),¬e,f> Things have changed; Furthermore, in this application, the inverted sequence ID list stores all positive sequence candidate patterns and their corresponding sequence ID sets, as well as all negative sequence candidate patterns and their corresponding sequence ID sets, in a hierarchical manner. Different layers are used to store patterns of different lengths and their corresponding sequence ID sets. A pattern includes positive sequence candidate patterns, negative sequence candidate patterns, and negative subsequences of negative sequence candidate patterns. For example, the first layer of the inverted sequence ID list stores only positive sequence candidate patterns of length 1 and their corresponding sequence ID sets, negative sequence candidate patterns and their corresponding sequence ID sets, and negative subsequences of negative sequence candidate patterns and their corresponding sequence ID sets. The second layer of the inverted sequence ID list stores positive sequence candidate patterns of length 2 and their corresponding sequence ID sets, negative sequence candidate patterns and their corresponding sequence ID sets, and negative subsequences of negative sequence candidate patterns and their corresponding sequence ID sets. And so on, with the m-th layer of the inverted sequence ID list storing positive sequence candidate patterns of length m and their corresponding sequence ID sets. The sequence ID inverted list stores negative sequence candidate patterns of length m+1, their corresponding sequence ID sets, and negative subsequences of the negative sequence candidate patterns, along with their corresponding sequence ID sets. The (m+1)th level of the sequence ID inverted list stores negative sequence candidate patterns of length m+1, their corresponding sequence ID sets, and negative subsequences of the negative sequence candidate patterns, along with their corresponding sequence ID sets. The (m+2)th to (2m+1)th levels of the sequence ID inverted list only store negative sequence candidate patterns of the corresponding length and their corresponding sequence ID sets. For example, the (m+2)th level of the sequence ID inverted list only stores negative sequence candidate patterns of length m+2, their corresponding sequence ID sets, and negative subsequences of the negative sequence candidate patterns, along with their corresponding sequence ID sets. The (2m+1)th level only stores negative sequence candidate patterns of length 2m+1, their corresponding sequence ID sets, and negative subsequences of the negative sequence candidate patterns, along with their corresponding sequence ID sets. This is because the maximum length of the positive sequence candidate patterns mined in this application is m, and the maximum length of the negative subsequences of the negative sequence candidate patterns is m+1. 2) In this application, a bitmap index table is created to store all positive sequence candidate patterns and their corresponding bitmap indexes, as well as all negative sequence candidate patterns and their corresponding bitmap indexes. The purpose of establishing the bitmap index table is to facilitate bitmap calculation of the positive partners corresponding to the negative subsequences of the negative sequence candidate patterns to obtain the support of the positive partners. The positive partner corresponding to the negative subsequence of the negative sequence candidate pattern refers to the entire transformed sequence obtained after converting all negative terms in the negative subsequence of the negative sequence candidate pattern into their corresponding positive terms; for example, the negative subsequence corresponding to the negative sequence candidate pattern.<a,(¬b,c,d),f> and<a,(c,d), ¬e,f> The corresponding positive partners are<a,(b,c,d),f> and<a,(c,d),e,f> That is, the negative terms ¬b and ¬e in the corresponding negative subsequences of the negative sequence candidate pattern are transformed into the corresponding positive terms b and e respectively; 3) This application creates a sequence hash table to store all positive sequence candidate patterns and their corresponding support, and all negative sequence candidate patterns and their corresponding support. Positive sequence candidate patterns are used as keys, and their corresponding support is used as values. Similarly, negative sequence candidate patterns are also used as keys, and their corresponding support is used as values. The purpose of creating the sequence hash table in this application is to facilitate subsequent lookup of the support of the positive partners corresponding to the negative subsequences of negative sequence candidate patterns. In this application, all positive sequence candidate patterns of length 1 and their corresponding sequence ID sets are stored in a sequence ID inverted list. The sequence ID set corresponding to each positive sequence candidate pattern of length 1 is obtained as follows: First, it retrieves which coded shopping sequences each positive sequence candidate pattern of length 1 is included in. Then, it constructs a sequence ID set by including the sequence IDs corresponding to the coded shopping sequences containing the aforementioned positive sequence candidate patterns of length 1. For example, in the coded shopping sequence <(a,d),b,a> mentioned in the coded shopping behavior sequence data table, no positive sequence candidate pattern of length 1 appears. <c>,and<b,a,(c,d)> Both the coded shopping sequences <(a,b),c> and <(a,b),c> contain positive sequence candidate patterns of length 1. <c>That is, positive sequence candidate patterns of length 1. <c>If a positive sequence candidate pattern of length 1 appears in the coded shopping sequences with sequence IDs S2 and S3, then... <c>The corresponding sequence ID set is {S2, S3}; Similarly, positive sequence candidate patterns of length 1 If a positive sequence candidate pattern of length 1 appears in the coded shopping sequences with sequence IDs S1, S2, and S3, then... The corresponding sequence ID set is {S1, S2, S3}; positive sequence candidate patterns of length 1. If a positive sequence candidate pattern of length 1 appears in the coded shopping sequences with sequence IDs S1, S2, and S3, then... The corresponding set of sequence IDs is Candidate patterns of a positive sequence with a length of 1 If a positive sequence candidate pattern of length 1 appears in the coded shopping sequence with sequence IDs S1 and S2, then... The corresponding set of sequence IDs is ; The above positive sequence candidate patterns of length 1 and their corresponding sequence ID sets are stored in the sequence ID inverted list, and the resulting sequence ID inverted list is shown in Table 5.

[0032] Table 5. Inverted List of Sequence IDs

[0033] In this application, all positive sequence candidate patterns of length 1 and their corresponding bitmap indices are stored in a bitmap index table; wherein, the essence of the bitmap index is the same as that of the bitmap index. Figure 1 Similarly, the position of an item is represented using 1s and 0s. In this application, the bitmap index is obtained based on the inverted list of sequence IDs, and the length of the bitmap index is equal to the length of the longest coded shopping sequence in the shopping sequence data table. In this application, the bitmap index is established based on the set of sequence IDs in the inverted list of sequence IDs as positive sequence candidate patterns of length 1, specifically including the following steps: First, each positive sequence candidate pattern of length 1 and its corresponding sequence ID set are obtained through the inverted list of sequence IDs. Then, a bitmap index is constructed based on the sequence ID set. In this application, the number n in the sequence ID set (i.e., n in Sn representing the sequence ID, n≤m) represents the nth position of the bitmap index corresponding to the positive sequence candidate pattern of length 1. For a positive sequence candidate pattern of length 1 that appears in its corresponding sequence ID set, its corresponding position in the bitmap index is set to 1. For a positive sequence candidate pattern of length 1 that does not appear in its corresponding sequence ID set, its corresponding position in the bitmap index is set to 0. For example, in the inverted list of sequence IDs, there are positive sequence candidate patterns of length 1. <c>The corresponding sequence ID set is {S2, S3}. In this case, for Sn representing the sequence ID in the sequence ID set, n is 2 or 3. Then, there are positive sequence candidate patterns of length 1. <c>In the constructed bitmap index, the second and third digits are set to 1, for any positive sequence candidate patterns of length 1 that do not appear. <c>If the sequence ID is S1, then the position corresponding to S1 in the bitmap index is set to 0, that is, the first digit is set to 0. Then, a positive sequence candidate pattern of length 1 is obtained. <c>The bitmap index is constructed as

[011] ; Similarly, positive sequence candidate patterns of length 1 If the set of sequence IDs is {S1, S2, S3}, then the candidate patterns of positive sequences of length 1 are... The bitmap index is constructed as

[111] ; positive sequence candidate patterns of length 1. The set of sequence IDs is Then, positive sequence candidate patterns of length 1 The bitmap index is constructed as

[111] ; positive sequence candidate patterns of length 1. The set of sequence IDs is Then, positive sequence candidate patterns of length 1 The bitmap index is

[110] ; The above positive sequence candidate patterns of length 1 and their corresponding bitmap indices are stored in the bitmap index table, and the resulting bitmap index table is shown in Table 6.

[0034] Table 6 Bitmap Index Table

[0035] In this application, positive sequence candidate patterns of length 1 are used as keys in a sequence hash table, and the support corresponding to each positive sequence candidate pattern of length 1 is used as the value of the sequence hash table. The sequence hash table is essentially a key-value mapping, with positive sequence candidate patterns of length 1 as keys and the support corresponding to each positive sequence candidate pattern of length 1 as the value. The support of each positive sequence candidate pattern of length 1 is calculated using a bitmap index. Specifically, the number of times "1" appears in the bitmap index of a positive sequence candidate pattern of length 1 is the support of that positive sequence candidate pattern. For example, the positive sequence candidate patterns of length 1 in Table 6 <c>The bitmap index is

[011] . <c>The number 1 appears a total of 2 times in the bitmap index, then... <c>The support score is 2, while the positive sequence candidate pattern of length 1 is... <c>The corresponding term is c, which means, <c>The value in the sequence hash table is 2, and the key is [c]. Similarly, the positive sequence candidate patterns of length 1 in Table 6< / c> < / c> < / c> < / c> < / c> The bitmap index is

[111] . The number 1 appears a total of 3 times in the bitmap index, then... The support score is 3, while the positive sequence candidate pattern of length 1... The corresponding term is 'a', which means that... The value in the sequence hash table is 3, and the key is [a].

[0036] Table 7 Sequence Hash Table

[0037] Similarly, the positive sequence candidate patterns of length 1 in Table 6 The bitmap index is

[111] . The number 1 appears a total of 3 times in the bitmap index, then... The support score is 3, while the positive sequence candidate pattern of length 1... The corresponding term is 'a', which means that... The value in the sequence hash table is 3, and the key is ; Similarly, the positive sequence candidate patterns of length 1 in Table 6 <d>The bitmap index is

[110] . <d>The number 1 appears a total of 2 times in the bitmap index, then... <d>The support score is 2, while the positive sequence candidate pattern of length 1 is... <d>The corresponding term is d, which means, <d>The value in the sequence hash table is 2, and the key is [d]. The keys and values ​​corresponding to the above positive sequence candidate patterns of length 1 are stored in a sequence hash table, as shown in Table 7.

[0038] In this application, negative sequence candidate patterns of length 1 and their corresponding sequence ID sets are stored in a sequence ID inverted list; wherein, the method of obtaining the sequence ID set corresponding to the negative sequence candidate pattern of length 1 is the same as the method of obtaining the sequence ID set corresponding to the positive sequence candidate pattern of length 1. In this application, all negative sequence candidate patterns of length 1 and their corresponding bitmap indices are stored in a bitmap index table; wherein, the method of establishing bitmap indexes for negative sequence candidate patterns of length 1 is the same as the method of establishing bitmap indexes for positive sequence candidate patterns of length 1. In this application, all negative sequence candidate patterns of length 1 (as keys) and their support (as values) are stored in a sequence hash table. The support of a negative sequence candidate pattern of length 1 is obtained based on the support of a positive sequence candidate pattern of length 1. Specifically, the support of a negative sequence candidate pattern of length 1 is obtained by subtracting the support of a positive sequence candidate pattern of length 1 from the length of the bitmap index. Negative sequence candidate patterns of length 1 with a support greater than or equal to a preset minimum support are stored as negative sequence patterns in a negative sequence pattern table. S2-3. Concatenate positive sequence candidate patterns and negative sequence candidate patterns of length 1 under relatively relaxed constraints to obtain positive and negative sequence candidate patterns of length 2. Then, store the positive sequence candidate patterns of length 2 and their corresponding sequence ID sets, as well as the negative sequence candidate patterns of length 2 and their corresponding sequence ID sets, into a sequence ID inverted list. The method for obtaining the sequence ID set corresponding to the positive sequence candidate patterns of length 2 is the same as the method for obtaining the sequence ID set corresponding to the positive sequence candidate patterns of length 1. Store the positive sequence candidate patterns of length 2 and their corresponding bitmap indices, as well as the negative sequence candidate patterns of length 2 and their corresponding bitmap indices, into a bitmap index table. The method for creating bitmap indices for the positive sequence candidate patterns of length 2 is the same as the method for creating bitmap indices for the positive sequence candidate patterns of length 1. The bitmap indexing method for candidate sequence patterns is the same. Positive candidate sequence patterns of length 2 and their corresponding support, as well as negative candidate sequence patterns of length 2 and their corresponding support, are stored in a sequence hash table. Positive candidate sequence patterns of length 2 serve as keys, and their corresponding support serves as values. Similarly, negative candidate sequence patterns of length 2 also serve as keys, and their corresponding support serves as values. The support of positive candidate sequence patterns of length 2 is obtained in the same way as that of positive candidate sequence patterns of length 1. The support of negative candidate sequence patterns of length 2 is obtained based on the support of positive candidate sequence patterns of length 2. Negative candidate sequence patterns of length 2 with support ≥ a preset minimum support are stored as negative sequence patterns in a negative sequence pattern table. Since some shopping behaviors occur simultaneously in real life, this application considers whether positive and negative sequence candidate patterns of length 1 occur simultaneously when joining them under relatively relaxed constraints. If they do, i.e., they are within the same itemset, an intra-item join is performed. If they do not occur simultaneously, i.e., they are not within the same itemset, an out-of-item join is performed. The specific methods for intra-item and out-of-item joins are as follows: External join: When a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 do not occur simultaneously, perform an external join directly between them. This includes the following steps: append the negative sequence candidate pattern of length 1 to the positive sequence candidate pattern of length 1 without adding parentheses, indicating that the two patterns occurred sequentially, not simultaneously. For example, the positive sequence candidate pattern of length 1...< / d> < / d> < / d> < / d> < / d> Connecting to a negative sequence candidate pattern <¬b> of length 1 directly connects the negative sequence candidate pattern <¬b> of length 1 to the positive sequence candidate pattern of length 1. Behind it, a negative sequence candidate pattern <a, ¬b> with a length of 2 is formed; Intra-item connection: When a positive sequence candidate pattern with a length of 1 and a negative sequence candidate pattern with a length of 1 occur simultaneously, directly connect the positive sequence candidate pattern with a length of 1 and the negative sequence candidate pattern with a length of 1 inside an item set, including the following steps: Add a parenthesis, and directly connect the negative sequence candidate pattern with a length of 1 behind the positive sequence candidate pattern with a length of 1 inside the parenthesis, indicating that the positive sequence candidate pattern with a length of 1 and the negative sequence candidate pattern with a length of 1 occur simultaneously; for example, when the positive sequence candidate pattern <a with a length of 1 and the negative sequence candidate pattern <¬b> with a length of 1 are intra-item connected, it is the positive sequence candidate pattern with a length of 1 Create an itemset with the negative sequence candidate patterns of length 1, and directly connect the negative sequence candidate patterns of length 1 to the positive sequence candidate patterns of length 1. Following this, a negative sequence candidate pattern <(a,¬b)> of length 2 is formed.

[0039] In addition, constraints are also set for intra-item links and external links in this application, as follows: (1) Two negative sequence candidate patterns of length 1 are not allowed to be joined outside the item, but can be joined inside the item; for example, negative sequence candidate patterns <¬b> and negative sequence candidate patterns <¬c> of length 1 cannot be joined outside the item, but can be joined inside the item. (2) In an intra-item join, it is not allowed for a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 obtained by inverting the positive sequence candidate pattern of length 1 to appear in the same itemset simultaneously; for example, <(a,¬b)> means that in the same itemset, a positive sequence candidate pattern of length 1 is not allowed to appear simultaneously. Simultaneous occurrence of positive sequence candidate patterns of length 1 It did not happen, but This means that within the same itemset, there are positive sequence candidate patterns of length 1. Simultaneous occurrence of positive sequence candidate patterns of length 1 It didn't happen, obviously. The meanings expressed are contradictory. Therefore, in the intra-item join, this application does not allow a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 obtained by inverting the positive sequence candidate pattern of length 1 to appear in the same itemset at the same time. Clearly, the above-mentioned constraints mean that this application is no longer limited to negative items only being allowed to appear outside the entire itemset. This application allows negative items to appear inside the itemset. This form of allowing negative items to appear inside the itemset allows this application to discover more negative sequence patterns and provide more effective negative sequence pattern support for product recommendation.

[0040] In this application, the support of negative sequence candidate patterns of length 2 is calculated, specifically including the following steps: 1) Obtain all negative subsequences of a negative sequence candidate pattern of length 2. Then, obtain all corresponding positive partners based on the negative subsequences. Next, obtain the corresponding maximum positive subsequence based on the negative subsequences. The maximum positive subsequence is the sequence obtained by removing all negative terms from a negative sequence candidate pattern of length ≥ 2. Then, query the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the positive partners from the sequence ID inverted list to form the sequence ID set of the positive partners of the negative subsequence. Query the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the maximum positive subsequence from the sequence ID inverted list to form the sequence ID set of the maximum positive subsequence. Perform a difference operation between the sequence ID set of the maximum positive subsequence and the sequence ID set of the positive partners to obtain the sequence ID set of the negative subsequence. All negative subsequences and their corresponding sequence ID sets are counted in the sequence ID inverted list. For example, a negative subsequence of a negative sequence candidate pattern of length 2 is:<c,¬e> The positive partner of the negative subsequence is<c,e> The largest positive subsequence corresponding to the negative subsequence is <c>Here, the maximum positive subsequence refers to the sequence obtained by removing all negative terms from a negative sequence candidate pattern of length ≥ 2; assuming that the maximum positive subsequence of the above negative subsequence... <c>The set of sequence IDs is {S1, S2, S3, S5, S6, S7}, and the positive partner of this negative subsequence is...<c,e> The sequence ID set is {S2, S5, S7}, meaning that the positive partners of the above negative subsequences are...<c,e> It only appears in S2, S5, and S7, that is, the negative subsequence of this negative sequence candidate pattern.<c,¬e> It only appears in S2, S5, and S7, among which, the negative subsequence<c,¬e> This indicates a situation where behavior element c does not occur, but behavior element e occurs. Therefore, this application defines the maximum positive subsequence of the aforementioned negative subsequence. <c>The set of sequence IDs and the positive partners of the above negative subsequences<c,e> The difference operation is performed on the sequence ID set, that is, the difference operation is performed between {S1,S2,S3,S5,S6,S7} and {S2,S5,S7}, and the difference result is {S1,S3,S6}. The difference result represents the negative subsequence for the negative sequence candidate pattern.<c,¬e> The set of sequence IDs, where,<c,¬e> This indicates that after behavior element c occurs, behavior element e does not occur. 2) Based on the set of sequence IDs of the positive partners of the negative subsequence obtained in step 1), obtain the support of the positive partners of the negative subsequence. When the support of the positive partner is greater than or equal to the preset minimum support, the positive partner is determined to be a frequent sequence. When the positive partner is a frequent sequence, the negative sequence candidate pattern corresponding to the positive partner is determined to be a non-frequent sequence. Delete the negative sequence candidate patterns of length 2 that are determined to be non-frequent sequences, and keep the remaining negative sequence candidate patterns of length 2. Calculate the support of the remaining negative sequence candidate patterns of length 2. Store the negative sequence candidate patterns with support greater than or equal to the preset minimum support as negative sequence patterns in the negative sequence pattern table. In this application, when the positive partner is a frequent sequence, the reason why the negative sequence candidate pattern corresponding to the positive partner is determined not to be a frequent sequence is as follows: For a negative sequence candidate pattern<c,¬f> If negative sequence candidate pattern<c,¬f> negative subsequence<c,¬f> Corresponding positive partner<c,f> If it's a frequent sequence, it means that the number of times the condition f occurs after c is greater than or equal to the preset minimum support. This also means that the number of times the condition f does not occur after c is less than the preset minimum support. Therefore, it's related to the positive pair.<c,f> Corresponding negative subsequence<c,¬f> If it is less than the minimum support, then it is related to the negative subsequence.<c,¬f> Corresponding negative sequence candidate patterns<c,¬f> The support is also less than the minimum support; therefore, the negative sequence candidate pattern...<c,¬f> It is not a frequent sequence.

[0041] In this application, the support of the remaining negative sequence candidate patterns of length 2 is calculated through the following steps: First, the set of sequence IDs corresponding to the negative sequence candidate patterns of length 2 is obtained. Then, the bitmap index of the negative sequence candidate patterns of length 2 is obtained based on the set of sequence IDs corresponding to the negative sequence candidate patterns of length 2. Finally, the support of the negative sequence candidate patterns is obtained based on the bitmap index. The method for obtaining the sequence ID set corresponding to a negative sequence candidate pattern of length 2 is as follows: The set of sequence IDs corresponding to the longest positive subsequence of a negative sequence candidate pattern of length 2 is obtained by taking the intersection of the set of sequence IDs of the longest negative subsequence candidate pattern of length 2 and the set of sequence IDs of the longest negative subsequence candidate pattern of length 2. Then, the union of this intersection with the set of sequence IDs of the positive partners of the longest negative sequence candidate pattern of length 2 is taken. Here, the positive partners of the negative sequence candidate pattern refer to the sequences obtained by converting all negative terms in the negative sequence candidate pattern into their corresponding positive terms. For example, in a negative sequence candidate pattern of length 2...<c,¬e> The positive partners of the above negative sequence candidate patterns of length 2 are<c,e> Then, the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the positive partners of the negative sequence candidate patterns are retrieved from the inverted list of sequence IDs to form the set of sequence IDs of the positive partners of the negative sequence candidate patterns. For example, for negative sequence candidate patterns<c,¬e> The right partner is<c,e> The largest positive subsequence is <c>The negative subsequence is<c,¬e> Assume that the set of sequence IDs of the positive partners of the above negative sequence candidate pattern is {S3, S6}, the set of sequence IDs of the largest positive subsequence is {S1, S2, S3, S5, S6, S7}, and the negative subsequence...<c,¬e> If the set of sequence IDs is {S1, S3, S6, S7}, then the union of the set of sequence IDs of the negative subsequences is {S1, S3, S6, S7}. If a negative sequence candidate pattern of length 2 has only one negative subsequence, then the negative sequence candidate pattern...<c,¬e> The corresponding sequence ID set is {S1,S2,S3 S5,S6,S7}∩{S1,S3,S6,S7}∪{S3,S6}={S2,S3,S5,S6}; The method of obtaining a bitmap index for a negative sequence candidate pattern of length 2 based on the sequence ID set corresponding to the negative sequence candidate pattern of length 2 is the same as the method of establishing a bitmap index for a positive sequence candidate pattern of length 1 based on the sequence ID set in step S2-2.

[0042] S2-4. Based on the positive sequence candidate patterns of length 1, the negative sequence candidate patterns of length 1, the positive sequence candidate patterns of length 2, and the negative sequence candidate patterns of length 2, the process is recursively expanded according to the steps described in S2-3 until a positive sequence candidate pattern of length m and a negative sequence candidate pattern of length 2m+1 are obtained; where m is the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table; in this application, the length of the sequence candidate pattern is set to 2m+1 for the following reason: 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 sequence pattern corresponding to 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; Then, positive sequence candidate patterns with a length ≥ 3 and their corresponding sequence ID sets, as well as negative sequence candidate patterns with a length ≥ 3 and their corresponding sequence ID sets, are stored in a sequence ID inverted list. The method for obtaining the sequence ID set corresponding to a positive sequence candidate pattern with a length ≥ 3 is the same as the method for obtaining the sequence ID set corresponding to a positive sequence candidate pattern with a length of 1. Positive sequence candidate patterns with a length ≥ 3 and their corresponding bitmap indices, as well as negative sequence candidate patterns with a length ≥ 3 and their corresponding bitmap indices, are stored in a bitmap index table. The method for creating bitmap indexes for positive sequence candidate patterns with a length ≥ 3 is the same as the method for creating bitmap indexes for positive sequence candidate patterns with a length of 1. Positive sequence candidate patterns and their corresponding support, as well as negative sequence candidate patterns of length ≥ 3 and their corresponding support, are stored in a sequence hash table. Positive sequence candidate patterns of length ≥ 3 serve as keys, and their corresponding support serves as values. Similarly, negative sequence candidate patterns of length ≥ 3 also serve as keys, and their corresponding support serves as values. The support of positive sequence candidate patterns of length ≥ 3 is obtained in the same way as that of positive sequence candidate patterns of length 1. Negative sequence candidate patterns of length ≥ 3 with support ≥ a preset minimum support are stored as negative sequence patterns in a negative sequence pattern table. The algorithm layer outputs the negative sequence pattern table to the application layer.

[0043] In this application, the method for calculating the support of negative sequence candidate patterns with a length of ≥3 differs from the method for calculating the support of negative sequence candidate patterns with a length of 2 in that: (1) The method for obtaining the sequence ID set corresponding to negative sequence candidate patterns with a length of ≥3 is as follows: Calculate the union of the sequence IDs of all negative subsequences corresponding to the candidate sequence pattern. Then, take the intersection of the sequence IDs of the largest positive subsequence corresponding to the candidate negative sequence pattern and the union of these two sets. Finally, take the union of this intersection with the sequence IDs of the positive partners of the candidate negative sequence pattern to obtain the sequence ID set corresponding to the candidate negative sequence pattern. Here, the positive partner of the candidate negative sequence pattern refers to the sequence obtained by converting all negative terms in the candidate negative sequence pattern into their corresponding positive terms. Then, search the inverted sequence ID list for the sequence IDs of the positive candidate patterns that are completely identical to the positive partners of the candidate negative sequence pattern to form the sequence ID set of the positive partners of the candidate negative sequence pattern. (2) The method of obtaining the negative sequence candidate pattern with a length of ≥3 based on the sequence ID set corresponding to the negative sequence candidate pattern is the same as the method of obtaining the bitmap index based on the sequence ID set as the positive sequence candidate pattern with a length of 1 in step S2-2.

[0044] The constraints set in this application allow negative items within itemsets. In other words, the constraints set in this application are relatively lenient, effectively addressing the limitation of existing product recommendation systems, which often struggle to discover a greater number of negative sequence patterns due to stricter constraints (such as disallowing negative items within itemsets). Based on these lenient constraints, this application can discover a greater number of negative sequence patterns, meaning a more comprehensive understanding of these patterns. Furthermore, this application obtains all negative subsequences of a negative sequence candidate pattern, then obtains all corresponding positive partners based on the negative subsequences, and then obtains the corresponding maximum positive subsequence based on the negative subsequences. Finally, it queries the sequence ID inverted list to find the sequence IDs of positive sequence candidate patterns that are completely identical to their positive partners, forming a set of sequence IDs for the positive partners of the negative subsequences. Finally, it queries the sequence ID inverted list to find the sequence IDs of positive subsequences that are completely identical to the maximum positive subsequence. The sequence IDs corresponding to the candidate sequence patterns constitute the sequence ID set of the largest positive subsequence. The sequence ID set of the largest positive subsequence is obtained by performing a difference operation with the sequence ID set of the positive partners. Then, based on the sequence ID set of the positive partners of the negative subsequence, the support of the positive partners of the negative subsequence is obtained. When the support of the positive partner of the negative subsequence is greater than or equal to a preset minimum support, the positive partner is determined to be a frequent sequence. If the positive partner is a frequent sequence, the corresponding negative sequence candidate pattern is determined to be a non-frequent sequence. Negative sequence candidate patterns of length 2 that are determined to be non-frequent sequences are deleted, and the remaining negative sequence candidate patterns of length 2 are retained. The support of the remaining negative sequence candidate patterns is calculated, and negative sequence candidate patterns with support greater than or equal to the preset minimum support are stored as negative sequence patterns in the negative sequence pattern table. This setup enables this application to mine more comprehensive negative sequence patterns while completing the task of negative sequence pattern mining in a shorter time.

[0045] S3. The application layer receives the negative sequence pattern table output by the algorithm layer. The application layer sorts the corresponding negative sequence patterns in the table according to their support levels, and then adjusts the content displayed on the platform interface based on the corresponding user ID. Simultaneously, the adjustment records are saved, a log file is generated, and transmitted to the data storage layer for archiving. In this application, the application layer automatically optimizes the platform content display strategy based on the negative sequence patterns (which accurately reflect user behavior preferences) and their corresponding support levels, 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 records the purchase behavior and updates 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, the negative sequence patterns output by the algorithm layer...<a,¬b,c> The higher the support level, the more frequently users buy bread, not milk, and buy honey. In this case, the product recommendation system, combined with the corresponding user ID, will display more bread and honey on the platform interface, and less milk.

[0046] test: This application uses the IBM Data Generator to generate datasets DS1, DS2, and DS3 for testing. The IBM Data Generator can be obtained from: https: / / www.philippe-fournier-viger.com / spmf / index.php?link=datasets.php. This application controls the data size, shopping sequence complexity, and pattern distribution of datasets DS1, DS2, and DS3 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 that can be obtained through pattern concatenation; DB: number of sequence patterns; N: number of different items. The DS1 dataset in this application was obtained by configuring the parameters of the IBM data generator as C=8, T=8, S=3, I=8, DB=10K (where 10K=10000) and N=100.

[0047] The DS2 dataset in this application was obtained by configuring the parameters of the IBM data generator as C=8, T=8, S=4, I=8, DB=10K (where 10K=10000) and N=100.

[0048] The DS3 dataset in this application was obtained by configuring the parameters of the IBM data generator as C=8, T=8, S=5, I=8, DB=10K (where 10K=10000) and N=100.

[0049] To verify the effectiveness of the recommendation method described in this application (hereinafter referred to as the LC-NSP method), this application selected three existing recommendation methods for testing on the above three datasets (dataset DS1, dataset DS2, and dataset DS3); among them, the existing recommendation methods are the SC-NSP method (from the paper "SC-NSP: An efficient algorithm for mining negative sequential patterns"); the NegI-NSP method (from the paper "NegI-NSP: Negative Sequential Pattern Mining based on loose constraints"); and the VM-NSP method (from the paper "VM-NSP: Vertical Negative Sequential Pattern Mining with LooseNegative Element Constraints").

[0050] Specifically: Test 1: This application tested the four methods (LC-NSP, SC-NSP, NegI-NSP, and VM-NSP) on three different datasets under the same support threshold to mine the number of negative sequence patterns. The test results are as follows:< / c> < / c> < / c> < / c> Figures 1 to 3 As shown; Test 2: This application tested the mining time of the above four methods (LC-NSP, SC-NSP, NegI-NSP, and VM-NSP) on three different datasets under the same support threshold. The test results are as follows: Figures 4 to 6 As shown; Test 3: This application tested the above four methods (LC-NSP, SC-NSP, NegI-NSP, and VM-NSP) on three different datasets under the same support threshold to mine negative sequence patterns per unit time. The test results are as follows: Figures 7 to 9 As shown; As shown in Figure 1, when the dataset DS1 was tested and the minimum support was set to 0.315, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method were 1503, 29, 34, and 454, respectively. When the support is increased to 0.320, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 1045, 25, 30, and 436, respectively. When the support is increased to 0.325, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 789, 21, 24, and 418, respectively. When the support is increased to 0.330, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 711, 19, 20, and 366, respectively. When the support is increased to 0.335, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 634, 17, 18, and 330, respectively. Clearly, under the DS1 dataset and the various support conditions mentioned above, the number of negative sequence patterns mined by the LC-NSP method is significantly higher than that of the three existing methods.

[0051] from Figure 2 It can be seen that when the dataset DS2 is tested and the support is 0.315, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method and VM-NSP method are 1038, 25, 30 and 448 respectively. When the support is increased to 0.320, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 949, 24, 28, and 402, respectively. When the support is increased to 0.325, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 937, 21, 25, and 390, respectively. When the support is increased to 0.330, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 935, 19, 21, and 375, respectively. When the support is increased to 0.335, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 769, 17, 19, and 320, respectively.

[0052] Clearly, under the DS2 dataset and the various support conditions mentioned above, the number of negative sequence patterns mined by the LC-NSP method is significantly higher than that of the three existing methods.

[0053] from Figure 3 It can be seen that when the dataset DS3 is tested and the support is 0.315, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method and VM-NSP method are 1152, 25, 28 and 469 respectively. When the support is increased to 0.320, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 1047, 22, 25, and 451, respectively. When the support is increased to 0.325, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 1025, 21, 24, and 437, respectively. When the support is increased to 0.330, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 850, 18, 20, and 371, respectively. When the support is increased to 0.335, the negative sequence patterns mined by the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 769, 17, 19, and 328, respectively.

[0054] Clearly, under the DS3 dataset and the various support conditions mentioned above, the number of negative sequence patterns mined by the LC-NSP method is significantly higher than that of the three existing methods.

[0055] from Figures 1 to 3 The results show that when tested on datasets DS1, DS2, and DS3, the LC-NSP method can mine the most negative sequence patterns under all the above support levels, and the richness of pattern mining is significantly better than the SC-NSP, NegI-NSP, and VM-NSP methods.

[0056] As shown in Figure 4, when testing the DS1 dataset with a support of 0.315, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 2985 milliseconds, 377 milliseconds, 435 milliseconds, and 41022 milliseconds, respectively. When the support is increased to 0.320, the mining times of the LC-NSP method, SC-NSP method, NegI-NSP method and VM-NSP method are 3001 milliseconds, 264 milliseconds, 257 milliseconds and 40107 milliseconds, respectively. When the support is increased to 0.325, the mining times of the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are 1538 milliseconds, 256 milliseconds, 232 milliseconds, and 37256 milliseconds, respectively. When the support is increased to 0.330, the mining times of the LC-NSP method, SC-NSP method, NegI-NSP method and VM-NSP method are 1255 milliseconds, 226 milliseconds, 204 milliseconds and 31938 milliseconds, respectively. When the support is increased to 0.335, the mining times of the LC-NSP method, SC-NSP method, NegI-NSP method, and VM-NSP method are reduced to 1048 milliseconds, 198 milliseconds, 183 milliseconds, and 27301 milliseconds, respectively. Clearly, on the DS1 dataset, the mining time of the VM-NSP method is much longer than that of the other three methods across all support levels. The mining time of the LC-NSP method is second, but it is also significantly longer than that of the SC-NSP and NegI-NSP methods. This is related to the fact that the LC-NSP and VM-NSP methods mined significantly more negative sequence patterns.

[0057] As shown in Figure 5, when testing the DS2 dataset with a support of 0.315, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 3798 milliseconds, 379 milliseconds, 338 milliseconds, and 38900 milliseconds, respectively. When the support is 0.320, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 2631 milliseconds, 227 milliseconds, 226 milliseconds, and 32748 milliseconds, respectively. When the support is 0.325, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 2790 milliseconds, 226 milliseconds, 205 milliseconds, and 31078 milliseconds, respectively. When the support is 0.330, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 3046 milliseconds, 203 milliseconds, 220 milliseconds, and 28921 milliseconds, respectively. When the support is 0.335, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 2079 milliseconds, 185 milliseconds, 168 milliseconds, and 23758 milliseconds, respectively. Clearly, on the DS2 dataset, the mining time of the VM-NSP method is significantly longer than that of the other three methods across all support levels. The mining time of the LC-NSP method is the second longest, but it is also significantly longer than that of the SC-NSP and NegI-NSP methods. This is related to the fact that the LC-NSP and VM-NSP methods mined significantly more negative sequence patterns.

[0058] As shown in Figure 6, when testing the DS3 dataset with a support of 0.315, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 3764 milliseconds, 360 milliseconds, 292 milliseconds, and 33952 milliseconds, respectively. When the support is 0.320, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 3475 milliseconds, 213 milliseconds, 205 milliseconds, and 33599 milliseconds, respectively. When the support is 0.325, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 3049 milliseconds, 198 milliseconds, 189 milliseconds, and 34166 milliseconds, respectively. When the support is 0.330, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 2008 milliseconds, 176 milliseconds, 165 milliseconds, and 25964 milliseconds, respectively. When the support is 0.335, the mining times for the LC-NSP, SC-NSP, NegI-NSP, and VM-NSP methods are 1758 milliseconds, 170 milliseconds, 167 milliseconds, and 23256 milliseconds, respectively. Clearly, on the DS3 dataset, the mining time of the VM-NSP method is much longer than that of the other three methods across all support levels. The mining time of the LC-NSP method is second, but it is also significantly longer than that of the SC-NSP and NegI-NSP methods. This is related to the fact that the LC-NSP and VM-NSP methods mined significantly more negative sequence patterns.

[0059] In the comparative experiment on mining time, it was found that the mining time of the VM-NSP method was much longer than that of the LC-NSP, SC-NSP and NegI-NSP methods. This phenomenon further indicates that the VM-NSP method has a significant disadvantage in mining efficiency when mining negative sequences.

[0060] from Figure 7 It can be seen that when tested on the DS1 dataset with a support of 0.315, the VM-NSP method has a unit mining time of 84.40741 milliseconds / data, which is significantly higher than the unit mining time of the LC-NSP, SC-NSP, and NegI-NSP methods. Among them, the unit mining times of the LC-NSP, SC-NSP, and NegI-NSP methods are 1.94463 milliseconds / data, 5.71212 milliseconds / data, and 7.13115 milliseconds / data, respectively. When the support is increased to 0.335, the unit mining time of the VM-NSP method is 77.55966 milliseconds / record; the unit mining times of the LC-NSP method, SC-NSP method, and NegI-NSP method are 1.59756 milliseconds / record, 4.69231 milliseconds / record, and 4.95000 milliseconds / record, respectively. Clearly, on the DS1 dataset, the unit mining time of the LC-NSP method is significantly lower than that of the SC-NSP and NegI-NSP methods.

[0061] Depend on Figure 8 It can be seen that when testing on the DS2 dataset with a support of 0.315, the unit mining time of the VM-NSP method is 81.72269 milliseconds / data, while the unit mining times of the LC-NSP, SC-NSP, and NegI-NSP methods are 3.56285 milliseconds / data, 5.82759 milliseconds / data, and 7.15094 milliseconds / data, respectively. When the support level increases to 0.335, the unit mining time for VM-NSP is 69.46784 milliseconds / row, NegI-NSP decreases to 4.74359 milliseconds / row, SC-NSP decreases to 4.09756 milliseconds / row, and the unit mining times for LC-NSP, SC-NSP, and NegI-NSP are 2.62832 milliseconds / row, 4.74359 milliseconds / row, and 4.09756 milliseconds / row, respectively.

[0062] Clearly, on the DS2 dataset, the unit mining time of the LC-NSP method is significantly lower than that of the SC-NSP and NegI-NSP methods.

[0063] Depend on Figure 9 It can be seen that when testing on the DS3 dataset with a support of 0.315, the unit mining time of the VM-NSP method is 68.45161 milliseconds / data, while the unit mining times of the LC-NSP, SC-NSP, and NegI-NSP methods are 3.19254 milliseconds / data, 5.30909 milliseconds / data, and 6.92308 milliseconds / data, respectively. When the support is increased to 0.335, the unit mining time of the VM-NSP method is 66.44571 milliseconds / record, while the unit mining times of the LC-NSP, SC-NSP, and NegI-NSP methods are 2.22250 milliseconds / record, 4.07317 milliseconds / record, and 4.35897 milliseconds / record, respectively.

[0064] Clearly, on the DS3 dataset, the unit mining time of the LC-NSP method is significantly lower than that of the SC-NSP and NegI-NSP methods.

[0065] On datasets DS1, D2, and DS3, the unit mining time of the VM-NSP method is significantly higher than that of the other three methods at all support levels, indicating that the time cost of the VM-NSP method in mining each negative sequence pattern is extremely high. On the other hand, the unit mining time of the LC-NSP method is consistently the lowest, demonstrating that in multi-sequence scenarios, the LC-NSP method has a greater efficiency advantage in the trade-off between "mining time and the number of negative sequence patterns mined".

[0066] Overall, the LC-NSP method demonstrates a significant advantage in unit mining time efficiency on datasets DS1, D2, and DS3.< / c> < / c> < / c> < / c> < / c> < / c> < / c> < / c>

Claims

1. A product recommendation method based on relaxed constraints of negative sequence patterns, characterized in that: Includes the following steps: S1. Obtain the types of uncoded behavioral elements and the sequence of uncoded user shopping behaviors; S2. Encode the unencoded user shopping behavior sequence and unencoded behavior elements; based on the encoded shopping sequence, mine positive and negative sequence candidate patterns under relatively relaxed constraints; relatively relaxed constraints mean that negative items are allowed within the itemset; Calculate the support of negative sequence candidate patterns, and take all negative sequence candidate patterns with support ≥ preset minimum support as negative sequence patterns; when calculating the support of negative sequence candidate patterns with length ≥ 2, first determine whether the support of the positive partner corresponding to the negative subsequence of the negative sequence candidate pattern is ≥ preset minimum support. If so, determine that the negative sequence candidate pattern corresponding to the positive partner is not a frequent sequence, delete the negative sequence candidate patterns that are not frequent sequences, retain the remaining negative sequence candidate patterns with length ≥ 2, and calculate their support. The encoded shopping sequence is an encoded sequence of user shopping behavior. The negative subsequence refers to a sequence that contains any negative item and all positive items in the negative sequence candidate pattern, and the order in which the negative items and all positive items appear remains unchanged; the positive partner refers to a sequence after converting all negative items in the negative subsequence into their corresponding positive items. Step S2 specifically includes the following steps: S2-1. Encode the unencoded user shopping behavior sequence and the unencoded behavior elements respectively. Obtain a positive sequence candidate pattern of length 1 based on the encoded shopping sequence. Obtain a negative sequence candidate pattern of length 1 based on the positive sequence candidate pattern. S2-2. Create a sequence ID inverted list, a bitmap index table, and a sequence hash table; store positive and negative sequence candidate patterns of length 1 and their corresponding sequence ID sets in the sequence ID inverted list; store positive and negative sequence candidate patterns of length 1 and their corresponding bitmap indices in the bitmap index table; store positive and negative sequence candidate patterns of length 1 and their corresponding support in the sequence hash table. S2-3. Concatenate the positive and negative sequence candidate patterns of length 1 under relatively relaxed constraints to obtain positive and negative sequence candidate patterns of length 2; store the positive and negative sequence candidate patterns of length 2 and their corresponding sequence ID sets in a sequence ID inverted list; store the positive and negative sequence candidate patterns of length 2 and their corresponding bitmap indices in a bitmap index table; store the positive and negative sequence candidate patterns of length 2 and their corresponding support in a sequence hash table. S2-4. Based on the positive and negative sequence candidate patterns of length 1 and length 2, recursively expand according to the steps described in S2-3 until a positive sequence candidate pattern of length m and a negative sequence candidate pattern of length 2m+1 are obtained; store the positive and negative sequence candidate patterns of length ≥ 3 and their corresponding sequence ID sets in the sequence ID inverted list; store the positive and negative sequence candidate patterns of length ≥ 3 and their corresponding bitmap indices in the bitmap index table; store the positive and negative sequence candidate patterns of length ≥ 3 and their corresponding support in the sequence hash table; Negative sequence candidate patterns with support ≥ preset minimum support obtained from steps S2-2 to S2-4 are all regarded as negative sequence patterns. S3. Sort the negative sequence patterns in descending order of their support, and then adjust the content displayed on the platform interface in combination with the corresponding user ID.

2. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 1, characterized in that: Step S2-1 specifically includes the following steps: Based on all coded shopping sequences, the support of each item is obtained. Items with support greater than or equal to the preset minimum support are selected as positive sequence candidate patterns of length 1. The positive sequence candidate patterns of length 1 are then negatively transformed to obtain negative sequence candidate patterns of length 1.

3. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 1, characterized in that: In step S2-2, a bitmap index is built based on the sequence ID set in the inverted list of sequence IDs for positive sequence candidate patterns of length 1. This specifically includes the following steps: In the sequence ID set, 'n' in Sn represents the nth position of the bitmap index corresponding to a positive sequence candidate pattern of length 1. For a positive sequence candidate pattern of length 1 and the sequence ID that appears in its corresponding sequence ID set, its position in the bitmap index is set to 1. For a sequence ID that does not appear, its position in the bitmap index is set to 0.

4. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 1, characterized in that: In steps S2-3, positive and negative sequence candidate patterns of length 1 are joined under relatively relaxed constraints. Specifically, if positive and negative sequence candidate patterns of length 1 are within the same itemset, an intra-item join is performed; if positive and negative sequence candidate patterns of length 1 are not within the same itemset, an out-of-item join is performed.

5. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 4, characterized in that: In steps S2-3, the positive and negative sequence candidate patterns of length 1 are joined outside the item. Specifically, this includes the following steps: the negative sequence candidate pattern is joined after the positive sequence candidate pattern without adding additional parentheses; the constraint condition for the outside join is: two negative sequence candidate patterns of length 1 are not allowed to be joined outside the item, but they can be joined inside the item.

6. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 4, characterized in that: In steps S2-3, the positive and negative sequence candidate patterns of length 1 are joined outside the item set, including the following steps: adding a bracket and directly connecting the negative sequence candidate pattern after the positive sequence candidate pattern inside the bracket; the constraint condition for the in-item join is: in the in-item join, a positive sequence candidate pattern of length 1 and a negative sequence candidate pattern of length 1 obtained by inverting the positive sequence candidate pattern of length 1 are not allowed to appear in the same item set at the same time.

7. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 1, characterized in that: In steps S2-3, the support of negative sequence candidate patterns of length 2 is calculated, which specifically includes the following steps: 1) Obtain the negative subsequence of the negative sequence candidate pattern based on the negative sequence candidate pattern of length 2, and obtain the corresponding positive partner and the maximum positive subsequence based on the negative subsequence. The maximum positive subsequence is the sequence obtained by removing all negative terms from the negative sequence candidate pattern of length ≥ 2. Query the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the positive partners from the sequence ID inverted list to form the sequence ID set of the positive partners of the negative subsequence. Query the sequence IDs corresponding to the positive sequence candidate patterns that are completely identical to the maximum positive subsequence from the sequence ID inverted list to form the sequence ID set of the maximum positive subsequence. Perform a difference operation between the sequence ID set of the maximum positive subsequence and the sequence ID set of the positive partners to obtain the sequence ID set of the negative subsequence. All negative subsequences and their corresponding sequence ID sets are counted in the sequence ID inverted list. 2) Obtain the support of the positive partner based on the sequence ID set of the positive partner of the negative subsequence. When the support of the positive partner is greater than or equal to the preset minimum support, it is determined that the negative sequence candidate pattern corresponding to the positive partner is not a frequent sequence. The negative sequence candidate patterns of length 2 that are determined to be not frequent sequences are deleted, and the remaining negative sequence candidate patterns of length 2 are retained. The support of the remaining negative sequence candidate patterns of length 2 is calculated.

8. The product recommendation method based on relaxed constraints of negative sequence patterns according to claim 7, characterized in that: In step 2), the support of the remaining negative sequence candidate patterns of length 2 is calculated. The specific steps are as follows: obtain the sequence ID set corresponding to the negative sequence candidate patterns of length 2, obtain the bitmap index based on the sequence ID set, and obtain the support of the negative sequence candidate patterns based on the bitmap index.

9. A product recommendation system based on relaxed constraints of negative sequence patterns, characterized in that: The product recommendation system based on relaxed constraints of negative sequence patterns is used to implement the product recommendation method based on relaxed constraints of negative sequence patterns as described in claim 1. The product recommendation system based on relaxed constraints of negative sequence patterns includes a data storage layer, an algorithm layer, and an application layer.