Cigarette recommendation method, system and equipment based on deep learning and medium

By using a deep learning-based cigarette recommendation method, data is collected and cleaned, dynamic features are calculated, time-series sequence encoding is performed, a deep learning model is trained, and a recommendation strategy is generated. This solves the problems of low order fulfillment rate and insufficient exposure of new products in existing technologies, and achieves a higher order fulfillment rate and greater exposure of new products.

CN120876010APending Publication Date: 2025-10-31SHANDONG INSPUR DIGITAL BUSINESS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510856766.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing cigarette recommendation technologies are unable to effectively improve order fulfillment rates, reduce retailers' inventory-to-sales ratios, and provide insufficient exposure for new products and potential brands.

Method used

A deep learning-based cigarette recommendation method is adopted. By collecting and cleaning data, calculating dynamic features, performing time-series encoding, and training a deep learning model, a recommendation strategy is generated by combining customer and product features to optimize the recommendation of new products and potential brands.

Benefits of technology

It improved order fulfillment and order completion rates, reduced retailers' inventory-to-sales ratio, and increased exposure for new products and potential brands.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120876010A_ABST
    Figure CN120876010A_ABST
Patent Text Reader

Abstract

The invention discloses a cigarette recommendation method, system and equipment based on deep learning and a medium, belongs to the technical field of deep learning and cigarette recommendation, and aims to solve the technical problem of how to improve the order demand satisfaction rate, reduce the storage and sales of retailers and promote the exposure of new products and potential brands. According to the technical scheme, the method comprises the steps of data collection, wherein customer data, cigarette data, order data, delivery data, customer actual inventory data and customer actual sales data are collected; data cleaning and integration: integrating customer data, cigarette data, order data, delivery data, customer actual inventory data and customer actual sales data to generate a plurality of data tables, and performing cleaning, filtering and merging processing on dictionaries rawdata in the plurality of data tables through a cleanandmerge function to obtain an integrated data table; calculating dynamic features based on the time window; encoding a sequential sequence; and generating a recommendation strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning and cigarette recommendation technology, specifically a cigarette recommendation method, system, device, and medium based on deep learning. Background Technology

[0002] Cigarettes are tobacco products made by wrapping tobacco in cigarette paper. There are many types, and the existing technologies recommended for making cigarettes are relatively fixed. This results in low demand satisfaction among retailers and limitations in developing new products and competing with brands within the same price range.

[0003] Therefore, how to improve the order demand fulfillment rate, reduce retailers' inventory and sales, and promote the exposure of new products and potential brands are the technical problems that urgently need to be solved. Summary of the Invention

[0004] The technical objective of this invention is to provide a cigarette recommendation method, system, device, and medium based on deep learning to address the issues of improving order fulfillment rates, reducing retailers' inventory and sales, and promoting the exposure of new products and potential brands.

[0005] The technical objective of this invention is achieved as follows: a cigarette recommendation method based on deep learning, the specific method of which is as follows:

[0006] Data collection: Collect customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data;

[0007] Data cleaning and integration: Integrate customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data to generate several data tables. Use the clean_and_merge function to clean, filter, and merge the dictionary raw_data_dict in multiple data tables to obtain the integrated data table.

[0008] Calculate dynamic features based on time window: The integrated data table's data frame df and an optional window size parameter window_size (default is 12) are used to calculate dynamic indicators through the calculate_dynamic_features function to analyze the demand satisfaction rate, order fulfillment rate, and inventory-to-sales ratio of customer and product combinations.

[0009] Time series encoding: The key time series indicators are extracted from the integrated data table using the build_time_series_features function and converted into a three-dimensional matrix structure suitable for time series analysis;

[0010] Training a deep learning model: Retailers' historical cigarette ordering behavior is used as time-series data. A Transformer is used to process this data, and each retailer's weekly cigarette orders are used as a time-series data. An LSTM is used to capture periodic purchasing patterns. Customer attributes (static features) and product metrics (dynamic features) are then combined, and embedding is used to process customer and product category variables. The problem is then modeled as a multi-class classification problem, with each cigarette as a category. The probability of ordering is predicted, and collaborative filtering combined with a deep learning model is used to predict the top N products based on distribution volume and other business rules.

[0011] Recommendation strategy generation: The smaller of the distribution volume and inventory volume is used as the order limit. When generating the recommendation strategy, cigarettes in the distribution data are first screened out, and the recommended volume is adjusted according to the current inventory volume. Cigarettes with high order fulfillment rates are given priority, while cigarettes with high social inventory-to-sales ratios are given lower priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all distributed cigarettes. Customer level and market type are added as features to the deep learning model, and different price levels of cigarettes are filtered or weighted according to the corresponding features during recommendation.

[0012] As a preferred option, customer data includes retailer code (license_code), account manager (sls_man), tier (cust_type), and market type (market_type);

[0013] Cigarette data includes cigarette code (item_id), cigarette name (item_name), price range (price_range), price (price), brand (brand), and whether it is a new product (is_new);

[0014] Order data includes order number (bill_code), order date (order_date), retailer code (license_code), cigarette code (item_id), order quantity (order_qty), demand quantity (demand_qty), and limit quantity (limit_qty);

[0015] The delivery data includes the codes of the cigarettes delivered, the names of the cigarettes delivered, the codes of the retailers to which the delivery was made, and the delivery quantity (supply_qty).

[0016] Customer actual inventory data includes the retailer code with inventory (license_code), the cigarette code with inventory (item_id), the inventory date (inv_date), and the inventory quantity (inv_qty, unit: packs);

[0017] The actual sales data of a customer includes the retailer code with sales data, grade (cust_type), sold cigarette code, sales time (sale_tiem), sales quantity (sale_qty), and sales unit (0 for box / 1 for carton).

[0018] As a preferred method, data cleaning and integration are as follows:

[0019] Missing value handling: Process the data table with the key "orders" in the dictionary raw_data_dict of multiple data tables; if there are missing values ​​in the demand_qty (demand quantity) column, fill them with the values ​​in the order_qty (order quantity) column of the same row;

[0020] Outlier filtering: Filter the orders data table to retain only records where order_qty does not exceed 120% of limit_qty (limit), and exclude abnormal data where the order quantity clearly exceeds the reasonable range;

[0021] Multi-table joins: The processed 'orders' data table is merged with several other data tables. Specifically, it is first merged with the 'customers' table via the 'license_code' column; then merged with the 'items' table via the 'item_id' column; and then merged with the 'supply', 'inventory', and 'sales' tables via the ['license_code', 'item_id'] columns. The final result is a complete data table integrating customer information, product information, supply information, inventory information, and sales information.

