Commodity recommendation method and system based on target sequence pattern mining
By guiding the product recommendation system based on negative target query sequences, the system achieves matching between prefix sequences and negative items, and prunes candidate items, thus solving the problem of numerous pseudo-target sequence patterns and long processing time in traditional systems, and improving mining efficiency and pattern consistency.
Patent Information
- Application Number
- CN202511934928.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2045-12-22
AI Technical Summary
Traditional product recommendation systems generate a large number of pseudo-target sequence patterns that do not match the target semantics during negative target sequence pattern mining, resulting in long mining times.
Guided by the negative target query sequence, the current prefix sequence is matched with the predecessor positive partner and the successor positive partner of the negative item, and the candidate items are pruned to generate a target sequence pattern with high consistency and support.
It effectively reduces the generation of pseudo-target sequence patterns, improves mining efficiency, ensures that the generated target sequence patterns are highly consistent with the target query sequence in terms of support and sequence structure, and shortens the mining time.
Smart Images

Figure CN121366023A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of data mining, and particularly relates to a commodity recommendation method and system based on target sequence pattern mining. BACKGROUND
[0002] In the process of mining sequence candidate patterns containing negative target sequences, the traditional commodity recommendation system does not guide the matching of the current prefix sequence and the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the negative target query sequence, which leads to the generation of a large number of pseudo target sequence patterns that meet the support degree but do not match the target semantics of the target sequence pattern containing the negative target query sequence in sequence structure. A large number of pseudo target sequence patterns lead to a long mining time when mining the target sequence pattern. Therefore, the application provides a commodity recommendation method and system based on target sequence pattern mining. SUMMARY
[0003] In view of the defects and deficiencies in the prior art, the application provides a commodity recommendation method and system based on target sequence pattern mining.
[0004] To achieve the above application purposes, the application adopts the following technical solutions: A commodity recommendation method based on target sequence pattern mining comprises the following steps: S1, collecting user shopping data, performing data cleaning on the collected user shopping data to obtain cleaned data, then performing classification and serialization processing on the cleaned data to obtain an uncoded user shopping behavior sequence and an uncoded element data table, and then statistically classifying the uncoded user shopping behavior sequence and the corresponding user ID into a shopping behavior sequence data table according to the time sequence; S2, encoding the user shopping behavior sequence in the shopping behavior sequence data table and the behavior element in the element data table to obtain an encoded shopping behavior sequence data table and an encoded element data table, then mining a sequence candidate pattern with a length of 2m+1 from the encoded shopping sequence in the encoded shopping behavior sequence data table, then deleting the sequence candidate pattern with a length of 2m+1 that does not contain the target query sequence, and the remaining sequence candidate patterns with a length of 2m+1 are the target sequence patterns, and the support degree of the target sequence patterns is calculated; In step S2, in the process of mining a sequence candidate pattern with a length of 2m+1 from the encoded shopping sequence in the encoded shopping behavior sequence data table, when the target query sequence is a negative target query sequence, the matching of the current prefix sequence and the predecessor positive partner of the negative item and the successor positive partner of the negative item is realized based on the guidance of the negative target query sequence; S3, sorting the target sequence patterns according to the size of the support degree of the target sequence patterns, and then adjusting the content displayed on the platform interface in combination with the corresponding user ID.
[0005] Preferably, step S2 comprises the following specific steps: S2-1, respectively encoding the unencoded user shopping behavior sequence in the shopping behavior sequence data table and the unencoded behavior element category in the element data table to obtain the encoded element data table and the encoded shopping behavior sequence data table; obtaining the positive sequence candidate pattern with a length of 1 and the negative sequence candidate pattern with a length of 1 based on the encoded shopping sequence in the encoded shopping behavior sequence data table, and taking the positive sequence candidate pattern with a length of 1 and the negative sequence candidate pattern with a length of 1 as initial candidates; S2-2, pruning the initial candidates to obtain processed candidates; S2-3, extending the processed candidates obtained in step S2-2 according to the type of the target query sequence, i.e., according to whether the target query sequence is a positive target query sequence or a negative target query sequence, to obtain a sequence candidate pattern with a length of 2; in step S2-3, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence; S2-4, recursively extending the sequence candidate pattern with a length of 2 according to the steps described in step S2-3 until a sequence candidate pattern with a length of 2m+1 is obtained, and saving the sequence candidate pattern with a length of 2m+1 in the sequence pattern table; wherein m is equal to the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table; S2-5, deleting the sequence candidate patterns with a length of 2m+1 in the sequence pattern table that do not contain the target query sequence, and the remaining sequence candidate patterns with a length of 2m+1 are the target sequence patterns, and the support degree of the target sequence patterns is calculated.
[0006] Preferably, step S2-1 specifically comprises the following steps: S2-1-1, encoding the unencoded user shopping behavior sequence in the shopping behavior sequence data table and the unencoded behavior element category in the element data table; S2-1-2, deleting the encoded shopping sequence in the encoded shopping behavior sequence data table that does not contain the target query sequence; subsequently, creating a corresponding bitmap for each item in the encoded shopping behavior sequence data table; S2-1-3. Obtain the support of each item, where the support of each item is equal to the number of times "1" appears in the bitmap corresponding to each item; filter out items with support ≥ preset minimum support (preset minimum support is 2 in this embodiment) as positive sequence candidate patterns of length 1. S2-1-4. Perform a negative transformation on the positive sequence candidate pattern of length 1 to obtain a negative sequence candidate pattern of length 1; use both the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 as initial candidates for obtaining the column candidate pattern of length 2; and save the positive sequence candidate pattern of length 1 and the negative sequence candidate pattern of length 1 in the sequence pattern table.
[0007] Preferably, in step S2-1-2, the length of the bitmap is equal to the sum of the number of all user shopping behavior sequences. If an item appears in a sequence, the corresponding bit in the bitmap is set to 1; otherwise, it is set to 0.
[0008] Preferably, step S2-2 includes the following steps: taking each initial candidate as the current prefix sequence and obtaining the bitmap of the current prefix sequence; taking each initial candidate as an extension item and obtaining the bitmap of the extension item; obtaining the bitmap of the maximum positive subsequence of the target query sequence; and performing pruning based on the bitmap of the current prefix sequence, the bitmap of the extension item, and the bitmap of the maximum positive subsequence to obtain the processed candidate.
[0009] Preferably, in step S2-2, pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the extended term, and the bitmap of the maximum positive subsequence, specifically including the following steps: 1) When the expansion term is a positive expansion term, pruning is performed based on the bitmap of the current prefix sequence, the bitmap of the expansion term, and the bitmap of the largest positive subsequence to obtain the pruned and filtered candidate terms, including the following steps: Combine the bitmap of the current prefix sequence, the bitmap of the extended term, and the bitmap of the largest positive subsequence of the target query sequence. Figure Three The algorithm performs a logical AND operation to obtain the final bitmap. Then, it calculates the support of the final bitmap. If the support of the final bitmap is less than the preset minimum support, it is pruned directly. Positive expansion items that are not pruned are used as candidates after pruning and filtering. 2) When the extension term is a negative extension term, this application does not prune the negative extension term; In step S2-2 of this application, the processed candidate items are composed of the pruned and screened candidate items and negative expansion terms.
[0010] Preferably, step S2-3 includes the following steps: S2-3-1. When the target query sequence is a positive target query sequence, the processed candidate options are expanded to obtain a sequence candidate pattern of length 2. S2-3-2, when the target query sequence is a negative target query sequence, performing pattern extension on the processed candidate item to obtain a sequence candidate pattern with a length of 2, and saving the sequence candidate pattern with the length of 2 in the sequence pattern table; in step S2-3-2, the matching of the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item is implemented based on the guidance of the negative target query sequence.
[0011] Preferably, step S2-3-2 specifically comprises the following steps: When the target query sequence is a negative target query sequence, first, a position list is constructed for the target query sequence; then, a negative item in the target query sequence is identified, the positive partner corresponding to the negative item is known according to the negative item, and the predecessor positive partner and the successor positive partner of the negative item are identified from the target query sequence; The application sets a dynamic anchor point value to track the matching of the current prefix sequence and the target query sequence, wherein the initial value of the dynamic anchor point value is set to 0. (1) If both the predecessor positive partner and the successor positive partner of the negative item exist, performing pattern extension on the processed candidate item to obtain a sequence candidate pattern with a length of 2, and saving the sequence candidate pattern with the length of 2 in the sequence pattern table; (2) If only the predecessor positive partner of the negative item exists, performing pattern extension on the processed candidate item to obtain a sequence candidate pattern with a length of 2, and saving the sequence candidate pattern with the length of 2 in the sequence pattern table; (3) If only the successor positive partner of the negative item exists, performing pattern extension on the processed candidate item to obtain a sequence candidate pattern with a length of 2, and saving the sequence candidate pattern with the length of 2 in the sequence pattern table.
[0012] Preferably, in step S2-3-2, the predecessor positive partner refers to a positive item in the target query sequence located before the position of the negative item and closest to the negative item, and the successor positive partner refers to a positive item in the target query sequence located after the position of the negative item and closest to the negative item; when the negative item has no predecessor positive partner, the position value of the predecessor positive partner is set to 0 by default; and when the negative item has no successor positive partner, the position value of the successor positive partner is not counted in the position list.
[0013] Preferably, step (1) specifically comprises the following steps: determining whether the current prefix sequence matches the predecessor positive partner of the negative item; When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is increased by 1, and at this time, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, which indicates that the current prefix sequence has matched the predecessor positive partner in the target query sequence. At this time, the positive partner corresponding to the negative item is removed from the candidate, i.e., the positive partner corresponding to the negative item is removed from the processed candidate, and the positive partner corresponding to the negative item is not continued to be expanded. The positive partner corresponding to the negative item is removed from the processed candidate, and the remaining candidate is expanded to obtain a sequence candidate mode with a length of 2. The sequence candidate mode with the length of 2 is saved in the sequence mode table. Then, the current prefix sequence is continued to be matched with the successor positive partner of the negative item. When the current prefix sequence matches the successor positive partner of the negative item, the dynamic anchor value is continued to be increased by 1, and at this time, the dynamic anchor value is equal to the position value of the successor positive partner of the negative item in the position list minus 1, which indicates that the current prefix sequence has completely matched the target query sequence. The positive partner corresponding to the negative item in the target query sequence is added to the processed candidate, and these candidates are used as initial candidates for obtaining a sequence candidate mode with a length of 3 to continue to be expanded. When the current prefix sequence does not match the predecessor positive partner of the negative item, whether the current prefix sequence matches the successor positive partner of the negative item in the target query sequence or not, the dynamic anchor value remains unchanged, which indicates that the current prefix sequence has not started to match the target query sequence. The candidates in the processed candidate obtained in step S2-2 are directly expanded to obtain a sequence candidate mode with a length of 2, and the sequence candidate mode with the length of 2 is saved in the sequence mode table. At this time, the processed candidate obtained in step S2-2 is used as an initial candidate for obtaining a sequence candidate mode with a length of 3 to continue to be expanded.
[0014] Preferably, step (2) specifically includes the following steps: The current prefix sequence is matched with the predecessor positive partner of the negative item. When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is increased by 1, and at this time, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, which indicates that the current prefix sequence has matched the predecessor positive partner in the target query sequence. The positive partner corresponding to the negative item in the target query sequence is removed from the candidate. Then, the positive partner corresponding to the negative item is removed from the processed candidate, and the remaining candidate is expanded to obtain a sequence candidate mode with a length of 2. The sequence candidate mode with the length of 2 is saved in the sequence mode table.
[0015] Preferably, when only the successor positive partner of the negative item exists, and the predecessor positive partner of the negative item does not exist, the position of the predecessor positive partner is set to 0, at this time the dynamic anchor point value is equal to the position value of the predecessor positive partner, since there is no predecessor positive partner of the negative item in the target query sequence, it is indicated that the current application only needs to process the positive partner corresponding to the negative item, and the processing manner is to remove the positive partner corresponding to the negative item from the candidate; and then, the each candidate after the negative item corresponding to the positive partner is removed in the processed candidate is expanded, a sequence candidate mode with a length of 2 is obtained, and the sequence candidate mode with the length of 2 is saved in the sequence mode table.
[0016] A commodity recommendation system for implementing the commodity recommendation method based on the target sequence mode mining described above, comprising a data storage layer, an algorithm layer and an application layer: The data storage layer is used for collecting user shopping data, and performing data cleaning on the collected user shopping data to obtain cleaned data; then, the cleaned data is classified and serialized to obtain user shopping behavior sequences; then, the unencoded user shopping behavior sequences and corresponding user IDs are counted into a shopping behavior sequence data table according to the time sequence; the data storage layer transmits the shopping behavior sequence data table and the corresponding element data table to the algorithm layer; The algorithm layer encodes the user shopping behavior sequences in the shopping behavior sequence data table and the behavior elements in the element data table output by the data storage layer to obtain an encoded shopping behavior sequence data table and an encoded element data table, and then mines the encoded user shopping behavior sequences (in the application, the encoded user shopping behavior sequences are simply referred to as encoded shopping sequences) in the encoded shopping behavior sequence data table to obtain sequence candidate modes with a length of 2m+1; the sequence candidate modes with the length of 2m+1 are mined; then, the sequence candidate modes with the length of 2m+1 not containing the target query sequence are deleted, and the remaining sequence candidate modes with the length of 2m+1 are the target sequence modes, the support of the target sequence modes is calculated; and the target sequence modes and the support are transmitted to the application layer; The application layer receives the target sequence modes and the support output by the algorithm layer, sorts the target sequence modes output by the algorithm layer according to the support size, and then adjusts the content displayed on the platform interface in combination with the corresponding user ID; at the same time, the adjustment record is saved, a log file is generated and transmitted to the data storage layer for archival storage.
[0017] Compared with the prior art, the beneficial technical effects of the application are: The application can realize matching of the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence in the sequence pattern mining process containing the negative target query sequence. The application can not only effectively ensure that the generated target sequence pattern containing the target query sequence meets the standard in support, but also make the generated target sequence pattern containing the target query sequence highly consistent with the target query sequence in sequence structure. The application has a shorter mining time of the target sequence pattern. The application effectively solves the problem that most existing product recommendation systems cannot realize matching of the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence in the sequence pattern mining process containing the negative target query sequence, resulting in generation of a large number of pseudo target sequence patterns which, although meeting the standard in support, are not consistent with the target semantic of the target sequence pattern containing the target query sequence in sequence structure, and further resulting in a longer time of target sequence pattern mining. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 The mining time test results of the SC-NSP method, the TaNSP method and the method of the application in the target sequence pattern mining containing the positive target query sequence <(70, 91)> of the Data1 data set under the condition that the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, 0.2360; Figure 2 The mining time test results of the SC-NSP method, the TaNSP method and the method of the application in the target sequence pattern mining containing the negative target query sequence <(¬71, 91)> of the Data1 data set under the condition that the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, 0.34; Figure 3 The target sequence pattern quantity test results of the method of the application and the TaNSP method in the target sequence pattern mining containing the positive target query sequence <(70, 91)> of the Data1 data set under the condition that the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, 0.2360; Figure 4 The target sequence pattern quantity test results of the method of the application and the TaNSP method in the target sequence pattern mining containing the negative target query sequence <(¬71, 91)> of the Data1 data set under the condition that the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, 0.34; Figure 5Memory occupation test results of the SC-NSP method, the TaNSP method and the method described in the application when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, 0.2360, and the Data1 data set is subjected to target sequence pattern mining containing the positive target query sequence <(70, 91)>; Figure 6 Memory occupation test results of the SC-NSP method, the TaNSP method and the method described in the application when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, 0.34, and the Data1 data set is subjected to target sequence pattern mining containing the negative target query sequence <(¬71, 91)>; Figure 7 The percentage improvement of the number of cross points of the SC-NSP method and the method described in the application when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, 0.2360, and the Data1 data set is subjected to target sequence pattern mining containing the positive target query sequence <(70, 91)>; Figure 8 The percentage improvement of the number of cross points of the TaNSP method and the method described in the application when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, 0.34, and the Data1 data set is subjected to target sequence pattern mining containing the negative target query sequence <(¬71, 91)>; DETAILED DESCRIPTION
[0019] A commodity recommendation system based on target sequence pattern mining, comprising a data storage layer, an algorithm layer and an application layer, and a method for commodity recommendation by the commodity recommendation system based on target sequence pattern mining, specifically comprising the following steps: S1, collecting user shopping data by using the data storage layer, and performing data cleaning on the collected user shopping data to obtain cleaned data; then, performing classification and serialization processing on the cleaned data to obtain unencoded user shopping behavior sequences and an unencoded element data table; then, according to the time sequence, the unencoded user shopping behavior sequences and the corresponding user IDs are counted into a shopping behavior sequence data table; the data storage layer transmits the shopping behavior sequence data table and the corresponding element data table to the algorithm layer; the user shopping data collected in the application has been arranged according to the time sequence.
[0020] In the present application, data cleaning refers to cleaning data irrelevant to the recommendation target in user shopping data to obtain cleaned data; for example, there are user operation timestamps and device information in user shopping data, and since the user operation timestamps and device information are irrelevant to the system's recommendation of goods to the user, the user operation timestamps and device information are irrelevant data to the system's recommendation of goods to the user, and data cleaning is essentially deleting data irrelevant to the system's recommendation of goods to the user; In the present application, the cleaned data is classified and serialized, including the following steps: (1) creating a user set for each user in the cleaned data and setting a unique user ID for each user; (2) in the user set, counting the types of behavior elements involved by the user to achieve the purpose of classifying the cleaned data; (3) counting all behavior element types (these behavior element types are uncoded element types) in the cleaned data into an uncoded element data table. For example, user U1 only has three types of behavior elements of purchasing A brand mobile phone, purchasing B brand tablet and purchasing C brand earphone in different time periods, and therefore, the element data table of user U1 is as shown in Table 1, wherein the behavior element types in the element data table described in Table 1 include purchasing A brand mobile phone, purchasing B brand tablet and purchasing C brand earphone; the behavior element types shown in Table 1 are all uncoded behavior element types; Table 1 is an uncoded element data table
[0021] The present application classifies the cleaned data according to behavior element types, wherein the behavior element types are determined according to the types of purchased goods, such as purchasing A brand mobile phone, purchasing B brand tablet and purchasing C brand earphone, which are three different behavior element types; (4) forming an uncoded user shopping behavior sequence of all behavior element types of the same user in the same time period in the cleaned data; For example, user U1 first purchases A brand mobile phone, then purchases B brand tablet and then purchases A brand mobile phone in the first time period, and therefore, the user shopping data of user U1 is converted by the data storage layer into an uncoded user shopping behavior sequence <purchasing A brand mobile phone, purchasing B brand tablet, purchasing A brand mobile phone>; User U1 first purchases B brand tablet, then purchases A brand mobile phone and finally purchases C brand earphone in the second time period, and therefore, the user shopping data of user U1 is converted by the data storage layer into an uncoded user shopping behavior sequence <purchasing B brand tablet, purchasing A brand mobile phone, purchasing C brand earphone>; User U1 buys A brand mobile phone and B brand tablet in the same order in the third time period, and then separately buys C brand earphone, so the user shopping data of user U1 is converted by the data storage layer into an uncoded user shopping behavior sequence <(purchase A brand mobile phone, purchase B brand tablet), purchase C brand earphone>.
[0022] In the present application, the uncoded user shopping behavior sequence and the corresponding user ID are counted into the shopping behavior sequence data table, as shown in Table 2.
[0023] Table 2 is the shopping behavior sequence data table before coding User ID Un-encoded user shopping behavior sequence U1 <Buy a brand A phone, buy a brand B tablet, buy a brand A phone> U1 <buy B brand tablet, buy A brand phone, buy C brand earphone> U1 < (buy A brand mobile phone, buy B brand tablet), buy C brand earphone> S2, encode the user shopping behavior sequence in the shopping behavior sequence data table output by the data storage layer and the behavior element in the element data table by using the algorithm layer, obtain the coded shopping behavior sequence data table and the coded element data table, and then mine the sequence candidate mode with a length of 2m+1 from the coded user shopping behavior sequence in the coded shopping behavior sequence data table (in the present application, the coded user shopping behavior sequence is referred to as coded shopping sequence); mine the sequence candidate mode with a length of 2m+1; then delete the sequence candidate mode with a length of 2m+1 that does not contain the target query sequence, and the remaining sequence candidate mode with a length of 2m+1 is the target sequence mode, calculate the support degree of the target sequence mode; and pass the target sequence mode and the support degree to the application layer; specifically including the following steps: S2-1, encode the uncoded user shopping behavior sequence in the shopping behavior sequence data table and the uncoded behavior element category in the element data table by using the algorithm layer, obtain the coded element data table (as shown in Table 3) and the coded shopping behavior sequence data table (as shown in Table 4); obtain the positive sequence candidate mode with a length of 1 and the negative sequence candidate mode with a length of 1 based on the coded user shopping behavior sequence in the coded shopping behavior sequence data table; specifically including the following steps: S2-1-1, encode the uncoded user shopping behavior sequence in the shopping behavior sequence data table and the uncoded behavior element category in the element data table by using the algorithm layer; For example, the behavior element categories appearing in Table 1, purchase A brand mobile phone, purchase B brand tablet, and purchase C brand earphone, are coded as a, b, and c respectively, and the coded element data table and the coded shopping behavior sequence data table are shown in Table 3 and Table 4 respectively.
[0024] Table 3 is the coded element data table
[0025] Table 4 is the coded shopping behavior sequence data table User ID Encoded user shopping behavior sequence U1 <a , b, a> U1 b, a, c U1 (a, b), c S2-1-2, delete the encoded shopping sequence in the encoded shopping sequence data table which does not contain the target query sequence; then, create a corresponding bitmap for each item in the encoded shopping sequence data table, the bitmap is used to record the position of the item, the length of the bitmap is equal to the sum of the number of all user shopping sequence, if the item appears in a sequence, the corresponding bit in the bitmap is set to 1, otherwise it is set to 0; for example, in table 4, <a ,b, a>The item a appears in all three of the encoded shopping sequences, <b, a, c>, <a, b>, and <(a, b), c>, so the bitmap for item a is [1, 1, 1]; for example, <a , b, a>The item b appears in all three of the encoded shopping sequences, <b, a, c>, <a, b>, and <(a, b), c>, so the bitmap for item b is [1, 1, 1]; for example, <a , b, a>The item c does not appear in the item c, <b, a, c> and <(a, b), c> two encoding shopping sequences, and therefore, the bitmap of the item c is [0, 1, 1]. In this application, the target query sequence is artificially set, and the target sequence mode refers to a mode containing the target query sequence; for example, it is desired to find all modes of the user U1 buying A brand mobile phone, not buying B brand tablet computer and buying C brand earphone, so the target query sequence can be defined as <a, ¬b, c>, and all modes containing the target query sequence are referred to as target sequence modes; S2-1-3, obtaining the support degree of each item, wherein the support degree of each item is equal to the number of times of appearance of "1" in the bitmap corresponding to each item; screening out the items with a support degree greater than or equal to a preset minimum support degree (in this embodiment, the preset minimum support degree is 2) as the positive sequence candidate mode with a length of 1; obviously, the positive sequence candidate mode with a length of 1 is <a , b, a>The three encoded shopping sequences of <b, a, c> and <(a, b), c> can obtain positive sequence candidate modes with a length of 1 as follows: , , ; S2-1-4, the length of 1 positive sequence candidate mode is negatively transformed to obtain the length of 1 negative sequence candidate mode; the length of 1 positive sequence candidate mode and the length of 1 negative sequence candidate mode are both used as initial candidates for obtaining the length of 2 column candidate mode; and the length of 1 positive sequence candidate mode and the length of 1 negative sequence candidate mode are saved in the sequence mode table; S2-2, pruning processing is performed based on the initial candidates to obtain processed candidates, specifically including the following steps; Each initial candidate is used as a current prefix sequence to obtain a bit map of the current prefix sequence; and each initial candidate is used as an expansion item to obtain a bit map of the expansion item; a bit map of the maximum positive subsequence of the target query sequence is obtained; pruning processing is performed based on the bit map of the current prefix sequence, the bit map of the expansion item and the bit map of the maximum positive subsequence to obtain the processed candidates; In the present application, the pruning processing based on the bit map of the current prefix sequence, the bit map of the expansion item and the bit map of the maximum positive subsequence specifically includes the following steps: 1) When the expansion item is a positive expansion item, pruning processing is performed based on the bit map of the current prefix sequence, the bit map of the expansion item and the bit map of the maximum positive subsequence to obtain the candidate items after pruning screening, including the following steps: The bit map of the current prefix sequence, the bit map of the expansion item and the bit map of the maximum positive subsequence of the target query sequence are compared; Figure Three The final bitmap is obtained by performing logical AND (AND) operation on the two bitmaps, then the support of the final bitmap is calculated, if the support of the final bitmap is less than the preset minimum support (in this embodiment, the preset minimum support is 2), it is determined that the positive expansion item is not hopeful for forming a pattern that meets the target sequence pattern constraint, and is directly pruned, and no subsequent expansion is performed, and the positive expansion item which is not pruned is taken as a candidate item after pruning screening, this step can effectively avoid wasting computing resources on the path that is not possible to mine the target sequence pattern containing the target query sequence; 3) When the expansion item is a negative expansion item, the negative expansion item is not pruned in the present application, so that the mined target sequence pattern can effectively cover the negative sequence pattern with the negative item at the beginning or the end, and the integrity of the target sequence pattern containing the target query sequence is improved. In step S2-2 of the present application, the processed candidate items obtained are composed of the candidate items after pruning screening and the negative expansion item (the negative sequence candidate pattern with a length of 1).
[0026] In step S2-2 of the present application, when the target query sequence is a positive target query sequence, the maximum positive subsequence of the target query sequence is the same as the target query sequence; when the target query sequence is a negative target query sequence, the subsequence composed of all positive items in the target query sequence is the maximum positive subsequence of the target query sequence, for example, the negative target query sequence is <a,¬b,c>, and the subsequence <a,b,c> composed of all positive items in the negative target query sequence is the maximum positive subsequence of the negative target query sequence.
[0027] S2-3, according to the type of the target query sequence, the processed candidate items obtained in step S2-2 are expanded to obtain sequence candidate patterns with a length of 2, and the negative sequence candidate patterns with a length of 2 are saved in the sequence pattern table; in step S2-3, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence; step S2-3 specifically includes the following steps; S2-3-1, when the target query sequence is a positive target query sequence, performing pattern expansion on the processed candidate item to obtain a sequence candidate pattern with a length of 2, and saving the negative sequence candidate pattern with the length of 2 in the sequence pattern table, including the following steps: The processed candidate item is taken as a new expansion item, the current prefix sequence is connected with the new expansion item to form a new candidate pattern, the bitmap of the current prefix sequence is logically ANDed with the bitmap of the new expansion item to update the bitmap of the new candidate pattern, and the support degree of the bitmap of the new candidate pattern is calculated; if the support degree of the bitmap is less than a preset minimum support degree (in this embodiment, the preset minimum support degree is 2), it is determined that the expansion item is hopeless for forming a pattern satisfying the target sequence pattern constraint, and is directly pruned without subsequent expansion; if the support degree of the bitmap is greater than or equal to the preset minimum support degree, the new candidate pattern corresponding to the bitmap is a sequence candidate pattern with a length of 2, and the sequence candidate pattern with the length of 2 is taken as an initial candidate item for obtaining a sequence candidate pattern with a length of 3, and the sequence candidate pattern with the length of 2 is saved in the sequence pattern table; in this embodiment, the target query sequence is a positive target query sequence, indicating that the items contained in the target query sequence are all behavior elements of purchasing goods by a user; S2-3-2, when the target query sequence is a negative target query sequence, performing pattern expansion on the processed candidate item to obtain a sequence candidate pattern with a length of 2, and saving the sequence candidate pattern with the length of 2 in the sequence pattern table; in step S2-3-2, the matching of the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item is implemented based on the guidance of the negative target query sequence; in this embodiment, the target query sequence is a negative target query sequence, indicating that the items contained in the target query sequence include behavior elements of not purchasing goods by a user; step S2-3-2 specifically includes the following steps: When the target query sequence is a negative target query sequence, first, a position list is constructed for the target query sequence, taking the target query sequence <a,¬b,c> as an example, the position value of a is defined as 1, the position value of¬b is defined as 2, and the position value of c is defined as 3, and the position list of the target query sequence <a,¬b,c> is shown in Table 5: Table 5 Position list of target query sequence <a, ¬b,c> Item a ¬b c Position 1 2 3 Then, a negative item in the target query sequence is identified, a positive partner corresponding to the negative item is known according to the negative item, and a predecessor positive partner and a successor positive partner of the negative item are identified from the target query sequence; the predecessor positive partner refers to a positive item located before the negative item and closest to the negative item in the target query sequence, and the successor positive partner refers to a positive item located after the negative item and closest to the negative item in the target query sequence; in the present application, when the negative item has no predecessor positive partner, the position value of the predecessor positive partner is 0 by default, and when the negative item has no successor positive partner, the position value of the successor positive partner is not counted in the position list; Taking the target query sequence <a, ¬b, c> as an example, the negative item in the target query sequence is <¬b>, the positive partner corresponding to the negative item <¬b> is , and the predecessor positive partner of the negative item <¬b> identified from the target query sequence is The successor positive partner of a negative item <¬b> from a target query sequence is identified as <c>.
[0028] The application sets a dynamic anchor point value to track the matching of the current prefix sequence and the target query sequence, wherein the initial value of the dynamic anchor point value is set to 0; (1) If the predecessor positive partner and the successor positive partner of the negative item both exist, the processed candidate items are mode-expanded to obtain sequence candidate modes with a length of 2, and the sequence candidate modes with the length of 2 are stored in the sequence mode table. Step (1) specifically includes the following steps: It is judged whether the current prefix sequence matches the predecessor positive partner of the negative item; When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor point value is increased by 1, at this time, the dynamic anchor point value is the same as the position value of the predecessor positive partner of the negative item in the position list, which indicates that the current prefix sequence has matched the predecessor positive partner in the target query sequence. At this time, the positive partner corresponding to the negative item is removed from the candidate, that is, the positive partner corresponding to the negative item is removed from the processed candidate items, and the positive partner corresponding to the negative item is not continued to be expanded. After the positive partner corresponding to the negative item is removed from the processed candidate items, the remaining candidate items are expanded to obtain sequence candidate modes with a length of 2, and the sequence candidate modes with the length of 2 are stored in the sequence mode table. Then, the current prefix sequence is continued to be matched with the successor positive partner of the negative item. When the current prefix sequence matches the successor positive partner of the negative item, the dynamic anchor point value is continued to be increased by 1, at this time, the dynamic anchor point value is equal to the position value of the successor positive partner of the negative item in the position list minus 1, which indicates that the current prefix sequence has completely matched the target query sequence. The positive partner corresponding to the negative item in the target query sequence is added to the processed candidate items, and these candidate items are used as initial candidate items to obtain sequence candidate modes with a length of 3 for continued expansion; When the current prefix sequence does not match the predecessor positive partner of the negative item, no matter whether the current prefix sequence matches the successor positive partner of the negative item in the target query sequence or not, the dynamic anchor point value remains unchanged, which indicates that the current prefix sequence has not started to match the target query sequence. Each candidate item in the processed candidate items obtained in step S2-2 is directly expanded to obtain sequence candidate modes with a length of 2, and the sequence candidate modes with the length of 2 are stored in the sequence mode table. At this time, the processed candidate items are used as initial candidate items to obtain sequence candidate modes with a length of 3 for continued expansion; (2) If only the predecessor positive partner of the negative item exists (for example, the target query sequence is <a,¬b>), the processed candidate items are mode-expanded to obtain sequence candidate modes with a length of 2, and the sequence candidate modes with the length of 2 are stored in the sequence mode table. Step (2) specifically includes the following steps: The current prefix sequence is matched with the predecessor positive partner of the negative item; When the current prefix sequence matches the positive predecessor of the negative item, the dynamic anchor value is incremented by 1, and the dynamic anchor value is the same as the position value of the positive predecessor of the negative item in the position list, which means that the current prefix sequence has matched the positive predecessor in the target query sequence; for example, the target query sequence is <a,¬b>, and if the current prefix sequence is< / c> The current prefix sequence The predecessor positive partner position of the negative item in the target query sequence <a,¬b> is matched, b is not allowed to appear after a, the positive partner after the predecessor positive partner cannot appear after the negative item, therefore, the positive partner corresponding to the negative item in the target query sequence is removed from the candidate; then, each candidate left after the removal of the positive partner corresponding to the negative item in the processed candidate is expanded, the sequence candidate mode with a length of 2 is obtained, and the sequence candidate mode with a length of 2 is saved in the sequence mode table; (3) if only the successor positive partner of the negative item exists (for example, the target query sequence is <¬b, c>), the processed candidate is mode-expanded to obtain the sequence candidate mode with a length of 2, and the sequence candidate mode with a length of 2 is saved in the sequence mode table; step (3) specifically includes the following steps: When only the successor positive partner of the negative item exists and the predecessor positive partner of the negative item does not exist, the position of the predecessor positive partner is set to 0, and the dynamic anchor point value is equal to the position value of the predecessor positive partner. Since there is no predecessor positive partner of the negative item in the target query sequence, it is indicated that the positive partner corresponding to the negative item needs to be processed at present, and the processing mode is to remove the positive partner corresponding to the negative item from the candidate; for example, the target query sequence is <¬b, c>, and if the current prefix sequence is the target query sequence requires <c>not allowed to appear before Therefore, the present application removes the negative items in the target query sequence corresponding positive partner The removed candidate; then, the positive partners corresponding to the negative items in the processed candidate are removed, and the remaining candidate is expanded to obtain a sequence candidate pattern with a length of 2, and the sequence candidate pattern with a length of 2 is saved in the sequence pattern table. The setting of step S2-3-2 enables the present application to match the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence in the process of mining the sequence pattern containing the negative target query sequence; the above-mentioned setting of the present application not only effectively ensures that the generated target sequence pattern containing the target query sequence meets the standard in support, but also enables the generated target sequence pattern containing the target query sequence to be highly consistent with the target query sequence in sequence structure, so that the present application takes less time to mine the target sequence pattern; the present application effectively solves the problem that most existing product recommendation systems cannot match the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item based on the guidance of the negative target query sequence in the process of mining the sequence pattern containing the negative target query sequence, resulting in a large number of pseudo-target sequence patterns such as <a, a> which meet the standard in support but do not match the target semantics of the target sequence pattern containing the target query sequence in sequence structure, and further resulting in a long time for target sequence pattern mining.
[0029] S2-4, recursively expand the sequence candidate pattern with a length of 2 based on the steps described in step S2-3 until a sequence candidate pattern with a length of 2m+1 is obtained, and save the sequence candidate pattern with a length of 2m+1 in the sequence pattern table; wherein m is equal to the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table; in the present application, the reason for setting the length of the sequence candidate pattern to 2m+1 is as follows: since the encoded shopping sequence is composed of 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 maximum target sequence pattern containing the encoded shopping sequence corresponding to the longest encoded shopping sequence is <N P N P...P N>, N represents a negative item, and P represents a positive item, the maximum target sequence pattern length is 2m+1, therefore, the sequence candidate pattern with a length of 2m+1 is recursively expanded in the present application.
[0030] S2-5, delete the sequence candidate pattern in the sequence pattern table with a length of 2m+1 that does not contain the target query sequence, and the remaining sequence candidate pattern with a length of 2m+1 is the target sequence pattern, and the support of the target sequence pattern is calculated. S3, the application layer receives the target sequence pattern output by the algorithm layer and its support degree, sorts the target sequence pattern output by the algorithm layer according to the size of the support degree, and then adjusts the content displayed on the platform interface in combination with the corresponding user ID; at the same time, the adjustment record is saved, a log file is generated and transmitted to the data storage layer for archival storage. In the present application, the application layer will automatically optimize the platform content display strategy according to the target sequence pattern (the target sequence pattern in the present application can accurately reflect the user behavior preference) and its support degree, so that the recommendation result is more in line with the real intention of the user. After completing the content priority adjustment, the application layer presents the recommended content to the user through the platform interface. The display of the recommended information can include content title, image, key attributes and other detailed information to ensure that the user can fully understand the recommended content. After the user browses the recommended content, the user can interact according to his own interest. For example, if the user is interested in the recommended content and makes a purchase, the application layer will record the behavior of purchasing the goods, and update the user shopping data in real time. The updated user shopping data is transmitted back to the data storage layer through the application layer. For example, The greater the support degree of the target sequence pattern containing the target query sequence <a,¬b,c> output by the algorithm layer, the higher the frequency of the user's behavior of purchasing A brand mobile phone, not purchasing B brand tablet, and purchasing C brand earphone. Therefore, the commodity recommendation system will display more A brand mobile phones and C brand earphones and less B brand tablets on the platform interface in combination with the corresponding user ID.
[0031] Test: The present application uses IBM data generator to generate test set Data1 for testing. The acquisition website of IBM data generator is: https: / / www.philippe-fournier-viger.com / spmf / index.php?link=datasets.php; the present application adjusts the parameters of IBM data generator to control the data scale, shopping sequence complexity and pattern distribution of test set Data1, so as to test the mining efficiency of the method described in the present application, wherein the adjusted parameters include C: the number of customers; T: the average number of transactions of each customer; S: the average number of goods per transaction; I: the length of the maximum pattern, that is, the size of the maximum pattern that can be obtained by pattern connection; DB: the number of sequence patterns; N: the number of different goods; The acquisition method of the data set Data1 of the present application is: the DS1 data set is obtained under the condition that the parameters of the IBM data generator are configured as C=8, T=8, S=6, I=8, DB=10K (wherein 10K=10000) and N=100.
[0032] To verify the effectiveness of the recommended method (hereinafter referred to as Ours method) described in the present application, the present application selects an existing recommendation method and an ablation experiment comparison method to test the data set Data1 based on the recommended method described in the present application; wherein the existing recommendation method is the SC-NSP method (from the paper "SC-NSP: An efficient algorithm for mining negative sequential patterns"); the ablation experiment comparison method is referred to as the TaNSP method in the present application, and the difference between the TaNSP method and the method described in the present application is that: 1. Steps S2-2 to S2-4 in the method described in the present application are deleted; 2. The TaNSP method is based on the initial candidate obtained in step S2-1-4 of the method described in the present application to expand, and calculate the support of the expanded candidate sequence pattern, and the expanded candidate sequence pattern with a support greater than or equal to a preset minimum support (the preset minimum support is 2) is taken as a candidate sequence pattern with a length of 2, and then recursively expanding in this way until a sequence candidate pattern with a length of 2m+1 is obtained, m is the length of the longest encoded shopping sequence in the encoded shopping behavior sequence data table.
[0033] Test 1: The present application tests the mining time of the above-mentioned three methods (the above-mentioned three methods refer to the Ours method, the SC-NSP method and the TaNSP method) based on the data set Data1 under the condition of the same support threshold to mine the target sequence pattern containing the positive target query sequence <(70, 91)>), and the test result is as follows< / c> Figure 1 as shown; Test 2: The present application tests the mining time of the above three methods in the same support threshold condition based on the Data1 data set for mining the target sequence pattern containing the negative target query sequence <(¬71, 91)>, and the test result is as shown in Figure 2 ; Test 3: The present application tests the number of pattern of the target sequence pattern mined by the above three methods in the same support threshold condition based on the Data1 data set for mining the target sequence pattern containing the positive target query sequence <(70, 91)>, and the test result is as shown in Figure 3 ; Test 4: The present application tests the number of pattern of the target sequence pattern mined by the Ours method and the TaNSP method in the same support threshold condition based on the Data1 data set for mining the target sequence pattern containing the negative target query sequence <(¬71, 91)>, and the test result is as shown in Figure 4 ; Test 5: The present application tests the memory occupation when the Ours method and the TaNSP method are used to mine the target sequence pattern containing the positive target query sequence <(70, 91)> in the same support threshold condition based on the Data1 data set, and the test result is as shown in Figure 5 ; Test 6: The present application tests the memory occupation when the above three methods are used to mine the target sequence pattern containing the negative target query sequence <(¬71, 91)> in the same support threshold condition based on the Data1 data set, and the test result is as shown in Figure 6 ; Test 7: The application tests the cross-point number improvement percentage of the above three methods when mining the target sequence pattern containing the positive target query sequence <(70, 91)> based on the Data1 dataset under the condition of the same support threshold. The test results are shown in Table 7. Figure 7 Test 8: The application tests the cross-point number improvement percentage of the above three methods when mining the target sequence pattern containing the negative target query sequence <(¬71, 91)> based on the Data1 dataset under the condition of the same support threshold. The test results are shown in Table 8. Figure 8
[0034] In the application, Figure 7 and Figure 8 , the order of the abscissa respectively represents Figure 1 and Figure 2 the order of the minimum support threshold of the abscissa; taking order 1 in Figure 7 as an example, order 1 indicates that the minimum support threshold used in the test in Figure 7 is the first minimum support threshold 0.2350 of the abscissa in Figure 1 ; taking order 2 in Figure 7 as an example, order 2 indicates that the minimum support threshold used in the test in Figure 7 is the second minimum support threshold 0.2352 of the abscissa in Figure 1 .
[0035] In the application, Figure 7 and Figure 8 , Q1 represents the cross-point number improvement percentage of the Ours method relative to the SC-NSP method, and Q2 represents the cross-point number improvement percentage of the Ours method relative to the TaNSP method; taking Q1 and Q2 in Figure 7 as an example, Figure 7 , the cross-point number improvement percentage Q1 calculation formula is shown in formula (1), and the cross-point number improvement percentage Q2 calculation formula is shown in formula (2): Q1= (|X1-Y1| / X1) × 100% (1) In formula (1), X1 represents the cross-point number mined by the SC-NSP method based on the Data1 dataset when mining the target sequence pattern containing the positive target query sequence <(70, 91)>, and Y1 represents the cross-point number mined by the Ours method based on the Data1 dataset when mining the target sequence pattern containing the positive target query sequence <(70, 91)>.
[0036] Q2= (|X2-Y2| / X2) × 100% (2) In formula (2), X2 represents the number of intersection points mined by the TaNSP method based on the Data1 dataset when mining the target sequence pattern containing the positive target query sequence <(70, 91)>, and Y2 represents the number of intersection points mined by the Ours method based on the Data1 dataset when mining the target sequence pattern containing the positive target query sequence <(70, 91)>.
[0037] Figure 8 In the Q1 and Q2 calculation methods, the formula (1) and the formula (2) are also respectively shown, except that Figure 8 In the formula for calculating Q1, X1 represents the number of intersection points mined by the SC-NSP method based on the Data1 dataset when mining the target sequence pattern containing the negative target query sequence <(¬71, 91)>, and Y1 represents the number of intersection points mined by the Ours method based on the Data1 dataset when mining the target sequence pattern containing the negative target query sequence <(¬71, 91)>. Figure 8 In the formula for calculating Q2, X2 represents the number of intersection points mined by the TaNSP method based on the Data1 dataset when mining the target sequence pattern containing the positive target query sequence <(¬71, 91)>, and Y2 represents the number of intersection points mined by the Ours method based on the Data1 dataset when mining the target sequence pattern containing the positive target query sequence <(¬71, 91)>.
[0038] From Figure 1It can be seen that: when the method, the SC-NSP method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the positive target query sequence <(70, 91)>, the mining time of the method is 204670ms, 190000ms, 186111ms, 149608ms, 139608ms and 124625ms respectively when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358 and 0.2360 respectively; the mining time of the SC-NSP method is 411908ms, 381346ms, 346155ms, 247040ms, 237661ms and 227174ms respectively when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358 and 0.2360 respectively; the mining time of the TaNSP method is 330444ms, 324300ms, 314735ms, 203344ms, 191160ms and 179608ms respectively when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358 and 0.2360 respectively. Obviously, compared with the SC-NSP method and the TaNSP method based on the Data1 data set, the mining time of the method containing the positive target query sequence <(70, 91)> is significantly reduced; for example, when the minimum support threshold is 0.2350, the mining time of the method containing the positive target query sequence <(70, 91)> based on the Data1 data set is reduced by 46.33% and 38.06% respectively compared with the SC-NSP method and the TaNSP method, which indicates that the method can complete the mining task faster with less mining time and higher running efficiency when mining the target sequence pattern containing the positive target query sequence.
[0039] From Figure 2It can be seen that: when the method, the SC-NSP method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the negative target query sequence <(¬71, 91)>, the mining time of the method is 25050 ms, 17925 ms, 13701 ms, 10034 ms, 8287 ms and 6781 ms respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34 respectively; the mining time of the SC-NSP method is 44473 ms, 24282 ms, 20148 ms, 14249 ms, 10551 ms and 10363 ms respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34 respectively; the mining time of the TaNSP method is 41250 ms, 22909 ms, 22695 ms, 11506 ms, 9037 ms and 7027 ms respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34 respectively. Obviously, compared with the SC-NSP method and the TaNSP method based on the Data1 data set, the mining time of the method for mining the target sequence pattern containing the negative target query sequence <(¬71, 91)> is significantly reduced; for example, when the minimum support threshold is 0.24, compared with the SC-NSP method and the TaNSP method based on the Data1 data set, the mining time of the method for mining the target sequence pattern containing the negative target query sequence <(¬71, 91)> is reduced by (44473-25050) / 44473x100%=43.67%, (41250-25050) / 41250x100%=39.27% respectively, which shows that the method has less mining time and higher running efficiency when mining the target sequence pattern containing the negative target query sequence, and can complete the mining task faster.
[0040] From Figure 3It can be seen that: when the method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the positive target query sequence <(70, 91)>, the number of target sequence patterns mined by the method is 106, 106, 106, 105, 105, and 104 respectively when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360 respectively; the number of target sequence patterns mined by the TaNSP method is 106, 106, 106, 105, 105, and 104 respectively when the minimum support threshold is 0.2350, 0.2352, 0.2354, 0.2356, 0.2358, and 0.2360 respectively. Obviously, compared with the ablation experiment method-TaNSP method, the number of target sequence patterns mined by the method is consistent with the TaNSP method, which shows that the method can not only significantly shorten the mining time of target sequence patterns, but also will not affect the number of mined target sequence patterns.
[0041] Figure 4 It can be seen that: when the method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the negative target query sequence <(¬71, 91)>, the number of target sequence patterns mined by the method is 719, 498, 368, 281, 211, and 171 respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34 respectively; the number of target sequence patterns mined by the TaNSP method is 719, 498, 368, 281, 211, and 171 respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32, and 0.34 respectively. Obviously, compared with the TaNSP method, the number of target sequence patterns mined by the method is consistent with the TaNSP method, which shows that the method can not only significantly shorten the mining time of target sequence patterns, but also will not affect the number of mined target sequence patterns.
[0042] From Figure 5It can be seen that: when the method, the SC-NSP method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the positive target query sequence <(70, 91)>, the memory occupancy of the method is respectively 2803.88963MB, 1386.85934MB, 1339.78362MB, 1018.18073MB, 1010.40224MB and 2904.02102MB when the minimum support threshold is respectively 0.2350, 0.2352, 0.2354, 0.2356, 0.2358 and 0.2360; the memory occupancy of the SC-NSP method is respectively 3013.37029MB, 2921.68249MB, 2977.42213MB, 3039.42637MB, 2909.54064MB and 3193.91071MB when the minimum support threshold is respectively 0.2350, 0.2352, 0.2354, 0.2356, 0.2358 and 0.2360; the memory occupancy of the TaNSP method is respectively 2996.52341MB, 3037.65038MB, 2956.62249MB, 2826.39902MB, 2858.53406MB and 3017.01343MB when the minimum support threshold is respectively 0.2350, 0.2352, 0.2354, 0.2356, 0.2358 and 0.2360. Obviously, when the minimum support threshold is in the range of 0.235-0.2358, the memory occupancy of the method based on the Data1 data set containing the positive target query sequence <(70, 91)> is significantly reduced compared with the SC-NSP method and the TaNSP method; for example, when the minimum support threshold is respectively 0.2358, the memory occupancy of the method based on the Data1 data set containing the positive target query sequence <(70, 91)> is respectively reduced by (2909.54064-1010.40224) / 2909.54064x100%=65.27%, (2858.53406-1010.40224) / 2858.53406x100%=64.65% compared with the SC-NSP method and the TaNSP method, which shows that the memory occupancy of the method containing the positive target query sequence is small, and the memory resources can be effectively saved.
[0043] From Figure 6It can be seen that: when the method, the SC-NSP method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the negative target query sequence <(¬71, 91)>, the memory occupancy of the method is 1418.72906MB, 300.83718MB, 1139.24693MB, 1029.80030MB, 186.09807MB and 238.62485MB respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34 respectively; the memory occupancy of the SC-NSP method is 1837.23953MB, 1372.51440MB, 742.51511MB, 519.68388MB, 1045.76758MB and 585.49432MB respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34 respectively; the memory occupancy of the TaNSP method is 1922.64864MB, 1666.21246MB, 747.59499MB, 491.96923MB, 941.23230MB and 944.45656MB respectively when the minimum support threshold is 0.24, 0.26, 0.28, 0.30, 0.32 and 0.34 respectively. Obviously, when the minimum support threshold is in the range of 0.24-0.26 and 0.32-0.34, the memory occupancy of the method based on the Data1 data set containing the negative target query sequence <(¬71, 91)> is significantly reduced compared with the SC-NSP method and the TaNSP method; for example, when the minimum support threshold is 0.32, the memory occupancy of the method based on the Data1 data set containing the negative target query sequence <(¬71, 91)> is reduced by (1045.76758-186.09807) / 1045.76758x100%=82.20%, (941.23230-186.09807) / 941.23230x100%=80.23% compared with the SC-NSP method and the TaNSP method, which shows that the memory occupancy of the method is also small when mining the target sequence pattern containing the negative target query sequence, and the memory resource can be effectively saved.
[0044] From Figure 7It can be seen that: when the method, the SC-NSP method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the positive target query sequence <(70, 91)>, the percentage of the number of intersection points Q1 obtained by the method of the application relative to the SC-NSP method is 96.96 at order 2, 96.95 at order 3, 96.94 at order 4, 96.94 at order 5, and 96.94 at order 6. The percentage of the number of intersection points Q2 obtained by the method of the application relative to the TaNSP method is 97.31 at order 2, 97.31 at order 3, 97.30 at order 4, 97.30 at order 5, and 97.30 at order 6. This shows that the percentage of the number of intersection points of Q1 and Q2 remains at a high level and the trend is stable at each order, and the percentage of Q2 is slightly higher than that of Q1, but both are in the high proportion interval of 96.94 and above, which indicates that the method of the application has a high and stable intersection point proportion in the target sequence pattern mining process containing the positive target query sequence <(70, 91)>, which can guarantee the high reliability and accuracy of the target sequence pattern mining result, and further enable the commodity recommendation system to make more accurate and more reliable analysis and decision based on the target sequence pattern mining result.
[0045] From Figure 8 It can be seen that: when the method, the SC-NSP method and the TaNSP method based on the Data1 data set mine the target sequence pattern containing the positive target query sequence <(70, 91)>, the percentage of the number of intersection points Q1 obtained by the method of the application relative to the SC-NSP method is 96.96 at order 2, 96.95 at order 3, 96.94 at order 4, 96.94 at order 5, and 96.94 at order 6. The percentage of the number of intersection points Q2 obtained by the method of the application relative to the TaNSP method is 97.31 at order 2, 97.31 at order 3, 97.30 at order 4, 97.30 at order 5, and 97.30 at order 6. This shows that the percentage of the number of intersection points of Q1 and Q2 remains at a high level and the trend is stable at each order, and the percentage of Q2 is slightly higher than that of Q1, but both are in the high proportion interval of 96.94 and above, which indicates that the method of the application has a high and stable intersection point proportion in the target sequence pattern mining process containing the positive target query sequence <(70, 91)>, which can guarantee the high reliability and accuracy of the target sequence pattern mining result, and further enable the commodity recommendation system to make more accurate and more reliable analysis and decision based on the target sequence pattern mining result.
[0046] Obviously, the cross point quantity improvement percentage Q2 is higher than the cross point quantity improvement percentage Q1 under each sequence, but Q1 still remains at the level of 80.67 and above. This shows that the method described in the application still maintains a certain level of cross point proportion when mining the target sequence pattern containing the negative target query sequence <(¬71, 91)>, which guarantees the reliability of the target sequence pattern mining result.
Claims
1. A commodity recommendation method based on target sequence pattern mining, characterized in that: Comprise the following steps: S1, the user shopping data is sequentially subjected to data cleaning and classification and serialization processing, and the uncoded user shopping behavior sequence is obtained, and the user ID corresponding thereto is counted into the shopping behavior sequence data table according to time sequence; S2, the user shopping behavior sequence is coded to obtain the coded shopping sequence, and the sequence candidate mode with a length of 2m+1 is mined from the coded shopping sequence; the mode not containing the target query sequence is deleted, and the remaining mode is the target sequence mode, and the support degree of the target sequence mode is calculated; In the process of mining the sequence candidate mode with a length of 2m+1 from the coded shopping sequence, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence; S3, the target sequence mode is sorted according to the support degree, and then the content displayed on the platform interface is adjusted in combination with the corresponding user ID. 2.The commodity recommendation method based on target sequence pattern mining according to claim 1, characterized in that: Step S2 comprises the following specific steps: S2-1, the uncoded user shopping behavior sequence is coded to obtain the coded shopping sequence; the positive and negative sequence candidate modes with a length of 1 are obtained based on the coded shopping sequence, and are taken as initial candidate items; S2-2, the initial candidate items are pruned to obtain processed candidate items; S2-3, according to the type of the target query sequence, the processed candidate items are mode-expanded to obtain sequence candidate modes with a length of 2; in step S2-3, when the target query sequence is a negative target query sequence, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence; S2-4, the sequence candidate mode with a length of 2 is recursively expanded according to step S2-3, until the sequence candidate mode with a length of 2m+1 is obtained; m is equal to the length of the longest coded shopping sequence; S2-5, the sequence candidate mode not containing the target query sequence in the sequence candidate mode with a length of 2m+1 is deleted, and the remaining sequence candidate mode with a length of 2m+1 is the target sequence mode, and the support degree of the target sequence mode is calculated. 3.The commodity recommendation method based on target sequence pattern mining according to claim 2, characterized in that: Step S2-1 specifically comprises the following steps: S2-1-1, the uncoded user shopping behavior sequence is coded to obtain the coded shopping sequence; S2-1-2, the coded shopping behavior sequence data table is deleted, which does not contain the target query sequence; a corresponding bitmap is created for each item in the coded shopping behavior sequence data table; S2-1-3, the support degree of each item is obtained based on the number of times that 1 appears in the corresponding bitmap of each item; The item with a support degree greater than or equal to a preset minimum support degree is taken as the positive sequence candidate mode with a length of 1; S2-1-4, the positive sequence candidate mode with a length of 1 is negatively transformed to obtain the negative sequence candidate mode with a length of 1; the positive and negative sequence candidate modes with a length of 1 are taken as initial candidate items for obtaining sequence candidate modes with a length of 2. 4.The commodity recommendation method based on target sequence pattern mining according to claim 2, characterized in that: Step S2-2 includes the following steps: taking each initial candidate as a current prefix sequence and an extension item respectively, obtaining a bitmap of the maximum positive subsequence of the current prefix sequence, the extension item and the target query sequence; Pruning processing is performed based on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence to obtain the processed candidate.
5. The product recommendation method based on target sequence pattern mining according to claim 4, characterized in that: In step S2-2, the pruning processing is performed based on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence, and specifically includes the following steps: 1) When the extension item is a positive extension item, pruning processing is performed based on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence to obtain the candidate after pruning screening, including the following steps: Logical AND operation is performed on the current prefix sequence, the extension item and the bitmap of the maximum positive subsequence to obtain a final bitmap, the support degree of the final bitmap is calculated, and if the support degree is less than a preset minimum support degree, pruning is directly performed, and the positive extension item that is not pruned is taken as the candidate after pruning screening; 2) When the extension item is a negative extension item, the negative extension item is not pruned; The candidate after pruning screening and the negative extension item constitute the processed candidate. 6.The commodity recommendation method based on target sequence pattern mining according to claim 2, characterized in that: Step S2-3 includes the following steps: S2-3-1, when the target query sequence is a positive target query sequence, performing pattern expansion on the processed candidate to obtain a sequence candidate pattern with a length of 2; S2-3-2, when the target query sequence is a negative target query sequence, performing pattern expansion on the processed candidate to obtain a sequence candidate pattern with a length of 2; in step S2-3-2, the matching of the current prefix sequence with the predecessor positive partner of the negative item and the successor positive partner of the negative item is implemented based on the guidance of the negative target query sequence. 7.The commodity recommendation method based on target sequence pattern mining according to claim 6, characterized in that: Step S2-3-2 specifically includes the following steps: When the target query sequence is a negative target query sequence, first, a position list is constructed for the target query sequence; then, the negative item in the target query sequence is identified, and the positive partner corresponding to the negative item is known according to the negative item, and the predecessor positive partner and the successor positive partner of the negative item are identified from the target query sequence; A dynamic anchor value is set to track the matching of the current prefix sequence and the target query sequence, and the initial value of the dynamic anchor value is set to 0; (1) If both the predecessor positive partner and the successor positive partner of the negative item exist, performing pattern expansion on the processed candidate to obtain a sequence candidate pattern with a length of 2; (2) If only the predecessor positive partner of the negative item exists, performing pattern expansion on the processed candidate to obtain a sequence candidate pattern with a length of 2; (3) If only the successor positive partner of the negative item exists, performing pattern expansion on the processed candidate to obtain a sequence candidate pattern with a length of 2. 8.The commodity recommendation method based on target sequence pattern mining according to claim 7, characterized in that: In step S2-3-2, the predecessor positive partner refers to the positive item in the target query sequence that is located before the position of the negative item and is closest to the negative item, and the successor positive partner refers to the positive item in the target query sequence that is located after the position of the negative item and is closest to the negative item; when the negative item has no predecessor positive partner, the position value of the predecessor positive partner is 0 by default; and when the negative item has no successor positive partner, the position value of the successor positive partner is not counted in the position list. 9.The commodity recommendation method based on target sequence pattern mining according to claim 7, characterized in that: Step (1) specifically includes the following steps: Determine whether the current prefix sequence matches the predecessor positive partner of the negative item; When the current prefix sequence matches the predecessor positive partner of the negative item, the dynamic anchor value is increased by 1, the dynamic anchor value is the same as the position value of the predecessor positive partner of the negative item in the position list, the positive partner corresponding to the negative item is removed from the processed candidate items, and the remaining candidate items are extended to obtain sequence candidate patterns with a length of 2; then, the current prefix sequence is continuously matched with the successor positive partner of the negative item, when the current prefix sequence matches the successor positive partner of the negative item, the dynamic anchor value is continuously increased by 1, the dynamic anchor value is equal to the position value of the successor positive partner of the negative item in the position list minus 1, and the positive partner corresponding to the negative item in the target query sequence is added to the processed candidate items, and these candidate items are used as initial candidate items to obtain sequence candidate patterns with a length of 3 for continuous extension; When the current prefix sequence does not match the predecessor positive partner of the negative item, no matter whether the current prefix sequence matches the successor positive partner of the negative item in the target query sequence or not, the dynamic anchor value remains unchanged, and each candidate item in the processed candidate items obtained in step S2-2 is directly extended to obtain sequence candidate patterns with a length of 2; at this time, the processed candidate items obtained in step S2-2 are used as initial candidate items to obtain sequence candidate patterns with a length of 3 for continuous extension.
10. A commodity recommendation system for implementing the commodity recommendation method based on target sequence pattern mining according to claim 1, characterized in that: The data storage layer, the algorithm layer and the application layer are included: The data storage layer sequentially performs data cleaning, classification and serialization processing on user shopping data to obtain uncoded user shopping behavior sequences, and the uncoded user shopping behavior sequences and corresponding user IDs are counted in the shopping behavior sequence data table according to time sequence; The data storage layer transmits the shopping behavior sequence data table to the algorithm layer; The algorithm layer encodes the user shopping behavior sequences to obtain coded shopping sequences, mines sequence candidate patterns with a length of 2m+1 from the coded shopping sequences, deletes patterns not containing the target query sequence, and calculates the support degree of the target sequence pattern; In the process of mining sequence candidate patterns with a length of 2m+1 from the coded shopping sequences, the current prefix sequence is matched with the predecessor positive partner of the negative item and the successor positive partner of the negative item under the guidance of the negative target query sequence; The application layer is used for sorting the target sequence patterns according to the support degree, and then adjusting the content displayed on the platform interface in combination with the corresponding user ID.
Citation Information
Patent Citations
Application of positive and negative sequence mode screening method in customer purchasing behavior analysis
CN104732419A
News recommendation method and system based on user behavior detection and computer equipment
CN110489652A
Method and system for detecting abnormal operation of client based on Apriori algorithm
CN117971921A
Commodity recommendation method and system based on efficient repeated negative sequence pattern mining
CN120146968A
Commodity real-time recommendation method and system capable of efficiently using repeated negative sequence pattern mining
CN121052908A
Cited By
Commodity recommendation method and system based on negative sequence pattern loose constraint
CN122222711A
Commodity recommendation method and system based on negative sequence pattern loose constraint
CN122222711B