Commodity recommendation model training and application method and electronic equipment
By analyzing user product interaction data to identify product category pairs, construct a sample data set and train the model, it solves the problem that existing technology cannot accurately recommend complementary products, achieves highly accurate and diverse product recommendations, and provides users with personalized shopping. Serve.
Patent Information
- Application Number
- CN202410678120.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-03
AI Technical Summary
Existing technology cannot accurately predict products that match or have complementary functions for the product that the user wants to purchase, and cannot achieve accurate recommendations in application scenarios.
By analyzing the data sequence based on user product interaction data in the preset product library, identify the product category pairs of each pair of adjacent products, and determine related products based on these categories, including complementary products and irrelevant products, to construct high-quality sample data Set, use text encoder and multi-layer perceptron to train the model until the preset conditions are met, and the product recommendation model is obtained.
It improves the accuracy and diversity of product recommendations, provides users with personalized shopping recommendation services that meet their needs, and is suitable for scenarios where users are willing to purchase, such as shopping carts and checkout pages.
Smart Images

Figure CN118586979A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing and relates to information recommendation technology, and in particular to a product recommendation model training and application method and electronic equipment. Background Art
[0002] Consumers can enter search keywords through e-commerce platforms, and the e-commerce platforms will provide multiple products corresponding to the search keywords. When consumers browse any product, the e-commerce platform will also recommend similar products to the currently browsed product. This type of product recommendation model training and application method can provide consumers with more choices.
[0003] Related technologies usually focus on the training of recommendation models and application algorithms for similar products, so as to help customers find alternatives similar to the currently browsed products and meet their diverse needs. However, in scenarios where consumers already have the intention to buy (for example, submitting a product order, etc.), there are relatively few recommendation algorithms for products that match the current product or have complementary functions, and related technologies cannot accurately predict the recommended products in this application scenario. Summary of the invention
[0004] The embodiments of the present application provide a product recommendation model training and application method and electronic device, which can solve the technical problem that related technologies cannot accurately predict products that are compatible with or have complementary functions that users want to buy.
[0005] A first aspect of an embodiment of the present application provides a product recommendation model training method, comprising: determining a product category pair of every two adjacent products in a preset product library based on a data sequence composed of user-product interaction data corresponding to all products in the preset product library; determining associated products of any product in the preset product library based on the product category pair, wherein the associated products include related products of any product, and the related products include complementary products of any product; constructing a sample data set based on product information of any product and the corresponding associated products; and training a preset model using the sample data set until the preset model meets preset conditions to obtain a product recommendation model.
[0006] According to an embodiment of the present application, before determining the product category pair of every two adjacent products in the data sequence composed of user-product interaction data corresponding to all products in the preset product library, the method also includes: determining a multi-level classification category for each product in the preset product library based on a preset classification system; and selecting a classification category of a target level from the multi-level classification categories as the product category of the corresponding product.
[0007] According to an embodiment of the present application, the method of determining a commodity category pair for every two adjacent commodities in a data sequence based on the user-commodity interaction data corresponding to all commodities in a preset commodity library includes: sorting the user-commodity interaction data in chronological order, and removing continuous data for the same commodity in the sorted data sequence to obtain an updated data sequence; dividing the data in the updated data sequence according to a preset time length to obtain a plurality of sub-data sequences; and treating the data of every two adjacent commodities in each sub-data sequence in the plurality of sub-data sequences as a data pair, and determining a commodity category pair corresponding to each data pair.
[0008] According to an embodiment of the present application, determining related and unrelated commodities for any commodity in the preset commodity library based on the commodity category pair includes: counting the number of each commodity category pair corresponding to each sub-data sequence; determining the commodity category pairs with the largest preset number as the target category pair; determining that the two commodities corresponding to the target category pair are related commodities to each other; and determining that the commodities corresponding to the data outside the target category pair are unrelated commodities of the two commodities corresponding to the target category pair.
[0009] According to an embodiment of the present application, the associated commodities also include unrelated commodities of any of the commodities, and determining the associated commodities of any of the commodities in the preset commodity library based on the commodity category pair includes: counting the number of each commodity category pair corresponding to each sub-data sequence; determining the commodity category pairs with the largest preset number as the target category pair; determining that the two commodities corresponding to the target category pair are related commodities to each other; and determining that the commodities corresponding to the data outside the target category pair are unrelated commodities of the two commodities corresponding to the target category pair.
[0010] According to an embodiment of the present application, the related products also include similar products of any of the products, and the method also includes: if the two classification categories in the target category pair are different, determining that the two products corresponding to the target category pair are complementary products; or, if the two classification categories in the target category pair are the same, determining that the two products corresponding to the target category pair are similar products.
[0011] According to an embodiment of the present application, the related commodities include complementary commodities and similar commodities, and the sample data set is constructed based on the commodity information of any of the commodities and the corresponding associated commodities, including: taking any of the commodities as the main commodity, obtaining the first commodity title of the main commodity, and the second commodity title of the complementary commodity corresponding to the main commodity, the third commodity title of the similar commodity corresponding to the main commodity, and the fourth commodity title of the unrelated commodity corresponding to the main commodity; taking the second commodity title, the third commodity title, and the fourth commodity title corresponding to the main commodity as labels for the first commodity title of the main commodity, to obtain a labeled sample data.
[0012] According to an embodiment of the present application, before constructing the sample data set, the method also includes: if any of the commodities does not have the corresponding complementary commodity or the similar commodity, deleting the data corresponding to the any of the commodities; if any of the commodities is a popular commodity, downsampling the data corresponding to the any of the commodities.
[0013] According to an embodiment of the present application, the preset model includes a text encoder and a multi-layer perceptron. The text encoder is used to encode the product titles in the sample data set to obtain encoding vectors of the product titles. The multi-layer perceptron is used to spatially project the encoding vectors to a corresponding category space. The category space includes similar product space, complementary product space, and unrelated product space.
[0014] According to an embodiment of the present application, the preset condition includes that the loss value corresponding to the preset loss function is less than the preset loss threshold, and the preset loss function includes:
[0015] L=L sim +L comp +L neg +L l2 ,
[0016] L sim =max(d(a e ,s e )-m s ,0),
[0017] L comp =max(d(a e ,c e )-m c ,0)+max(m s -d(a e ,c e ),0),
[0018] L neg =max(m n -d(a e ,ne ),0),
[0019] Wherein, L represents the preset loss function, max() represents the maximum value function, and d() represents the distance function; a e The encoding vector representing the product title of any product, s e The encoding vector representing the product titles of similar products among the related products of any product, c e The encoding vector representing the product title of the complementary product among the related products of any of the products, n e The encoding vector of the product title of any product that is not related to the product; L l2 represents the regularization parameter of the multilayer perceptron of the preset model; m s 、m c With m n represents the preset threshold parameter, and m n >m c >m s .
[0020] A second aspect of an embodiment of the present application provides an application method of a product recommendation model, including: inputting a target product title of a target product into the product recommendation model, and using the product recommendation model to determine a target coding vector of the target product title, wherein the target product includes products in a shopping cart and / or a product settlement page, and the product recommendation model is obtained by training using the product recommendation model training method; and determining the distance between the target coding vector and the coding vector corresponding to the product title of each product in a preset product library, determining that the products whose distance is within the preset distance range are complementary products of the target product, and using the complementary products of the target product as the recommended products.
[0021] According to an embodiment of the present application, the method further includes: displaying the recommended product at a preset position of the target product in a graphical interactive interface.
[0022] According to a third aspect of an embodiment of the present application, there is provided a device for training a product recommendation model, the device comprising: a category pair determination module, for determining a product category pair of every two adjacent products in a preset product library according to a data sequence composed of user-product interaction data corresponding to all products in the data sequence; an association relationship determination module, for determining the associated products of any product in the preset product library based on the product category pair, wherein the associated products include related products of any product, and the related products include complementary products of any product; a data set construction module, for constructing a sample data set based on the product information of any product and the corresponding related products; and a model training module, for training a preset model using the sample data set until the preset model meets preset conditions to obtain a product recommendation model.
[0023] A fourth aspect of an embodiment of the present application provides an electronic device, comprising: a memory, and a processor, wherein the processor executes computer-readable instructions stored in the memory to implement the product recommendation model training and application method.
[0024] The commodity recommendation model training method provided in the embodiment of the present application can identify the commodity category pairs of each pair of adjacent commodities by analyzing the data sequence composed of user commodity interaction data in the preset commodity library; based on the commodity category pairs, the related commodities (including its complementary commodities) and unrelated commodities of any commodity can be accurately defined; thereafter, a high-quality sample data set is constructed using these commodity information, and a commodity recommendation model that can effectively recommend complementary commodities is obtained by training the preset model until the preset conditions are met, thereby improving the accuracy of commodity recommendations, expanding the diversity of recommended commodities, and providing users with more personalized and demand-satisfying shopping recommendation services. The application method of the commodity recommendation model provided in the embodiment of the present application can be applied to commodity recommendation scenarios where users have a willingness to purchase, such as commodity shopping cart pages and commodity settlement pages, to achieve fast and accurate recommendations of complementary commodities for the current commodity. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 A schematic diagram of an application environment for a product recommendation model training and application method provided in an embodiment of the present application.
[0027] Figure 2 A flowchart of a product recommendation model training method provided in an embodiment of the present application.
[0028] Figure 3 A schematic diagram of the multi-level classification categories of commodities provided in an embodiment of the present application.
[0029] Figure 4 A detailed flowchart of step S201 provided in an embodiment of the present application.
[0030] Figure 5 A detailed flowchart of step S202 provided in an embodiment of the present application.
[0031] Figure 6 A schematic diagram of the model training objectives provided in an embodiment of the present application.
[0032] Figure 7 A flowchart of an application method of a product recommendation model provided in an embodiment of the present application.
[0033] Figure 8 A schematic diagram of a graphical interactive interface provided in an embodiment of the present application.
[0034] Fig. 9 A functional block diagram of a product recommendation model training device provided in an embodiment of the present application.
[0035] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application is described in detail below with reference to the accompanying drawings and specific embodiments.
[0037] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0038] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. The following embodiments and features in the embodiments may be combined with each other without conflict.
[0039] See also Figure 1 , is a schematic diagram of an application environment for a product recommendation model training and application method provided in an embodiment of the present application. Figure 1As shown, the user terminal 10 communicates with the server 20 through a network. The network can be a wired network communication or a wireless network communication. The wired network can be any one of a local area network, a metropolitan area network and a wide area network, a wireless fidelity (Wireless Fidelity, Wi-Fi), a self-organizing network wireless communication (ZigBee Wireless Networks, ZigBee) technology, an ultra-wideband (Ultra Wideband, UWB) technology, a wireless universal serial bus (Universal SerialBus, USB) and the like.
[0040] The user terminal 10 may be an electronic device such as a mobile phone, a tablet computer, a multimedia player, a personal computer (PC), a wearable device, etc. The user terminal 10 may be a client with various applications installed, such as education applications, consulting applications, information broadcast applications, live broadcast applications, e-commerce applications, etc.
[0041] The server 20 is used to provide background services for the application in the user terminal 10. For example, the server 20 can be the background server of the above-mentioned e-commerce application. The server 20 can be a computer device. In one embodiment of the present application, it can be a server, a server cluster composed of multiple servers, or a cloud computing service center.
[0042] For example, an e-commerce application is used as an example for explanation. A user performs user interaction operations with a product such as clicking, adding to a purchase, purchasing, collecting, and liking a product in a client (e.g., a user terminal 10) on which an e-commerce application is installed; the server 20 obtains user product interaction data based on the user interaction operation, and obtains associated products of any product in a preset product library based on the user product interaction data, wherein the associated products include related products of the any product, and the related products include complementary products of the any product; thereafter, the server 20 constructs a sample data set based on the product information of any product and the corresponding associated products; the preset model is trained using the sample data set until the preset model meets the preset conditions, and a product recommendation model is obtained; the server 20 uses the product recommendation model to determine the recommended product corresponding to the target product from the product library, wherein the target product includes the product that the user has the intention to purchase in the shopping cart and / or the product settlement page, and the recommended product includes the complementary product of the target product; the server 20 displays the recommended product at the preset position of the target product, and the user can view the recommended product through the user terminal 10. In this way, the server 20 can mine complementary products of any product based on the user-product interaction data, train a product recommendation model based on the data, and use the product recommendation model to predict complementary products of the target product, thereby recommending complementary products of the target product to the user.
[0043] The following will be based on the computer program product running on the server (such as Figure 1 The server 20 shown in FIG. Figure 2 As shown, it is a flowchart of the product recommendation model training and application method provided in an embodiment of the present application. In one embodiment of the present application, the following steps are included:
[0044] Step S201, determining a product category pair of every two adjacent products in the data sequence according to a data sequence consisting of user-product interaction data corresponding to all products in a preset product library.
[0045] In some embodiments of the present application, the preset product library may be a database corresponding to all products of an e-commerce platform corresponding to one or more merchants. The data in the preset product library may include but is not limited to: (1) product information of the product, or basic information of the product, such as product identification (such as product number), product title, product name, picture, price, inventory, etc.; (2) a classification system of products. The classification system of products may include multiple levels of classification categories for each product, such as Figure 3As shown in the figure, the first-level classification includes the highest level of commodity classification, which is used to characterize the general field or industry of commodities; the second-level classification includes further subdivision of the first-level classification, which is used to characterize the general type or characteristics of commodities; the third-level classification includes further subdivision of the second-level classification, which is used to characterize the specific category or characteristics of commodities; (3) commodity evaluation, for example, user evaluation and feedback on commodities, including user click, browse, add to cart (add to shopping cart), purchase, favorite, and like data on commodities.
[0046] In other embodiments, the product library may also include other data, such as the association between products (such as similar products, complementary products, matching products, etc.), the merchant information of the products (such as the basic information of the merchant, such as the merchant name, credit rating, after-sales service policy, etc.), and the promotional activity information of the products (such as discounts, coupons, full-reduction activities, etc.). This application does not impose specific restrictions on the data categories and quantities in the product library.
[0047] In some embodiments of the present application, in order to achieve more accurate product recommendations, the most detailed classification category can be determined from the multi-level product categories of the product as the product category of the product, thereby achieving accurate positioning of each product. Specifically, the multi-level classification category of each product in the preset product library can be determined based on the preset classification system; the classification category of the target level is selected from the multi-level classification category as the product category of the corresponding product. Among them, the multi-level classification category can include multiple levels of classification categories from high to low, and the lower the level, the more accurate the corresponding classification category, and the classification category of the target level represents the lowest level of classification category of the product. For example Figure 3 As shown, the classification category of the target level can be a three-level classification L3.
[0048] In some embodiments of the present application, the user-product interaction data includes data corresponding to the interaction behavior between the user and the product. For example, the interaction behavior between the user and the product may include but is not limited to the user clicking, adding to cart, purchasing, collecting, liking, commenting, sharing, searching, etc. on the product. The user-product interaction data can be obtained based on the product evaluation data in the product library. The user-product interaction data can reflect the user's preference and interest in the product, so that the association relationship between the products (such as similar products, complementary products, etc.) can be determined based on the user-product interaction data. For example, when browsing fishing gear, the user usually clicks and browses a variety of fishing rods for comparison. The multiple fishing rods clicked by the user (such as multiple fishing rods of different brands and sizes) can be regarded as similar products; in addition, after purchasing a fishing rod, the user usually continues to click and browse fishing lines, fish hooks, baits, fishing chairs, fishing tackle bags and other products, which can be regarded as complementary products of the fishing rod (such as matching products and / or supplementary products of the product).
[0049] In some embodiments of the present application, when mining commodity associations (e.g., complementary commodities) based on user-commodity interaction data in the related art, the user-commodity interaction data used is mostly the user's historical common purchase and / or common purchase data, but the amount of such historical user-commodity interaction data is small, and usually can only cover a small number of commodities, and cannot provide sufficient data basis for mining commodity associations. The present application creatively proposes a process for mining commodity associations based on user-commodity interaction data, wherein each user-commodity interaction data corresponds to a commodity, and the user interaction data includes the user's historical interaction data (e.g., the user's historical purchase data, historical purchase data, etc. of the commodity) and real-time interaction data (e.g., the user's real-time click data, real-time purchase data, real-time collection data, etc. of the commodity); compared with the related art that only uses the user's historical data, the real-time interaction data can be updated and increased at any time, can cover more commodities, and make full use of user behavior data, thereby improving the accuracy of mining commodity associations.
[0050] Specifically, refer to Figure 4 As shown, it is a detailed flow chart of step S201 provided in the embodiment of the present application, which specifically includes the following steps:
[0051] Step S401 , sorting the user-product interaction data in chronological order, and removing continuous data for the same product from the sorted data sequence to obtain an updated data sequence.
[0052] In some embodiments of the present application, the user interaction data of any user can be sorted in chronological order, and the continuous repeated product data can be removed, thereby eliminating the interference of repeated data, streamlining the data sequence and reducing the difficulty of subsequent data analysis. Among them, it can be determined whether the continuous data belongs to the same product through the product identification of the product.
[0053] Step S402: divide the data in the updated data sequence according to a preset time length to obtain a plurality of sub-data sequences.
[0054] In some embodiments of the present application, the updated data sequence can be segmented according to a preset time length (eg, 1 hour), which can reduce the data length, and data analysis can be performed on the multiple segmented sub-data sequences, which can improve the efficiency of data analysis.
[0055] Step S403: taking the data of each two adjacent commodities in each sub-data sequence in the plurality of sub-data sequences as a data pair, and determining a commodity category pair corresponding to each data pair.
[0056] In some embodiments of the present application, when users interact with commodities, they usually follow the following rules: after interacting with a commodity, they continue to interact with similar commodities and / or complementary commodities of the commodity. Based on this rule, the data of each two adjacent commodities in each sub-data sequence can be analyzed to mine the commodity relationship between the two commodities that are adjacent in time series. Specifically, the data of each two adjacent commodities in each sub-data sequence can be taken as a data pair, and the commodity category pair (L3cat_{i}, L3cat_{i+1}) corresponding to each data pair is determined, where L3cat_{i} represents the classification category of the target classification level L3 of the i-th commodity in the sub-data sequence, and L3cat_{i+1} represents the classification category of the target classification level L3 of the i+1-th commodity in the sub-data sequence.
[0057] In one example, the product category pair (L3cat_{1}, L3cat_{2}) can be (shirts, shirts), the product category pair (L3cat_{2}, L3cat_{3}) can be (shirts, shirts), the product category pair (L3cat_{3}, L3cat_{4}) can be (shirts, trousers), and the product category pair (L3cat_{4}, L3cat_{5}) can be (trousers, shirts).
[0058] Step S202: determining an associated product of any product in the preset product library based on the product category pair.
[0059] In some embodiments of the present application, related commodities of any commodity can be determined based on two commodity categories of two commodities in a commodity category pair, wherein the related commodities include related commodities and unrelated commodities of the any commodity, wherein the related commodities include complementary commodities and similar commodities of the any commodity.
[0060] Specifically, refer to Figure 5 As shown, it is a detailed flow chart of step S202 provided in the embodiment of the present application, which specifically includes the following steps:
[0061] Step S501, counting the number of each commodity category pair corresponding to each sub-data sequence.
[0062] In some embodiments of the present application, the product category pairs (L3cat_{i}, L3cat_{i+1}) of every two consecutive user behavior events are counted to obtain the number of each product category pair, wherein the order of the two product categories in the product category pair is not considered when counting the product category pairs. For example, the product category pair (shirt, trousers) and the product category pair (trousers, shirt) can be regarded as the same product category pair.
[0063] For example, the number of product category pairs (shirt, shirt) in a certain sub-data sequence is 5, and the number of product category pairs (shirt, trousers) in the sub-data sequence is 4.
[0064] Step S502: determining a preset number of commodity category pairs with the largest number as target category pairs.
[0065] In some embodiments of the present application, the preset number can be set according to actual needs, for example, the preset number can be 3, and the present application does not limit this. The greater the number of a certain commodity category pair, the stronger the correlation between the two commodity categories in the commodity category pair.
[0066] Step S503: determine that the two commodities corresponding to the target category pair are related commodities.
[0067] In some embodiments of the present application, the target category pair represents a relatively large number of commodity category pairs, where two commodity categories have a strong correlation, and the corresponding two commodities can be regarded as related commodities, and the related commodities include complementary commodities and similar commodities.
[0068] Specifically, if the two classification categories in the target category pair are different, it is determined that the two commodities corresponding to the target category pair are complementary commodities; or, if the two classification categories in the target category pair are the same, it is determined that the two commodities corresponding to the target category pair are similar commodities.
[0069] In one example, if the two classification categories in the target category pair corresponding to the i-th product and the i+1-th product are different, it is determined that the i+1-th product and the i-th product in the two products corresponding to the target category pair are complementary products; if the two classification categories in the target category pair are the same, it is determined that the i+1-th product and the i-th product in the two products corresponding to the target category pair are similar products. For example, if the two classification categories in the target category pair (shirt, trousers) are different, it can be considered that the shirt product A and the trousers product B corresponding to (shirt, trousers) are complementary products; if the two classification categories in the target category pair (shirt, shirt) are the same, it can be considered that the shirt product C and the shirt product D corresponding to (shirt, shirt) are similar products.
[0070] Step S504: determine that the commodities corresponding to the data outside the target category pair are unrelated commodities of the two commodities corresponding to the target category pair.
[0071] In some embodiments of the present application, if the product category pair corresponding to the i-th product and the i+1-th product is a target category pair, the products corresponding to the data outside the target category pair are determined to be unrelated products of the i-th product and\or the i+1-th product.
[0072] In other embodiments of the present application, the commodities corresponding to the data outside the target category pair represent a smaller number of commodity category pairs, in which the correlation between the two commodity categories is weak, and the corresponding two commodities can be regarded as unrelated commodities. For example, the number of commodity category pairs (skateboard, mobile phone) is 1, which does not belong to the target category pair, and it can be considered that the skateboard commodity E and the mobile phone commodity F corresponding to (skateboard, mobile phone) are unrelated commodities.
[0073] Through the above embodiments, the association relationship between commodities can be fully mined based on historical and real-time user interaction data, and the mining accuracy of commodity association relationship can be improved, so as to obtain high-quality training data required for subsequent model training, and further improve the training effect of the model.
[0074] Step S203: construct a sample data set based on the product information of any product and the corresponding related products.
[0075] In some embodiments of the present application, before constructing the sample data set, useless data can also be deleted and the product data can be downsampled. Specifically, if any of the products does not have the corresponding complementary product or the similar product, the data corresponding to the any product is deleted; if any of the products is a popular product, the data corresponding to the any product is downsampled.
[0076] By removing the product data of products that do not have complementary or similar products, we can ensure that only meaningful relationship pairs are included in the data set, reduce the noise in the data set, and help optimize the data set so that the model can learn more effective features and improve the accuracy of classification. By downsampling popular products, the data distribution can be made more balanced, reducing the model's focus on popular products to avoid model overfitting and improve the model's generalization ability for various types of products. In addition, deleting useless data and downsampling popular products can reduce the size of the data set, thereby improving the computational efficiency of the training model.
[0077] In some embodiments of the present application, a piece of sample data corresponding to any commodity can be obtained by establishing an association between any commodity and the related commodities and unrelated commodities corresponding to the commodity. Specifically, the any commodity can be taken as the main commodity, and the first commodity title of the main commodity, the second commodity title of the supplementary commodity corresponding to the main commodity, the third commodity title of the similar commodity corresponding to the main commodity, and the fourth commodity title of the unrelated commodity corresponding to the main commodity can be obtained; the second commodity title, the third commodity title, and the fourth commodity title corresponding to the main commodity are used as labels for the first commodity title of the main commodity to obtain a piece of sample data with labels.
[0078] Through the above embodiment, the first product title of the main product can be used as input, and the corresponding second product title of the supplementary product, the third product title of the similar product and the fourth product title of the unrelated product can be used as labels, so as to facilitate the subsequent use of supervised learning methods to train the product recommendation model, so that the model can predict products that have an associated relationship with the main product, thereby improving the overall performance of the model.
[0079] In one example, sample data may be as shown in Table 1:
[0080] Table 1
[0081] Main product Similar products Complementary Goods Unrelated products Title of Product A Title of Product B Title of Product C Title of Product D Title of product A1 Title of product B1 Title of product C1 Title of product D1 Title of product A2 Title of product B2 Title of product C2 Title of product D2
[0082] Among them, the title represents the product title, and each row in the table can be used as a labeled sample data.
[0083] Step S204: Use the sample data set to train a preset model until the preset model meets preset conditions to obtain a product recommendation model.
[0084] In some embodiments of the present application, the preset model includes a text encoder (Sentence Encoder) and a multilayer perceptron (Multilayer perceptron, MLP). In one example, the text encoder can be followed by 3 MLP layers with preset activation functions, wherein the number of MLP layers can be set according to actual needs, and the preset activation function can be a ReLU activation function, etc., and the present application does not impose any specific restrictions on this.
[0085] The text encoder is used to encode the product titles in the sample data set to obtain the encoding vector (embedding) of the product title, and the multi-layer perceptron is used to spatially project the encoding vector to the corresponding category space, and the category space includes similar product space, complementary product space and unrelated product space.
[0086] Specifically, a text encoder (such as Word2Vec, FastText, BERT, etc.) is used to learn the semantic representation of each word in a product title or the entire title. For each product title, the text encoder can generate a fixed-length encoding vector that captures the semantic information of the title. The vector is usually pre-trained in an unsupervised learning task (such as language model training) and can be fine-tuned in subsequent supervised learning tasks. The encoding vector is used as the input of a multi-layer perceptron, which includes a feedforward neural network composed of multiple fully connected layers. Based on the input encoding vector, the probability distribution of products belonging to different category spaces (similar products, complementary products, and unrelated products) can be output, thereby mapping the encoding vector to the corresponding category space to achieve the classification of product relationships.
[0087] In some embodiments of the present application, if the main product is a, its corresponding similar product is s, its corresponding complementary product is c, and its corresponding unrelated product is n. The goal of model training includes making the distance between a and s as close as possible, the distance between a and n as far as possible, and the distance between a and c being controlled between the distance between a and s and the distance between a and n (for example Figure 6 Therefore, the preset condition includes that the loss value corresponding to the preset loss function is less than the preset loss threshold, and the preset loss function includes:
[0088] L=L sim +L comp +L neg +L l2 ,
[0089] L sim =max(d(a e ,s e )-m s ,0),
[0090] L comp =max(d(a e ,c e )-m c ,0)+max(m s -d(a e ,c e ),0),
[0091] L neg =max(m n -d(a e ,n e ), 0), where L represents the preset loss function, max() represents the maximum value function, and L() represents the distance function (such as the cosine function); a e The encoding vector representing the product title of any product, s e The encoding vector representing the product titles of similar products among the related products of any product, c e The encoding vector representing the product title of the complementary product among the related products of any of the products, n e The encoding vector of the product title of any product that is not related to the product; L l2 represents the regularization parameter of the multilayer perceptron of the preset model; m s 、m c With m n represents the preset threshold parameter, and m n >m c >m s .
[0092] Specifically, L simrepresents the loss function between the main product (or any of the products) and similar products; L comp represents the loss function between the main product and the complementary product; L neg Represents the loss function between the main product and irrelevant products; L l2 The regularization parameter, or weight decay parameter, of the multilayer perceptron representing the preset model can be calculated by the sum of the squares of the weight parameters of the MLP. It can be used to penalize excessively large weight parameter values to prevent model overfitting.
[0093] Through the above embodiments, the distance relationship between similar products, complementary products and irrelevant products is fully considered when designing the loss function, and a loss function that can measure these three relationships at the same time is obtained. For similar products, we hope that the model can shorten their distance in the feature space so that it is easier to find similar substitutes when recommending. For complementary products, we hope that the model can recognize the complementarity between them while maintaining a certain distance, so that when the user buys a certain product, it can recommend related complementary products. For irrelevant products, we hope that the model can push their distance in the feature space farther to avoid irrelevant noise when recommending. In this way, the performance of the model can be improved based on the loss function, and more accurate product recommendations can be achieved.
[0094] In some embodiments of the present application, the training process of the model may use a supervised training method. Specifically, the training method may include: dividing the sample data set into a training data set and a test data set, and using the current batch of data in the training data set to iteratively update the preset model for training; using the test data set to determine whether the preset model updated each time meets the preset conditions, if the preset conditions are not met, using the next batch of data according to the optimization algorithm (such as the gradient descent algorithm) to perform the next update on the preset model; repeating the above steps until the preset model meets the preset conditions. Among them, the preset conditions may be that the loss value corresponding to the loss function is less than the preset loss threshold, the model performance (such as accuracy, recall rate, etc.) reaches the preset performance threshold, the number of iterations of the model reaches the preset number threshold, etc., wherein the above-mentioned various thresholds can be set according to actual needs, and the present application does not impose specific restrictions on this.
[0095] The method provided in the embodiment of the present application identifies the product category pairs of each pair of adjacent products by analyzing the data sequence composed of user product interaction data in the preset product library; based on the product category pairs, the related products (including its complementary products) and unrelated products of any product can be accurately defined; then, a high-quality sample data set is constructed using the product information, and a preset model is trained until the preset conditions are met to obtain a product recommendation model that can effectively recommend complementary products, thereby improving the accuracy of product recommendations, expanding the diversity of recommended products, and providing users with more personalized and demand-oriented shopping recommendation services.
[0096] After the product recommendation model is trained, the product recommendation model can be used to recommend products. The application method of the product recommendation model provided in the embodiment of the present application can be run on a server (such as Figure 1 Server 20 shown).
[0097] Figure 7 1 is a flowchart of the application method of the commodity recommendation model provided in the embodiment of the present application. The application method of the commodity recommendation model specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some can be omitted.
[0098] Step S701: input a target product title of a target product into a product recommendation model, and use the product recommendation model to determine a target encoding vector of the target product title.
[0099] In some embodiments of the present application, the target product may represent a product that the user is willing to purchase, and the target product includes the product in the shopping cart and / or the product checkout page. The process of determining the target encoding vector of the target product title using the product recommendation model can refer to the relevant introduction to the text encoder in the model training method. In addition, the product recommendation model can be used in advance to obtain the encoding vector of each product in the preset product library and store it, so that the target encoding vector of the target product can be directly found and obtained, saving time for product recommendation.
[0100] Step S702, determine the distance between the target coding vector and the coding vector corresponding to the product title of each product in the preset product library, determine that the products whose distance is within the preset distance range are complementary products of the target product, and use the complementary products of the target product as the recommended products.
[0101] In some embodiments of the present application, the process of determining the distance between the target encoding vector and the encoding vector corresponding to the product title of each product in the preset product library can refer to the relevant description of the distance function of the loss function in the model training method, calculate the distance between each product and the target product, and then select the distance greater than m. s and is less than mc The target product is used as a complementary product of the target product. The number of complementary products can be one or more, and this application does not impose any specific restrictions on this.
[0102] In other embodiments of the present application, before calculating the distance between each commodity and the target commodity, commodities of the same type as the target commodity may be removed from the preset commodity library to obtain an updated commodity library; the updated commodity library may be downsampled to obtain a downsampled commodity library, and the distance between each commodity in the downsampled commodity library and the target commodity may be calculated, thereby saving online computing resources.
[0103] In some embodiments of the present application, the recommended product can also be displayed in a preset position of the target product in the graphical interactive interface, wherein the preset position can be set according to actual needs, and the image of the recommended product and the product title and other information can be displayed at the preset position, for example Figure 8 When a target product has multiple complementary products, the complementary products can be arranged in order of distance from the target product from small to large, and complementary products with a smaller distance are recommended to users first.
[0104] The method provided in the embodiment of the present application can be applied to product recommendation scenarios where users have purchasing intentions, such as product shopping cart pages and product checkout pages, to achieve fast and accurate recommendations for complementary products of the current product.
[0105] See also Fig. 9 , is a principle block diagram of a product recommendation model training device provided in an embodiment of the present application, which is adapted to one of the purposes of the present application and provides a product recommendation model training device, which is a functional embodiment of the product recommendation model training method of the present application. The product recommendation model training device includes: a category pair determination module 91, which is used to determine the product category pair of every two adjacent products in the data sequence according to a data sequence composed of user product interaction data corresponding to all products in the preset product library; an association relationship determination module 92, which is used to determine the associated products of any product in the preset product library based on the product category pair, wherein the associated products include the related products of any product, and the related products include the complementary products of any product; a data set construction module 93, which is used to construct a sample data set based on the product information of any product and the corresponding associated products; a model training module 94, which is used to train the preset model using the sample data set until the preset model meets the preset conditions to obtain the product recommendation model.
[0106] Another embodiment of the present application also provides an electronic device. Figure 1The application environment is only an example. In other exemplary embodiments, the computer program product implementing the product recommendation model training and application method of the embodiment of the present application can also be run on any electronic device with sufficient computing power (such as Fig.10 In the electronic device shown in the figure), each step of the product recommendation model training and application method is executed to provide the function of product recommendation model training and application.
[0107] See also Fig.10 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.10 As shown, in one embodiment of the present application, the electronic device 1000 can be a mobile phone, a tablet computer, a smart wearable device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, a netbook, etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device 1000.
[0108] like Fig.10 As shown, the electronic device 1000 may include, but is not limited to, a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104, and a bus 105. The processor 103 is coupled to the communication module 101, the memory 102, and the I / O interface 104 through the bus 105.
[0109] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1000 and does not constitute a limitation of the electronic device 1000. The electronic device 1000 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 1000 may also include a network access device, etc.
[0110] The communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more wired communication solutions such as Universal Serial Bus (USB), Controller Area Network (CAN), etc. The wireless communication module may provide one or more wireless communication solutions such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication network, Frequency Modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0111] The memory 102 can be used to store computer-readable instructions and / or modules. The processor 103 implements various functions of the electronic device 1000 by running or executing the computer-readable instructions and / or modules stored in the memory 102 and calling the data stored in the memory 102. The memory 102 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device 1000, etc. The memory 102 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.
[0112] The memory 102 may be an external memory and / or an internal memory of the electronic device 1000. Furthermore, the memory 102 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0113] The processor 103 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 103 is the computing core and control center of the electronic device 1000, and uses various interfaces and lines to connect various parts of the entire electronic device 1000, and executes the operating system of the electronic device 1000 and various installed applications, program codes, etc.
[0114] Exemplarily, the computer-readable instructions may be divided into one or more modules / sub-modules / units, one or more modules / sub-modules / units are stored in the memory 102 and executed by the processor 103 to complete the present application. One or more modules / sub-modules / units may be a series of computer-readable instruction segments capable of completing a specific function, and the computer-readable instruction segments are used to describe the execution process of the computer-readable instructions in the electronic device 1000. For example, the computer-readable instructions may be divided into multiple modules of the above-mentioned commodity recommendation model training and application device.
[0115] If the module / unit integrated in the electronic device 1000 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be implemented.
[0116] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable files, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction codes, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).
[0117] Combination Figures 2 to 8 The memory 102 in the electronic device 1000 stores computer-readable instructions, and the processor 103 can execute the computer-readable instructions stored in the memory 102 to implement the following Figures 2 to 8 The product recommendation model training and application method shown.
[0118] Specifically, the specific implementation method of the processor 103 for the above-mentioned computer readable instructions can refer to Figures 2 to 8 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0119] The I / O interface 104 is used to provide a channel for user input or output. For example, the I / O interface 104 can be used to connect various input and output devices, such as a mouse, keyboard, touch device, display screen, etc., so that the user can enter information or visualize information.
[0120] The bus 105 is at least used to provide a channel for mutual communication among the communication module 101 , the memory 102 , the processor 103 , and the I / O interface 104 in the electronic device 1000 .
[0121] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation.
[0122] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0123] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0124] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present application is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0125] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A product recommendation model training method, characterized in that: The method comprises: Determine a product category pair of every two adjacent products in the data sequence according to a data sequence consisting of user-product interaction data corresponding to all products in a preset product library; Determining, based on the commodity category pair, associated commodities of any commodity in the preset commodity library, wherein the associated commodities include related commodities of any commodity, and the related commodities include complementary commodities of any commodity; Constructing a sample data set based on the product information of any one of the products and the corresponding associated products; The sample data set is used to train a preset model until the preset model meets preset conditions to obtain a product recommendation model.
2. The product recommendation model training method according to claim 1, characterized in that: Before determining a product category pair of every two adjacent products in the data sequence formed by user-product interaction data corresponding to all products in the preset product library, the method further includes: Determine a multi-level classification category for each commodity in the preset commodity library based on a preset classification system; A classification category of a target level is selected from the multi-level classification categories as the commodity category of the corresponding commodity.
3. The product recommendation model training method according to claim 1, characterized in that: The determining, according to a data sequence consisting of user-product interaction data corresponding to all products in a preset product library, a product category pair of every two adjacent products in the data sequence comprises: Sorting the user-product interaction data in chronological order, and removing continuous data for the same product from the sorted data sequence to obtain an updated data sequence; Splitting the data in the updated data sequence according to a preset time length to obtain a plurality of sub-data sequences; The data of each two adjacent commodities in each sub-data sequence in the multiple sub-data sequences are taken as a data pair, and a commodity category pair corresponding to each data pair is determined.
4. The product recommendation model training method according to claim 3, characterized in that: The associated products also include unrelated products of any of the products, and determining the associated products of any of the products in the preset product library based on the product category pair includes: Counting the number of each commodity category pair corresponding to each sub-data sequence; Determine a preset number of commodity category pairs with the largest number as target category pairs; Determining that two commodities corresponding to the target category pair are related commodities to each other; It is determined that the commodities corresponding to the data outside the target category pair are unrelated commodities of the two commodities corresponding to the target category pair.
5. The product recommendation model training method according to claim 4, characterized in that: The related products also include similar products of any of the products, and the method further includes: If the two classification categories in the target category pair are different, determining that the two commodities corresponding to the target category pair are complementary commodities; or, If two classification categories in the target category pair are the same, it is determined that two commodities corresponding to the target category pair are similar commodities to each other.
6. The product recommendation model training method according to claim 1, characterized in that: The related products include complementary products and similar products. The sample data set is constructed based on the product information of any product and the corresponding related product, including: Taking any of the products as the main product, obtaining a first product title of the main product, a second product title of a complementary product corresponding to the main product, a third product title of a similar product corresponding to the main product, and a fourth product title of an unrelated product corresponding to the main product; The second product title, the third product title, and the fourth product title corresponding to the main product are used as labels for the first product title of the main product to obtain a piece of labeled sample data.
7. The product recommendation model training method according to claim 6, characterized in that: Before constructing the sample data set, the method further includes: If any of the products does not have the corresponding complementary product or similar product, delete the data corresponding to the product; If any of the commodities is a popular commodity, downsampling is performed on the data corresponding to the commodity.
8. The product recommendation model training method according to claim 1, characterized in that: The preset model includes a text encoder and a multi-layer perceptron. The text encoder is used to encode the product titles in the sample data set to obtain the encoding vectors of the product titles. The multi-layer perceptron is used to spatially project the encoding vectors to the corresponding category space. The category space includes similar product space, complementary product space and unrelated product space.
9. The product recommendation model training method according to claim 1, characterized in that: The preset condition includes that the loss value corresponding to the preset loss function is less than the preset loss threshold, and the preset loss function includes: L=L sim +L comp +L neg +L l2 , L sim =max(d(a e ,s e )-m s ,0), L comp =max(d(a e ,c e )-m c ,0)+max(m s -d(a e ,c e ),0), L neg =max(m n -skin e ,n e ),0), Wherein, L represents the preset loss function, max() represents the maximum value function, and d() represents the distance function; a e The encoding vector representing the product title of any product, s e The encoding vector representing the product titles of similar products among the related products of any product, c e The encoding vector representing the product title of the complementary product among the related products of any of the products, n e The encoding vector of the product title of any product that is not related to the product; L l2 represents the regularization parameter of the multilayer perceptron of the preset model; m s 、m c With m n represents the preset threshold parameter, and m n >m c >m s .
10. An application method of a product recommendation model, characterized in that: The method comprises: Inputting a target product title of a target product into a product recommendation model, and determining a target encoding vector of the target product title using the product recommendation model, wherein the target product includes products in a shopping cart and / or a product checkout page, and the product recommendation model is obtained by training using the product recommendation model training method according to any one of claims 1 to 9; and Determine the distance between the target coding vector and the coding vector corresponding to the product title of each product in the preset product library, determine the products whose distance is within the preset distance range as complementary products of the target product, and use the complementary products of the target product as the recommended products.
11. The method for applying the product recommendation model according to claim 10, characterized in that: The method further comprises: The recommended product is displayed at a preset position of the target product in a graphical interactive interface.
12. An electronic device, characterized in that: include: Memory, and A processor, wherein the processor executes computer-readable instructions stored in the memory to implement the product recommendation model training method according to any one of claims 1 to 9, or implements the product recommendation model application method according to any one of claims 10 to 11.
Citation Information
Cited By
Maternal and infant product information generation method and system based on user information analysis and medium
CN119180699A
Method, system and medium for generating maternal and infant product information based on user information analysis
CN119180699B
User behavior characteristic processing method, equipment and medium
CN119863293A