[0022] Time format standardization: The order_date (order date) and inv_date (inventory date) columns in the merged data table are converted into a standard date and time format to ensure the consistency and operability of time data, thereby obtaining the merged data table.

[0023] As a preferred method, the dynamic features are calculated using a time window as follows:

[0024] Data grouping: Group the data frame df according to license_code (customer identifier) ​​and item_id (product identifier) ​​to ensure that subsequent calculations are based on the combination of each customer and product;

[0025] Demand fulfillment rate calculation: The ratio of the rolling sum of actual orders (order_qty) over the past window_size weeks to the rolling sum of demand (demand_qty) is calculated by adding a minimum value 1e-6 to the denominator to avoid division by zero, and the result is stored in a new column 'demand_ratio' in the data frame.

[0026] The fulfillment rate is calculated as the ratio of the rolling sum of actual orders (order_qty) over the past window_size weeks to the rolling sum of supply (supply_qty). This ratio reflects the proportion of actual orders to supply, taking into account supply limits. The result is stored in a new column, fulfill_ratio, in the data frame.

[0027] Inventory turnover ratio calculation: The ratio of the rolling average of the inventory quantity inv_qty over the past window_size weeks to the rolling average of the sales quantity sale_qty, reflecting the inventory turnover rate, that is, the relationship between inventory quantity and sales quantity, and the calculation result is stored in a new column inv_sale_ratio in the data frame;

[0028] Get dynamic features: Get the three dynamic features added after processing the data frame df: demand_ratio, fulfill_ratio, and inv_sale_ratio.

[0029] As a preferred embodiment, the time sequence encoding is as follows:

[0030] Extract key time-series metrics: Group the data frame (df) according to license_code (customer identifier), item_id (product identifier), and order_date (order date), and calculate the mean of order_qty (order quantity), demand_qty (demand quantity), inv_qty (inventory quantity), and sales_qty (sales quantity) for each group. Then, use the unstack() method to reshape the grouped results so that the date becomes the column index, which is convenient for subsequent time series analysis.

[0031] Resampling and imputation: The data is resampled weekly using the resample('W') method to ensure that the time series data has a fixed periodicity, and missing values ​​are imputed forward using the ffill() method to ensure the continuity of the time series.

[0032] Standardization: Initialize a StandardScaler object to standardize the data and reshape the time series feature data into a two-dimensional array in the form of: number of samples × number of features. Then, use the fit_transform() method to standardize the data so that the mean of each feature is 0 and the variance is 1.

[0033] Convert to a three-dimensional structure: Reshape the standardized data into a three-dimensional structure, in the form of: number of samples × number of time steps × number of features, to facilitate subsequent time series analysis or input to deep learning models.

[0034] Temporal sequence encoding: Obtain a three-dimensional array ts_scaled, in the form of: number of samples × number of time steps × number of features; where the number of features is fixed at 4, corresponding to order_qty, demand_qty, inv_qty and sale_qty respectively.

[0035] As a preferred approach, a deep learning model is built using TensorFlow and Keras to process customer features, product features, and time-series features, and outputs a probability distribution to predict cigarette recommendation results; specifically as follows:

[0036] Customer Feature Branch: Define an input layer cust_input with shape (10,) to represent that each customer's feature vector contains 10 features. Process the customer features through a fully connected layer cust_dense using the ReLU activation function, with an output dimension of 64.

[0037] Product feature branch: Define an input layer item_input with shape (8,) to represent that the feature vector of each product contains 8 features, and process the product features through a fully connected layer item_dense using the ReLU activation function, with an output dimension of 64;

[0038] Temporal feature branch: Define an input layer time_input with shape (6,32) to represent 6 weeks of historical time series data, each week containing 32 features. Process the time series data through a Transformer layer, which contains 2 Transformer encoder layers, with a model dimension of 32 and 4 attention heads.

[0039] Feature fusion: Customer features, product features, and time-series features processed by Transformer are fused through the Concatenate layer to form a comprehensive feature representation;

[0040] Output layer: The fused features are processed through a fully connected layer, using the Softmax activation function. The output dimension is len(item_ids), which represents the probability distribution of each item.

[0041] Model instantiation: Create a model instance named model using tf.keras.Model, specifying the input as [cust_input, item_input, time_input] and the output as output.

[0042] More specifically, the recommendation strategy is generated as follows:

[0043] Generate a candidate set of recommended cigarettes based on cigarette distribution data: A candidate product list is generated using the `generate_candidates` function based on customer identifiers, and then filtered to obtain eligible products and their supply quantities. Specifically: Obtaining distributed products: Products matching the input parameter `license_code` are filtered from the `supply` data frame; these are the distributed products for the corresponding customers. Merging data: The filtered distributed product data frames `supply_items` and `item` are merged using the `item_id` column to obtain detailed product information, and then merged with the `customer` data frame using the `license_code` column to obtain detailed customer information. Price filtering: Candidate products are filtered by price based on customer type `cust_type`: if the customer type is "low", only products with a price less than or equal to 15 are retained; if the customer type is "high", only products with a price greater than or equal to 30 are retained. Obtaining the list and data frame: A candidate product list is obtained, containing only the `item_id` and `supply_qty` columns, representing the product identifier and supply quantity respectively. The `generate_candidates` function returns a data frame containing eligible candidate products and their supply quantity information.

[0044] The recommendation order is determined based on business indicators such as demand fulfillment rate, order fulfillment rate, and social inventory-to-sales ratio. Specifically, the recommended product list is generated using the `recommend_items` function based on customer identifiers, and the top-ranked products are returned. This process includes: generating candidate products: calling the `generate_candidates(license_code)` function to generate a candidate product list `candidates` based on customer identifiers; loading a pre-trained model: loading a pre-trained recommendation model named `recommender.h5` for subsequent predictions; generating predictions: preparing input data using the `prepare_inputs(license_code)` function, and then generating predictions using the `model.predict()` method; and integrating business rules: weighting and integrating the predictions with other business rule indicators. The final scores (final_scores) are generated by combining the following weightings: prediction results (60% weight), demand satisfaction ratio (20% weight), the complement of inventory turnover (1-inventory_turnover) (10% weight), and order fulfillment ratio (10% weight). This combination of model predictions and business rules generates recommendations that better meet business needs. Result filtering: The `nlargest` method is used to filter the top `n` highest-scoring products from the candidate products and store them in `recommendations`. Descending order results: The filtered list of recommended products is sorted in descending order by `supply_qty` (supply quantity) to ensure that products with high supply are prioritized. The `recommend_items` function returns a data frame containing the top-ranked recommended products, sorted by supply quantity from highest to lowest.

[0045] The final recommendation result is formed by combining factors such as whether the product is new, the inventory-to-sales ratio, and a brand balancing strategy. Based on the recommendations, the `apply_business_rules` function applies business rules to the recommended product list to optimize the recommendation results, specifically as follows: New Product Promotion Rules: Check if the current month is January or June, indicating a peak season promotion period; if it is, only retain products with the `is_new` flag set to 1 (i.e., new products) in the recommended list, and only retain the first 3 new products; Inventory-to-Sales Ratio Filtering: Filter the recommended product list by inventory-to-sales ratio, retaining only products with an inventory-to-sales ratio less than 1.5; where the inventory-to-sales ratio is a measure of inventory turnover rate. Indicators such as limiting the inventory-to-sales ratio help ensure that recommended products have high turnover efficiency; Brand balancing strategy: Calculate the number of products from each brand in the recommended product list and store them in brand_dist; For brands with more than 3 products, exclude products from the recommended list and retain only the top 3 products from the other brands to achieve brand diversity and avoid the recommendation results being too concentrated on a few brands; Obtain the recommended product list after business rule processing: The apply_business_rules function returns the recommended product list after business rule processing to ensure that the recommendation results meet the requirements of peak season promotion, inventory turnover rate, and brand diversity.

[0046] A deep learning-based cigarette recommendation system is provided, which implements the deep learning-based cigarette recommendation method described above; the system includes:

[0047] The data acquisition module is used to collect customer data, cigarette data, order data, distribution data, actual customer inventory data, and actual customer sales data.

[0048] The data cleaning and integration module is used to integrate customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data to generate several data tables. The clean_and_merge function cleans, filters, and merges the dictionary raw_data_dict in multiple data tables to obtain the integrated data table.

[0049] The dynamic features module is used to calculate dynamic indicators using the calculate_dynamic_features function on the integrated data table's data frame df and an optional window size parameter window_size (default is 12), and to analyze customer and product combination demand satisfaction rate, order fulfillment rate, and inventory-to-sales ratio.

[0050] The time series encoding module is used to extract key time series indicators from the integrated data table through the build_time_series_features function and convert the key indicators into a three-dimensional matrix structure suitable for time series analysis.

[0051] The model training module uses retailers' historical cigarette ordering behavior as time-series data, processes it using a Transformer, and takes each retailer's weekly cigarette orders as a time series, capturing periodic purchasing patterns using an LSTM. It then combines customer attributes (static features) and product metrics (dynamic features), processing customer and product category variables through Embedding. Finally, it models the problem as a multi-class classification problem, with each cigarette as a category, predicting the probability of ordering. Collaborative filtering combined with a deep learning model is used to predict the top N products based on distribution volume and other business rules.

[0052] The recommendation strategy generation module uses the smaller of the distribution volume and inventory volume as the order limit. When generating the recommendation strategy, it first filters out cigarettes from the distribution data and adjusts the recommendation volume based on the current inventory volume. Cigarettes with high order fulfillment rates are given priority, while cigarettes with high social inventory-to-sales ratios are given lower priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all distributed cigarettes. Customer level and market type are added as features to the deep learning model, and different price levels of cigarettes are filtered or weighted according to the corresponding features during recommendation.

[0053] An electronic device includes: a memory and at least one processor;

[0054] The memory contains computer programs;

[0055] The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the deep learning-based cigarette recommendation method as described above.

[0056] A computer-readable storage medium storing a computer program that can be executed by a processor to implement the deep learning-based cigarette recommendation method described above.

[0057] The deep learning-based cigarette recommendation method, system, device, and medium of the present invention have the following advantages:

[0058] (i) This invention constructs a deep learning model based on key data such as the retailer's historical order data, retailer attribute data, cigarette product attributes, and distribution data, to recommend a set of cigarettes for the retailer to order in the next ordering cycle;

[0059] (ii) This invention improves the order fulfillment rate and order completion rate, reduces the inventory-to-sales ratio of retailers, and promotes the exposure of new products and potential brands.

[0060] (III) This invention applies the recommendation results to the actual orders of retailers. By analyzing the customer's cigarette order demand fulfillment rate, order completion rate, social inventory-to-sales ratio and new product exposure rate, the results have been improved; the statistical data is shown in Table 1.

[0061] Table 1 Statistical Data

[0062] Evaluation Dimensions No recommendation system Recommendation system Increase Demand fulfillment rate 58.3% 73.6% +26.2% - Order fulfillment rate 65.1% 82.46- +26.6% Inventory-to-sales ratio 2.15 1.68 -21.9% New product exposure 120 310 +158% Attached Figure Description

[0063] The invention will be further described below with reference to the accompanying drawings.

[0064] Appendix Figure 1 This is a flowchart of a deep learning-based cigarette recommendation method.

[0065] Appendix Figure 2 This is a flowchart of Example 2. Detailed Implementation

[0066] The following detailed description of the deep learning-based cigarette recommendation method, system, device, and medium of the present invention is provided with reference to the accompanying drawings and specific embodiments.

[0067] Example 1:

[0068] As attached Figure 1 As shown in the figure, this embodiment provides a cigarette recommendation method based on deep learning, which is as follows:

[0069] S1. Data Collection: Collect customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data;

[0070] S2. Data Cleaning and Integration: Integrate customer data, cigarette data, order data, distribution data, actual customer inventory data, and actual customer sales data to generate several data tables. Use the clean_and_merge function to clean, filter, and merge the dictionary raw_data_dict in multiple data tables to obtain the integrated data table.

[0071] S3. Calculate dynamic features based on time window: The data frame df of the integrated data table and an optional window size parameter window_size (default is 12) are used to calculate dynamic indicators through the calculate_dynamic_features function to analyze the demand satisfaction rate, order fulfillment rate and inventory turnover ratio of customer and product combination.

[0072] S4. Time series encoding: The key time series indicators are extracted from the integrated data table by using the build_time_series_features function and the key indicators are converted into a three-dimensional matrix structure suitable for time series analysis.

[0073] S5. Training the Deep Learning Model: Retailers' historical cigarette ordering behavior is used as time-series data. A Transformer is used to process this data, and each retailer's weekly cigarette orders are used as a time-series data. An LSTM is used to capture periodic purchasing patterns. Customer attributes (static features) and product metrics (dynamic features) are then combined, and embedding is used to process customer and product category variables. The problem is then modeled as a multi-class classification problem, with each cigarette as a category. The probability of ordering is predicted, and collaborative filtering combined with the deep learning model is used to predict the top N products based on distribution volume and other business rules.

[0074] S6. Recommendation Strategy Generation: The smaller of the distribution volume and inventory volume is used as the order limit. When generating the recommendation strategy, cigarettes in the distribution data are first screened out, and the recommended volume is adjusted according to the current inventory volume. Cigarettes with high order fulfillment rates are given priority, while cigarettes with high social inventory-to-sales ratios are given lower priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all distributed cigarettes. Customer level and market type are added as features to the deep learning model, and different price levels of cigarettes are filtered or weighted according to the corresponding features during recommendation.

[0075] In this embodiment, the customer data in step S1 includes the retailer code (license_code), account manager (sls_man), tier (cust_type), and market type (market_type);

[0076] Cigarette data includes cigarette code (item_id), cigarette name (item_name), price range (price_range), price (price), brand (brand), and whether it is a new product (is_new);

[0077] Order data includes order number (bill_code), order date (order_date), retailer code (license_code), cigarette code (item_id), order quantity (order_qty), demand quantity (demand_qty), and limit quantity (limit_qty);

[0078] The delivery data includes the codes of the cigarettes delivered, the names of the cigarettes delivered, the codes of the retailers to which the delivery was made, and the delivery quantity (supply_qty).

[0079] Customer's actual inventory data includes the retailer code with inventory (license_code), the cigarette code with inventory (item_id), the inventory date (inv_date), and the inventory quantity (inv_qty, unit: packs);

[0080] The actual sales data of a customer includes the retailer code with sales data, grade (cust_type), sold cigarette code, sales time (sale_tiem), sales quantity (sale_qty), and sales unit (0 for box / 1 for carton).

[0081] The data cleaning and integration in step S2 of this embodiment are as follows:

[0082] S201, Missing Value Handling: Process the data table with the key "orders" in the dictionary raw_data_dict of multiple data tables; if there are missing values ​​in the demand_qty (demand quantity) column, fill them with the values ​​in the order_qty (order quantity) column of the same row;

[0083] S202, Outlier Filtering: Filter the orders data table to retain only records where order_qty does not exceed 120% of limit_qty (limit), and exclude abnormal data where the order quantity obviously exceeds the reasonable range;

[0084] S203, Multi-table join: The processed 'orders' data table is merged with several other data tables. Specifically: first, it is merged with the 'customers' table via the 'license_code' column; then, it is merged with the 'items' table via the 'item_id' column; next, it is merged with the 'supply', 'inventory', and 'sales' tables via the ['license_code', 'item_id'] columns; finally, a complete data table integrating customer information, product information, supply information, inventory information, and sales information is obtained.

[0085] S204. Time Format Standardization: Convert the order_date (order date) and inv_date (inventory date) columns in the merged data table into a standard date and time format to ensure the consistency and operability of time data, thereby obtaining the merged data table.

[0086] The specific calculation of dynamic features using the time window in step S3 of this embodiment is as follows:

[0087] S301, Data Grouping: Group the data frame df according to license_code (customer identifier) ​​and item_id (product identifier) ​​to ensure that subsequent calculations are based on the combination of each customer and product;

[0088] S302, Demand fulfillment rate calculation: The ratio of the rolling sum of actual orders (order_qty) over the past window_size week to the rolling sum of demand (demand_qty) is calculated by adding a minimum value 1e-6 to the denominator to avoid division by zero, and the result is stored in a new column 'demand_ratio' in the data frame.

[0089] S303, Full Ratio Calculation: The ratio of the rolling sum of actual orders (order_qty) over the past window_size week to the rolling sum of supply (supply_qty), reflecting the proportion of actual orders to supply under the consideration of supply restrictions, and storing the calculation result in a new column, full_ratio, in the data frame;

[0090] S304. Inventory-to-Sales Ratio Calculation: The ratio of the rolling average of the inventory quantity inv_qty over the past window_size weeks to the rolling average of the sales quantity sale_qty, reflecting the inventory turnover rate, i.e. the relationship between inventory quantity and sales quantity, and storing the calculation result in a new column inv_sale_ratio in the data frame.

[0091] S305. Obtain dynamic features: Obtain the three dynamic features added after processing the data frame df: demand_ratio, fulfill_ratio, and inv_sale_ratio.

[0092] The timing sequence encoding in step S4 of this embodiment is specifically as follows:

[0093] S401. Extract key time-series indicators: Group the data frame df according to license_code (customer identifier), item_id (product identifier), and order_date (order date), and calculate the mean of order_qty (order quantity), demand_qty (demand quantity), inv_qty (inventory quantity), and sales_qty (sales quantity) for each group. Then, use the unstack() method to reshape the grouped results so that the date becomes the column index, which is convenient for subsequent time series analysis.

[0094] S402, Resampling and Filling: The data is resampled weekly using the resample('W') method to ensure that the time series data has a fixed periodicity, and missing values ​​are filled forward using the ffill() method to ensure the continuity of the time series.

[0095] S403. Standardization: Initialize a StandardScaler object to standardize the data and reshape the time series feature data into a two-dimensional array in the form of: number of samples × number of features. Then, use the fit_transform() method to standardize the data so that the mean of each feature is 0 and the variance is 1.

[0096] S404. Convert to a three-dimensional structure: Reshape the standardized data into a three-dimensional structure, in the form of: number of samples × number of time steps × number of features, to facilitate subsequent time series analysis or input to deep learning models.

[0097] S405, Temporal Sequence Encoding: Obtain a three-dimensional array ts_scaled, in the form of: number of samples × number of time steps × number of features; where the number of features is fixed at 4, corresponding to order_qty, demand_qty, inv_qty and sale_qty respectively.

[0098] In step S5 of this embodiment, a deep learning model is built using TensorFlow and Keras to process customer features, product features, and time-series features, and outputs a probability distribution to predict cigarette recommendation results; specifically as follows:

[0099] S501, Customer Feature Branch: Define an input layer cust_input with shape (10,) to represent that each customer's feature vector contains 10 features. The customer features are processed through a fully connected layer cust_dense using the ReLU activation function, with an output dimension of 64.

[0100] S502, Product Feature Branch: Define an input layer item_input with shape (8,) to represent that the feature vector of each product contains 8 features, and process the product features through a fully connected layer item_dense using the ReLU activation function, with an output dimension of 64;

[0101] S503, Temporal Feature Branch: Define an input layer time_input with shape (6,32) to represent 6 weeks of historical time-series data, each week containing 32 features. The time-series data is processed through a Transformer layer, which contains 2 Transformer encoders with a model dimension of 32 and 4 attention heads.

[0102] S504, Feature Fusion: Customer features, product features, and time-series features processed by Transformer are fused through the Concatenate layer to form a comprehensive feature representation;

[0103] S505, Output Layer: The fused features are processed through a fully connected layer, using the Softmax activation function. The output dimension is len(item_ids), representing the probability distribution of each item.

[0104] S506. Model Instantiation: Create a model instance named model using tf.keras.Model, specifying the input as [cust_input, item_input, time_input] and the output as output.

[0105] The specific generation of the recommendation strategy in step S6 of this embodiment is as follows:

[0106] S601. Generate a candidate recommended cigarette set based on cigarette distribution data: Generate a candidate product list using the generate_candidates function based on customer identifiers, and then filter the products that meet the criteria and their supply quantities; specifically as follows:

[0107] S60101. Obtain the products to be delivered: Filter the products that match the input parameter license_code from the data frame supply, which are the products to be delivered to the corresponding customers;

[0108] S60102. Merge data: Merge the selected product data frame supply_items with the item data frame using the item_id column to obtain detailed product information, and merge them with the customer data frame using the license_code column to obtain detailed customer information;

[0109] S60103. Price Filtering: Filter candidate products by price based on customer type cust_type: If the customer type is low, only products with a price less than or equal to 15 are retained; if the customer type is high, only products with a price greater than or equal to 30 are retained.

[0110] S60104. Get List and Data Frame: Get a list of candidate products, containing only the column 'item_id' and 'supply_qty', which represent the product identifier and supply quantity, respectively. At the same time, the generate_candidates function returns a data frame containing the candidate products that meet the conditions and their supply quantity information.

[0111] S602. A recommendation order is generated based on business indicators such as demand fulfillment rate, order fulfillment rate, and social inventory-to-sales ratio: A recommended product list is generated using the `recommend_items` function based on customer identifiers, and the top-ranked products are returned; details are as follows:

[0112] S60201. Generate candidate products: Call the generate_candidates(license_code) function to generate a list of candidate products, candidates, based on the customer identifier;

[0113] S60202, Loading a pre-trained model: Load a pre-trained recommendation model named recommender.h5, which will be used for subsequent predictions; Generating predictions: Prepare the input data using the prepare_inputs(license_code) function, and then generate the prediction results predictions using the model.predict() method.

[0114] S60203, Business Rule Integration: The prediction results (predictions) are weighted and integrated with other business rule indicators to generate the final score (final_scores). Specifically, the prediction results account for 60% of the weight; the demand satisfaction ratio (demand_satisfy_ratio) accounts for 20% of the weight; the complement of the inventory turnover ratio (1-inventory_turnover) accounts for 10% of the weight; and the order fulfillment ratio (order_fulfill_ratio) accounts for 10% of the weight. By combining model predictions and business rules, recommendation results that better meet business needs are generated.

[0115] S60204. Result Filtering: Use the nlargest method to filter out the top_n products with the highest ratings from the candidate products and store them in recommendations;

[0116] S60205. Obtain descending order results: The filtered list of recommended products is sorted in descending order by supply_qty (supply quantity) to ensure that products with large supply are recommended first. The recommend_items function returns a data frame containing the top-ranked list of recommended products, sorted from high to low supply quantity.

[0117] S603. Combining factors such as whether a product is new, inventory-to-sales ratio, and brand balance strategy, the final recommendation result is formed: Based on recommendations, the `apply_business_rules` function applies business rules to the recommended product list to optimize the recommendation result, as detailed below:

[0118] S60301, New Product Promotion Rules: Check if the current month is January or June, indicating the peak season promotion period; if it is the peak season promotion period, only retain products with the is_new flag set to 1 in the recommended list (i.e., new products), and only retain the first 3 new products;

[0119] S60302, Inventory-to-Sales Ratio Filtering: Filter the recommended product list by inventory-to-sales ratio, retaining only products with an inventory-to-sales ratio less than 1.5; where inventory-to-sales ratio is an indicator of inventory turnover rate, limiting the inventory-to-sales ratio helps ensure that the recommended products have high turnover efficiency;

[0120] S60303, Brand Balance Strategy: Calculate the number of products from each brand in the recommended product list and store them in brand_dist; for brands with more than 3 products, exclude the products of the corresponding brands from the recommended list and only retain the products of the top 3 other brands to achieve brand diversity and avoid the recommendation results being too concentrated on a few brands;

[0121] S60304. Obtain the recommended product list after business rule processing: The apply_business_rules function returns the recommended product list after business rule processing, ensuring that the recommendation results meet the requirements of peak season promotion, inventory turnover rate and brand diversity.

[0122] Example 2:

[0123] As attached Figure 2 As shown in the figure, this embodiment provides a cigarette recommendation method based on deep learning, as detailed below:

[0124] (I) Data preparation and data processing, as detailed below:

[0125] (1) Data preparation: The cigarette recommendation model needs to be trained based on the following basic data; the specific basic data is as follows:

[0126] Customer data includes retailer code (license_code), account manager (sls_man), tier (cust_type), and market type (market_type).

[0127] Cigarette data includes cigarette code (item_id), cigarette name (item_name), price range (price_range), price (price), brand (brand), and whether it is a new product (is_new).

[0128] Order data includes order number (bill_code), order date (order_date), retailer code (license_code), cigarette code (item_id), order quantity (order_qty), demand quantity (demand_qty), and limit quantity (limit_qty).

[0129] Distribution data includes cigarette code (item_id), cigarette name (item_name), license_code (retailer code), and distribution quantity (supply_qty).

[0130] Customer's actual inventory data includes retailer code (license_code), cigarette code (item_id), inventory date (inv_date), and inventory quantity (inv_qty, unit: pack).

[0131] The customer's actual sales data includes: retailer code (license_code), grade (cust_type), cigarette code (item_id), sales time (sale_tiem), sales quantity (sale_qty), and sales unit (0 for box / 1 for carton).

[0132] (2) Data Cleaning and Integration: Integrate all data sources and use retailer codes and cigarette codes as primary keys to connect the various tables. For example, order data contains order dates, which need to be converted into time series features. Customer tiers and market types need to be coded, with 0-30 representing the thirty tiers of retailer customers and market types being represented by 0 and 1 for rural and urban areas.

[0133] Missing data handling: When the demand quantity is missing in the order, the default value is equal to the order quantity; when the customer data has no tier, the default value is 15 tiers.

[0134] Abnormal data handling: Remove cigarettes of cigar brands from the cigarette list; remove orders that exceed the order quantity limit from the order list.

[0135] Relationship optimization: Using customer and product data as the main table, merge and inline functions are used to link and integrate the basic data.

[0136] Example code is as follows:

[0137]

[0138] (II) Feature engineering, as detailed below:

[0139] (1) Dynamic Indicator Calculation: Key indicators such as demand fulfillment rate, order fulfillment rate, and inventory-to-sales ratio need to be calculated. These indicators need to be used as feature inputs to the model. Demand fulfillment rate is the ratio of order quantity to demand quantity; the lower the demand fulfillment rate, the greater the customer demand for the cigarette. Order fulfillment rate is the ratio of order quantity to supply quantity; the higher the order fulfillment rate, the more customers want to order the cigarette. Social inventory-to-sales ratio is the ratio of the customer's actual inventory quantity to the actual sales quantity; the higher the social inventory-to-sales ratio, the more sufficient the customer's current inventory is, and it is not recommended for the time being. Cigarette types refer to the types of cigarettes ordered by retailers. Retailer order indicators for the past 12 weeks are calculated using a rolling window, grouped by customer and product, to analyze recent sales trends.

[0140] Example code is as follows:

[0141]

[0142] (2) Temporal sequence encoding: To adapt to the input requirements of LSTM / Transformer models, a three-dimensional matrix (sample × time step × feature) is generated using temporal features. Example code is as follows:

[0143]

[0144]

[0145] (III) Deep Learning Model Training: Retailers' historical cigarette ordering behavior is typically time-series data, which is processed using Transformer. Each retailer's weekly cigarette orders are treated as a time series, and LSTM is used to capture periodic purchasing patterns. Additionally, the feature set can combine static features (customer attributes) and dynamic features (product metrics), requiring Embedding to handle customer and product category variables.

[0146] To predict which cigarettes retailers are most likely to order in the next cycle, while considering supply constraints, the problem needs to be modeled as a multi-class classification problem, with each cigarette as a category. A hybrid model combining collaborative filtering and deep learning is used to predict the top N products based on supply volume and other business rules.

[0147] Example code is as follows:

[0148]

[0149]

[0150] (iv) Recommendation Strategy Generation: The smaller of the distribution volume and inventory volume is used as the upper limit for ordering. When generating recommendations, it is necessary to first filter the cigarettes in the distribution data and adjust the recommended volume based on the current inventory volume. Cigarettes with high order fulfillment rates should be prioritized, while cigarettes with high social inventory-to-sales ratios should have lower recommendation priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all distributed cigarettes. This requires incorporating customer segment and market type as features into the model, and filtering or weighting cigarettes at different price points based on these features during recommendation.

[0151] (1) Generate a set of candidate recommended cigarettes based on the cigarette distribution data. Example code is as follows:

[0152]

[0153] (2) The recommendation order is formed based on business indicators such as demand fulfillment rate, order fulfillment rate, and social inventory-to-sales ratio. Example code is as follows:

[0154]

[0155]

[0156] (3) The final recommendation result is formed by combining factors such as whether the product is new, the inventory-to-sales ratio, and a brand balance strategy. Example code is as follows:

[0157]

[0158] Example 3:

[0159] This embodiment provides a deep learning-based cigarette recommendation system, which implements the deep learning-based cigarette recommendation methods described in Embodiments 1 and 2; the system includes:

[0160] The data acquisition module is used to collect customer data, cigarette data, order data, distribution data, actual customer inventory data, and actual customer sales data.

[0161] The data cleaning and integration module is used to integrate customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data to generate several data tables. The clean_and_merge function cleans, filters, and merges the dictionary raw_data_dict in multiple data tables to obtain the integrated data table.

[0162] The dynamic features module is used to calculate dynamic indicators using the calculate_dynamic_features function on the integrated data table's data frame df and an optional window size parameter window_size (default is 12), and to analyze customer and product combination demand satisfaction rate, order fulfillment rate, and inventory-to-sales ratio.

[0163] The time series encoding module is used to extract key time series indicators from the integrated data table through the build_time_series_features function and convert the key indicators into a three-dimensional matrix structure suitable for time series analysis.

[0164] The model training module uses retailers' historical cigarette ordering behavior as time-series data, processes it using a Transformer, and takes each retailer's weekly cigarette orders as a time series, capturing periodic purchasing patterns using an LSTM. It then combines customer attributes (static features) and product metrics (dynamic features), processing customer and product category variables through Embedding. Finally, it models the problem as a multi-class classification problem, with each cigarette as a category, predicting the probability of ordering. Collaborative filtering combined with a deep learning model is used to predict the top N products based on distribution volume and other business rules.

[0165] The recommendation strategy generation module uses the smaller of the distribution volume and inventory volume as the order limit. When generating the recommendation strategy, it first filters out cigarettes from the distribution data and adjusts the recommendation volume based on the current inventory volume. Cigarettes with high order fulfillment rates are given priority, while cigarettes with high social inventory-to-sales ratios are given lower priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all distributed cigarettes. Customer level and market type are added as features to the deep learning model, and different price levels of cigarettes are filtered or weighted according to the corresponding features during recommendation.

[0166] Example 4:

[0167] This invention also provides an electronic device, including: a memory and a processor;

[0168] The memory stores the instructions executed by the computer.

[0169] The processor executes computer execution instructions stored in the memory, causing the processor to execute the deep learning-based cigarette recommendation method in any embodiment of the present invention.

[0170] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or any conventional processor.

[0171] Memory is used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, memory can also include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart memory cards (SMC), secure digital cards (SD cards), flash memory cards, at least one disk storage device, flash memory devices, or other volatile solid-state storage devices.

[0172] Example 5:

[0173] This embodiment also provides a computer-readable storage medium storing multiple instructions, which are loaded by a processor to cause the processor to execute the deep learning-based cigarette recommendation method in any embodiment of the present invention. Specifically, a system or apparatus equipped with a storage medium may be provided, on which software program code implementing the functions of any of the above embodiments is stored, and the computer (or CPU or MPU) of the system or apparatus may read and execute the program code stored in the storage medium.

[0174] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.

[0175] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.

[0176] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0177] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cigarette recommendation method based on deep learning, characterized in that, The method is as follows: Data collection: Collect customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data; Data cleaning and integration: Integrate customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data to generate several data tables. Use the clean_and_merge function to clean, filter, and merge the dictionary raw_data_dict in multiple data tables to obtain the integrated data table. Dynamic features are calculated based on time windows: The data frame df of the integrated data table and an optional window size parameter window_size are used to calculate dynamic indicators through the calculate_dynamic_features function to analyze the demand satisfaction rate, order fulfillment rate and inventory-to-sales ratio of customer and product combinations. Time series encoding: The key time series indicators are extracted from the integrated data table using the build_time_series_features function and converted into a three-dimensional matrix structure suitable for time series analysis; Training a deep learning model: Retailers' historical cigarette ordering behavior is used as time-series data. A Transformer is used to process this data, and each retailer's weekly cigarette orders are used as a time-series data. An LSTM is used to capture periodic purchasing patterns. Customer attributes and product metrics are then combined, and embedding is used to process customer and product category variables. The problem is then modeled as a multi-class classification problem, with each cigarette as a category. The probability of ordering is predicted, and collaborative filtering combined with a deep learning model is used to predict the top N products based on distribution volume and other business rules. Recommendation strategy generation: The smaller of the distribution volume and the inventory volume is used as the order limit. When generating the recommendation strategy, cigarettes in the distribution data are first screened out, and the recommended volume is adjusted according to the current inventory volume. Cigarettes with high order fulfillment rates are given priority, while cigarettes with high social inventory-to-sales ratios are given lower recommendation priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all types of cigarettes. By incorporating customer segmentation and market type as features into the deep learning model, and filtering or weighting cigarettes at different price points based on the corresponding features during recommendation, we can improve the recommendation process.

2. The cigarette recommendation method based on deep learning according to claim 1, characterized in that, Customer data includes retailer code, account manager, tier, and market type; Cigarette data includes cigarette code, cigarette name, price range, price, brand, and whether it is a new product; Order data includes order number, order date, retailer code, cigarette code, order quantity, demand quantity, and quantity limit; The delivery data includes the codes of the cigarettes delivered, the names of the cigarettes delivered, the codes of the retailers to which the delivery was made, and the delivery quantity (supply_qty). Customer's actual inventory data includes retailer codes for in-stock items, cigarette codes for in-stock items, inventory date, and inventory quantity. Actual customer sales data includes retailer codes with sales data, grade level (cust_type), sold cigarette codes, sales time, sales quantity, and sales unit.

3. The cigarette recommendation method based on deep learning according to claim 1, characterized in that, The data cleaning and integration process is detailed below: Missing value handling: Process the data table with the key "orders" in the dictionary raw_data_dict of multiple data tables; if there are missing values ​​in the demand_qty column, fill them with the values ​​in the order_qty column of the same row; Outlier filtering: Filter the orders data table to retain only records where order_qty does not exceed 120% of limit_qty, and exclude abnormal data where the order quantity clearly exceeds the reasonable range; Multi-table joins: The processed 'orders' data table is merged with several other data tables. Specifically, it is first merged with the 'customers' table via the 'license_code' column; then merged with the 'items' table via the 'item_id' column; and then merged with the 'supply', 'inventory', and 'sales' tables via the ['license_code', 'item_id'] columns. The final result is a complete data table integrating customer information, product information, supply information, inventory information, and sales information. Time format standardization: The order_date and inv_date columns in the merged data table are converted into a standard date and time format to ensure the consistency and operability of time data, thereby obtaining the merged data table.

4. The cigarette recommendation method based on deep learning according to claim 1, characterized in that, Based on the time window, the dynamic features are calculated as follows: Data grouping: Group the data frame (df) according to license_code and item_id to ensure that subsequent calculations are based on the combination of each customer and product; Demand fulfillment rate calculation: The ratio of the rolling sum of actual orders (order_qty) over the past window_size weeks to the rolling sum of demand (demand_qty) is calculated by adding a minimum value 1e-6 to the denominator and storing the result in a new column 'demand_ratio' in the data frame. The fulfillment rate is calculated as the ratio of the rolling sum of actual orders (order_qty) over the past window_size weeks to the rolling sum of supply (supply_qty). This ratio reflects the proportion of actual orders to supply, taking into account supply limits. The result is stored in a new column, fulfill_ratio, in the data frame. Inventory turnover ratio calculation: The ratio of the rolling average of the inventory quantity inv_qty over the past window_size weeks to the rolling average of the sales quantity sale_qty, reflecting the inventory turnover rate, that is, the relationship between inventory quantity and sales quantity, and the calculation result is stored in a new column inv_sale_ratio in the data frame; Get dynamic features: Get the three dynamic features added after processing the data frame df: demand_ratio, fulfill_ratio, and inv_sale_ratio.

5. The cigarette recommendation method based on deep learning according to claim 1, characterized in that, The specific encoding of time-series sequences is as follows: Extract key time series metrics: Group the data frame df according to license_code, item_id, and order_date, and calculate the mean of order_qty, demand_qty, inv_qty, and sale_qty for each group. Then, reshape the grouped results using the unstack() method so that the date becomes the column index, which is convenient for subsequent time series analysis. Resampling and imputation: The data is resampled weekly using the resample('W') method to ensure that the time series data has a fixed periodicity, and missing values ​​are imputed forward using the ffill() method to ensure the continuity of the time series. Standardization: Initialize a StandardScaler object to standardize the data and reshape the time series feature data into a two-dimensional array in the form of: number of samples × number of features. Then, use the fit_transform() method to standardize the data so that the mean of each feature is 0 and the variance is 1. Convert to a three-dimensional structure: Reshape the standardized data into a three-dimensional structure, in the form of: number of samples × number of time steps × number of features, to facilitate subsequent time series analysis or input to deep learning models. Temporal sequence encoding: Obtain a three-dimensional array ts_scaled, in the form of: number of samples × number of time steps × number of features; where the number of features is fixed at 4, corresponding to order_qty, demand_qty, inv_qty and sale_qty respectively.

6. The cigarette recommendation method based on deep learning according to claim 1, characterized in that, A deep learning model is built using TensorFlow and Keras to process customer features, product features, and time-series features, and outputs a probability distribution to predict cigarette recommendation results; details are as follows: Customer Feature Branch: Define an input layer cust_input with shape (10,) to represent that each customer's feature vector contains 10 features. Process the customer features through a fully connected layer cust_dense using the ReLU activation function, with an output dimension of 64. Product feature branch: Define an input layer item_input with shape (8,) to represent that the feature vector of each product contains 8 features, and process the product features through a fully connected layer item_dense using the ReLU activation function, with an output dimension of 64; Temporal characteristics Branch: Define an input layer time_input with shape (6,32) to represent 6 weeks of historical time series data, each week containing 32 features. Process the time series data through a Transformer layer, which contains 2 Transformer encoder layers, with a model dimension of 32 and 4 attention heads. Feature fusion: Customer features, product features, and time-series features processed by Transformer are fused through the Concatenate layer to form a comprehensive feature representation; Output layer: The fused features are processed through a fully connected layer, using the Softmax activation function. The output dimension is len(item_ids), which represents the probability distribution of each item. Model instantiation: Create a model instance named model using tf.keras.Model, specifying the input as [cust_input, item_input, time_input] and the output as output.

7. The cigarette recommendation method based on deep learning according to any one of claims 1-6, characterized in that, The specific generation of the recommendation strategy is as follows: Generate a candidate set of recommended cigarettes based on cigarette distribution data: A candidate product list is generated using the `generate_candidates` function based on customer identifiers, and then filtered to obtain eligible products and their supply quantities. Specifically: Obtaining distributed products: Products matching the input parameter `license_code` are filtered from the `supply` data frame; these are the distributed products for the corresponding customers. Merging data: The filtered distributed product data frames `supply_items` and `item` are merged using the `item_id` column to obtain detailed product information, and then merged with the `customer` data frame using the `license_code` column to obtain detailed customer information. Price filtering: Candidate products are filtered by price based on customer type `cust_type`: if the customer type is "low", only products with a price less than or equal to 15 are retained; if the customer type is "high", only products with a price greater than or equal to 30 are retained. Obtaining the list and data frame: A candidate product list is obtained, containing only the `item_id` and `supply_qty` columns, representing the product identifier and supply quantity respectively. The `generate_candidates` function returns a data frame containing eligible candidate products and their supply quantity information. The recommendation order is determined based on business indicators such as demand fulfillment rate, order fulfillment rate, and social inventory-to-sales ratio. Specifically, the recommended product list is generated using the `recommend_items` function based on customer identifiers, and the top-ranked products are returned. This process includes: generating candidate products: calling the `generate_candidates(license_code)` function to generate a candidate product list `candidates` based on customer identifiers; loading a pre-trained model: loading a pre-trained recommendation model named `recommender.h5` for subsequent predictions; generating predictions: preparing input data using the `prepare_inputs(license_code)` function, and then generating predictions using the `model.predict()` method; and integrating business rules: combining the predictions with other business rule indicators. Weighted fusion generates the final scores (final_scores), specifically: prediction results account for 60% of the weight; demand satisfaction ratio (demand_satisfy_ratio) accounts for 20% of the weight; the complement of inventory turnover (1-inventory_turnover) accounts for 10% of the weight; and order fulfillment ratio (order_fulfill_ratio) accounts for 10% of the weight. Combining model predictions and business rules, recommendations that better meet business needs are generated. Result filtering: The top_n highest-scoring products are selected from the candidate products using the nlargest method and stored in recommendations. Descending order results are obtained: The filtered list of recommended products is sorted in descending order by supply_qty to ensure that products with large supply are recommended first. The recommend_items function returns a data frame containing the top-ranked list of recommended products, sorted from highest to lowest supply. The final recommendation result is formed by combining factors such as whether the product is new, the inventory-to-sales ratio, and a brand balancing strategy. Based on recommendations, the `apply_business_rules` function applies business rules to the recommended product list to optimize the recommendation result, specifically as follows: New Product Promotion Rules: Check if the current month is January or June, indicating a peak season promotion period; if it is, only products with the `is_new` flag set to 1 are retained in the recommendation list, and only the first 3 new products are kept; Inventory-to-Sales Ratio Filtering: The recommended product list is filtered for inventory-to-sales ratio, retaining only products with an inventory-to-sales ratio less than 1.5; where inventory-to-sales ratio is the ratio of inventory... One indicator of inventory turnover is the inventory-to-sales ratio. Limiting the inventory-to-sales ratio helps ensure that recommended products have high turnover efficiency. Brand balancing strategy: Calculate the number of products from each brand in the recommended product list and store them in brand_dist. For brands with more than 3 products, exclude products from the recommended list and retain only the top 3 products from the other brands to achieve brand diversity. Obtain the recommended product list after business rule processing: The apply_business_rules function returns the recommended product list after business rule processing, ensuring that the recommendation results meet the requirements of peak season promotions, inventory turnover, and brand diversity.

8. A cigarette recommendation system based on deep learning, characterized in that, This system is used to implement the deep learning-based cigarette recommendation method as described in any one of claims 1 to 7; The system includes: The data acquisition module is used to collect customer data, cigarette data, order data, distribution data, actual customer inventory data, and actual customer sales data. The data cleaning and integration module is used to integrate customer data, cigarette data, order data, distribution data, customer actual inventory data, and customer actual sales data to generate several data tables. The clean_and_merge function cleans, filters, and merges the dictionary raw_data_dict in multiple data tables to obtain the integrated data table. The dynamic features module is used to dynamically calculate indicators such as customer and product combination demand fulfillment rate, order fulfillment rate, and inventory-to-sales ratio by combining the data frame df of the integrated data table and an optional window size parameter window_size with the calculate_dynamic_features function. The time series encoding module is used to extract key time series indicators from the integrated data table through the build_time_series_features function and convert the key indicators into a three-dimensional matrix structure suitable for time series analysis. The model training module uses historical cigarette ordering behavior of retailers as time series data. It processes the historical cigarette ordering behavior of retailers through Transformer and uses weekly cigarette orders of each retailer as time series data. It captures periodic purchase patterns through LSTM. Then, it combines customer attributes and product indicators and uses Embedding to process customer and product category variables. Finally, it models the problem as a multi-classification problem, with each cigarette as a category, and predicts the probability of ordering. It uses collaborative filtering combined with a deep learning model to predict the top N products based on the distribution volume and other business rules. The recommendation strategy generation module uses the smaller of the distribution volume and inventory volume as the order limit. When generating the recommendation strategy, it first filters out cigarettes from the distribution data and adjusts the recommendation volume based on the current inventory volume. Cigarettes with high order fulfillment rates are given priority, while cigarettes with high social inventory-to-sales ratios are given lower priority. Low-end or rural customers tend to prefer low-priced cigarettes, while high-end customers tend to prefer all distributed cigarettes. Customer level and market type are added as features to the deep learning model, and different price levels of cigarettes are filtered or weighted according to the corresponding features during recommendation.

9. An electronic device, characterized in that, include: Memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the deep learning-based cigarette recommendation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by a processor to implement the deep learning-based cigarette recommendation method as described in any one of claims 1 to 7.