Commodity category prediction model training and application method and electronic device

CN117312856BActive Publication Date: 2026-09-08BUSINESS LINE COMMERCIAL PTE LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311283228.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2026-09-08
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

[0003]本申请实施例提供一种商品类目预测模型训练及应用方法、电子设备,能够解决现有的商品类目预测模型需要使用带有标签的文本数据作为训练数据以及训练所需时间较长且模型的泛化能力不足的问题,能够有效提升利用模型根据商品文本进行商品类目预测的准确率与效率

Benefits of technology

[0014] A fourth aspect of this application provides an electronic device, including: a memory and a processor, wherein the processor executes computer-readable instructions stored in the memory to implement the product category prediction model training method or the product category prediction model application method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312856B_ABST
    Figure CN117312856B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a commodity category prediction model training and application method and an electronic device. The training method comprises: constructing an initial training set and a test set according to a commodity data set; performing at least one iteration update on a pre-acquired base model based on the initial training set until a commodity category prediction model satisfying a preset requirement is obtained. Each update comprises: determining, by using a current model, a similarity score between the text description of each commodity in the current training set and all classification labels; determining, based on the similarity score, a predicted classification label of each commodity corresponding to the current training set; updating the current training set according to the predicted classification label to obtain an updated training set; optimizing and updating the base model based on the updated training set to obtain an updated model; and performing the next update when it is determined by using the test set that the updated model does not satisfy the preset requirement. The present application can effectively improve the accuracy and efficiency of commodity category prediction by using a model according to commodity text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer technology, specifically the field of natural language processing, and particularly relates to a method for training and applying a commodity category prediction model, and an electronic device. Background Technology

[0002] When users search for products on e-commerce platforms, they typically input text information as keywords for product searches. Therefore, e-commerce platforms usually need to use product category prediction models to display product search results for the desired category based on the user's input text information. In related technologies, training product category prediction models typically requires significant time and manpower to acquire labeled text data as training data in order to achieve the required prediction accuracy. This results in lengthy model training times and insufficient generalization ability. Summary of the Invention

[0003] This application provides a method for training and applying a product category prediction model, as well as an electronic device. It can solve the problems of existing product category prediction models requiring labeled text data as training data, long training time, and insufficient generalization ability. It can effectively improve the accuracy and efficiency of predicting product categories based on product text using the model.

[0004] The first aspect of this application provides a method for training a product category prediction model, comprising: constructing an initial training set and a test set based on a product dataset; performing at least one iterative update on a pre-acquired basic model based on the initial training set until a product category prediction model that meets preset requirements is obtained, wherein any one of the at least one iterative updates includes: using the current model to determine the similarity score between the text description of each product in the current training set and all category tags; determining the predicted category tag of each product corresponding to the current training set based on the similarity score; updating the current training set based on the predicted category tag to obtain an updated training set; optimizing and updating the basic model based on the updated training set to obtain an updated model; and performing the next update when the updated model is determined by the test set not to meet the preset requirements.

[0005] According to an embodiment of this application, the method further includes: fine-tuning a preset model using the product dataset to obtain the base model, wherein the base model is used to predict the similarity between product categories.

[0006] According to an embodiment of this application, the product dataset includes product data for multiple products, and the product data includes a text description of each product and the category to which each product belongs; the step of constructing an initial training set and a test set based on the product dataset includes: dividing the products in the product dataset into a first product and a second product; constructing a set of category pairs corresponding to the target products in the first product, and constructing the initial training set using the set of category pairs of all target products; and constructing the test set using the data of the second product.

[0007] According to an embodiment of this application, constructing the category pair set corresponding to the target product in the first product includes: determining the first product whose number of belonging categories is greater than a preset value as the target product; forming category pairs from every two categories according to the set of categories to which each target product belongs; and taking the set of all category pairs corresponding to each target product as the category pair set.

[0008] According to an embodiment of this application, the method further includes: encoding the data in the commodity dataset using the base model to obtain an encoding vector for the data in the commodity dataset, wherein the encoding vector includes: a text encoding vector for the text description of each commodity and a category encoding vector for the category to which each commodity belongs.

[0009] According to an embodiment of this application, determining the predicted classification label of each product corresponding to the current training set based on the similarity score includes: determining the classification label with the highest similarity score as the target classification label; and when the similarity score corresponding to the target classification label is greater than a preset score threshold, using the target classification label as the predicted classification label.

[0010] According to an embodiment of this application, updating the current training set based on the predicted classification label includes: forming a data pair by combining the category of each product in the current training set with the corresponding predicted classification label, and updating the current training set using the data pair.

[0011] According to an embodiment of this application, optimizing and updating the base model based on the updated training set includes: using the base model to determine the distance between the category and the classification label in each data pair in the updated training set; and optimizing and updating the base model when the distance exceeds a preset distance range.

[0012] A second aspect of this application provides a method for applying a product category prediction model. The method includes: receiving a text description of a product to be predicted input by a user; inputting the text description into a product category prediction model, encoding the text description using the product category prediction model, wherein the product category prediction model is obtained using the product category prediction model training method described above; using the product category prediction model to determine a target classification label with the highest similarity score to the encoded text description, and using the target classification label as the target category to which the product to be predicted belongs.

[0013] A third aspect of this application provides a product category prediction model training device, which includes: a construction module for constructing an initial training set and a test set based on a product dataset; and an iterative update module for performing at least one iterative update on a pre-acquired basic model based on the initial training set until a product category prediction model that meets preset requirements is obtained.

[0014] A fourth aspect of this application provides an electronic device, including: a memory and a processor, wherein the processor executes computer-readable instructions stored in the memory to implement the product category prediction model training method or the product category prediction model application method.

[0015] The product category prediction model training method provided in this application can train the model using labels instead of text, based on the positive correlation between the product's text description and its category. This reduces the difficulty of collecting training data and improves the efficiency and generalization ability of the model. The application method of the product category prediction model provided in this application can be applied to the ranking part of e-commerce product retrieval, prioritizing the display of products in the same category as the user's query, effectively improving the accuracy and efficiency of predicting product categories based on product text. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a schematic diagram illustrating the application environment of a product category prediction model training method provided in an embodiment of this application.

[0018] Figure 2 This is a flowchart illustrating the product category prediction model training method provided in this application embodiment.

[0019] Figure 3 This is a schematic diagram illustrating the process of constructing an initial training set and a test set based on a product dataset, as provided in an embodiment of this application.

[0020] Figure 4 This is an example diagram of the network structure of the BERT model provided in the embodiments of this application.

[0021] Figure 5 An example diagram of the network structure of the basic model provided in the embodiments of this application.

[0022] Figure 6 This is a schematic diagram illustrating the process of any one of the at least one iterative updates to the base model provided in the embodiments of this application.

[0023] Figure 7 This is an example diagram illustrating the iterative updating of the base model provided in an embodiment of this application.

[0024] Figure 8 This is a flowchart illustrating the application method of the commodity category prediction model provided in the embodiments of this application.

[0025] Figure 9 This is a schematic diagram of a product category prediction model training device provided in an embodiment of this application.

[0026] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this application clearer, the application will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0028] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.

[0029] In the embodiments of this application, the terms "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 this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Unless otherwise specified, the following embodiments and features described herein can be combined with each other.

[0030] Please see Figure 1 This is a schematic diagram illustrating the application environment of a product category prediction model training method provided in an embodiment of this application. Figure 1 As shown, user terminal 10 and server 20 communicate via a network. The network can be a wired network or a wireless network. The wired network can be any of a local area network (LAN), a metropolitan area network (MAN), or a wide area network (WAN), and can be any of the following technologies: Wireless Fidelity (Wi-Fi), ZigBee Wireless Networks (ZigBee), Ultra Wideband (UWB), Universal Serial Bus (USB), etc.

[0031] User terminal 10 can be an electronic device such as a mobile phone, tablet computer, multimedia playback device, personal computer (PC), or wearable device. User terminal 10 can be a client with various applications installed, such as educational applications, information applications, information broadcasting applications, live streaming applications, e-commerce applications, etc.

[0032] Server 20 is used to provide background services for applications in user terminal 10. For example, server 20 can be the backend server of the aforementioned e-commerce application. Server 20 can be a computer device; in one embodiment of this application, it can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center.

[0033] User terminal 10 and server 20 communicate via a network to train a product category prediction model. In one embodiment of this application, the training of the product category prediction model can be performed on server 20. Specifically, server 20 can obtain a product dataset from user terminal 10 via the network or use a locally stored product dataset. Server 20 trains the product category prediction model based on the product dataset; after training the product category prediction model, server 20 can receive a text description of the product to be predicted sent by user terminal 10, use the product category prediction model to determine the target category to which the product to be predicted belongs, and send the target category to which the product to be predicted belongs and the corresponding product to user terminal 10 for user viewing.

[0034] In another embodiment of this application, after the server 20 trains the product category prediction model, it can also send the trained product category prediction model to the user terminal 10 for local storage via the network. The user terminal 10 receives the text description of the product to be predicted input by the user and uses the product category prediction model to determine the target category to which the product to be predicted belongs.

[0035] In another embodiment of this application, the training of the product category prediction model can be performed on the user terminal 10. Specifically, the user terminal 10 can obtain a product dataset from the server 20 via the network and train the category prediction model. After the product category prediction model is trained, the user terminal 10 receives a text description of the product to be predicted input by the user and uses the product category prediction model to determine the target category to which the product to be predicted belongs. The user terminal 10 can also send the trained product category prediction model to the server 20 via the network for backup.

[0036] The following description uses a computer program product that implements the product category prediction model training method of the embodiments of this application, running on a server (e.g., Figure 1 The example shown is server 20. Please refer to [link / reference]. Figure 2 The diagram shown is a flowchart illustrating the product category prediction model training method provided in an embodiment of this application. In one embodiment of this application, the method includes the following steps:

[0037] Step S201: Construct the initial training set and test set based on the commodity dataset.

[0038] In some embodiments of this application, the product dataset can be constructed by acquiring data from an open-source product database. For example, the product database may include, but is not limited to, a Standard Product Unit (SPU) database, a Stock Keeping Unit (SKU) database, etc.

[0039] In some embodiments of this application, to train the product category prediction model, the product dataset may include product data for multiple products. Each product's product data includes, but is not limited to, a unique identifier (Identity Document, ID), a text description (SPU text), and multiple SPU categories to which each product belongs. The text description includes detailed information such as the product's title and description, and is not an inherent attribute of the product. The product's category includes inherent attributes of the product, and each product may include multiple categories, such as the product's brand, model, configuration, grade, and color. In one example, the text description of product X might be "[Limited-Time Offer] 2023 New Genuine ** Brand xx Model E-sports Gaming Smartphone 5G Full Netcom Student Price 256G Large Memory Hundred Yuan Backup Phone," and the category to which product X belongs might include: Electronic Products, 3C Digital Products, xx Model, ** Brand, etc.

[0040] In some embodiments of this application, since each product can contain multiple categories, although there may be overlap between product categories, the number of categories in the product dataset can also be greater than the number of products. For example, when the number of products in the product dataset is 800, the number of categories in the product dataset can be 1000, and the set of categories in the product dataset can be represented as L{target labels}.

[0041] In e-commerce, product category prediction refers to classifying products into predefined categories based on their titles, descriptions, etc., or determining the corresponding category for a user based on the text information they input when searching for products on an e-commerce platform. The principle behind product category prediction includes the positive correlation between the product's text description and its category. However, because the length and content of product descriptions are not fixed, related model training methods typically require training on labeled text (i.e., product categories), requiring a large amount of sample data and significant manpower for text labeling. The training process is also very time-consuming, resulting in models with poor generalization ability.

[0042] The method provided in this application embodiment can use tags for model training instead of training the text based on the positive correlation between the text description of the product and the product category. This can reduce the difficulty of collecting training data and improve the efficiency of training the model and the generalization ability of the model.

[0043] In some embodiments of this application, such as Figure 3 As shown, the initial training and test sets are constructed based on the product dataset, including the following steps:

[0044] Step S301: Divide the products in the product dataset into first products and second products.

[0045] In some embodiments of this application, to facilitate the construction of initial training and test sets, the products corresponding to the product dataset can be first divided into first products and second products according to a preset ratio. The product data of the first products can then be used to construct the initial training set, and the product data of the second products can be used to construct the test set. For example, 7 / 10 of the products in the product dataset can be randomly selected as the first products in a 7:3 ratio, and the remaining 3 / 10 of the products in the product dataset (excluding the first products) can be selected as the second products.

[0046] Step S302: Construct a set of category pairs corresponding to the target products in the first product category, and construct the initial training set using the set of category pairs of all target products.

[0047] In some embodiments of this application, constructing the category pair set corresponding to the target product in the first product includes: determining the first product whose number of belonging categories is greater than a preset value as the target product; forming category pairs from every two categories according to the set of categories to which each target product belongs; and taking the set of all category pairs corresponding to each target product as the category pair set.

[0048] In some embodiments of this application, since the method provided in this application uses categories for training, it is necessary to determine the similarity between categories. Therefore, the categories of each product can be combined in pairs to form category pairs, and the similarity between the two categories in each category pair is predicted. Since each category pair requires at least two categories, the first product whose number of belonging categories is greater than a preset value (e.g., 2) is determined as the target product.

[0049] In some embodiments of this application, when constructing the category pair set of target product i, a set Ci = {c1, c2, ..., ck} consisting of the categories to which target product i belongs can be used, where the number of categories to which target product i belongs is k (k is greater than or equal to 2), and ck represents the k-th category to which target product i belongs; every two non-repeating categories in set Ci can be combined into category pairs, such as (c1, c2), (c1, c3), ..., (c2, ck), etc., to obtain Category pairs; using the target product i corresponding to The combination pairs form the category pair set Pi corresponding to the target product i.

[0050] In some embodiments of this application, the initial training set is constructed using the set of category pairs of all target products, and the smallest unit of data in the initial training set is a category pair.

[0051] Step S303: Construct the test set using the data of the second product.

[0052] In some embodiments of this application, the test set can be constructed by following the method for constructing the initial training set, by building a set of category pairs corresponding to products whose number of categories in the second product is greater than a preset value, and then using the set of category pairs to construct the test set. Alternatively, the data of the second product can be directly used as data in the test set to construct the test set.

[0053] In some embodiments of this application, the above method constructs an initial training set and a test set required for training the model. In order to make the model applicable to predicting the similarity between product categories, the method further includes: fine-tuning the preset model using the product dataset to obtain the base model, which is used to predict the similarity between product categories.

[0054] In some embodiments of this application, the pre-set model can be a BERT (Bidirectional Encoder Representation from Transformers) model. The BERT model is a pre-trained language model proposed by the Google AI Language team. Based on the Transformer network structure, the BERT model uses two BERT networks with shared weights, emphasizing the importance of bidirectional prediction, thus enabling better capture of similarity between sentences through parameter sharing. For example... Figure 4 The diagram shown is an example of the network structure of the BERT model provided in an embodiment of this application. Sentences A and B are input into the BERT model; the two BERT networks of the BERT model extract feature information from sentences A and B respectively, and input the feature information into a pooling layer; the pooling layer performs dimensionality reduction or pooling operations on the output of the BERT network to obtain the low-dimensional representation u of sentence A and the low-dimensional representation v of sentence B; Softmax Classifier represents the Softmax classifier, which can output the similarity between sentences A and B based on (low-dimensional representation u, low-dimensional representation v, and the difference |uv| between u and v).

[0055] In some embodiments of this application, since the input to the BERT model is generally a statement, in order to make the BERT model applicable to the prediction of similarity between product categories required by the embodiments of this application, the BERT model can be fine-tuned so that the BERT model can complete the learning to predict the similarity between product categories, thus obtaining the base model. Supervised learning methods can be used when fine-tuning the BERT model.

[0056] For example Figure 5 The diagram shown is an example of the network structure of the basic model provided in an embodiment of this application. Category E and category F are input into the basic model; two BERT networks of the basic model extract feature information for category E and category F respectively, and input the feature information into a pooling layer; the pooling layer performs dimensionality reduction or pooling operations on the output of the BERT networks to obtain the low-dimensional representation e of category E and the low-dimensional representation f of category F; the cosine similarity cosine-sim(e,f) between the low-dimensional representations e and f is determined as the similarity between category E and category F, and the value range of the cosine similarity is [-1,1]. The closer the cosine similarity is to 1, the higher the similarity between the two categories.

[0057] In some embodiments of this application, similar to the methods described above, the BERT model can be fine-tuned so that the base model can also be used to determine the similarity between the text description of a product and its category.

[0058] Step S202: Based on the initial training set, the pre-acquired basic model is iterated and updated at least once until a product category prediction model that meets the preset requirements is obtained.

[0059] In some embodiments of this application, the performance of the base model is relatively low. The base model can be iteratively updated at least once based on the initial training set. This iterative update process continuously expands and updates the initial training set, using the updated training set to optimize and update the base model until a product category prediction model that meets preset requirements is obtained. Since each iteration updates the base model, the at least one iteration process is essentially a self-training fine-tuning process for the base model.

[0060] In some embodiments of this application, such as Figure 6 As shown, any one of the at least one iterative updates performed on the base model includes the following steps:

[0061] Step S401: Use the current model to determine the similarity score between the text description of each product in the current training set and all category labels.

[0062] In some embodiments of this application, the current model used in the first update is the base model Mbase, and the current model used in each subsequent update represents the model obtained after the last update of the base model Mbase. For example, the current model used in the second update is the model obtained after updating the base model Mbase once (e.g., Figure 7 (M1 in the original text). The current training set used in the first update represents the initial training set, and the current training set used in each subsequent update represents the dataset obtained after the last update of the initial training set.

[0063] For example Figure 7 The diagram shown is an example of iteratively updating a base model according to an embodiment of this application. The iterative update process proceeds from left to right. During the first update, the base model Mbase is used to determine the similarity score between the text description (sputext) of each item in the current training set and all classification labels (targetlabels). Figure 7 The similarity score (Similarity(spu text, target labels)) is shown in step 2. Here, all category labels represent all categories to which all products in the product dataset belong. The set of all category labels can be referenced from L{target labels} in step S201.

[0064] In some embodiments of this application, the product category prediction is based on the positive correlation between the text description of a product and its category, where each product's text description corresponds to multiple categories to which that product belongs. Therefore, the text description of any product and its multiple categories can be considered to have a high similarity score, and the multiple categories to which any product belongs can also be considered to have a high similarity score. That is, it can be initially assumed that each product belongs to the same category, and then the true similarity between categories is calculated during model training, updating the category based on the calculation results.

[0065] In some embodiments of this application, to ensure comparability between text descriptions and all category labels, the method further includes: encoding the data in the product dataset using the base model to obtain an encoding vector for the data in the product dataset. The encoding vector includes: a text encoding vector for the text description of each product and a category encoding vector for the category to which each product belongs. Specifically, the base model can be used to encode the data in the product dataset into embedding vectors, which are then stored in a file with a preset format for easy extraction and use later, improving the training efficiency of the model. For example, the embedding vectors can be stored in an H5 file. H5 files are the fifth generation of Hierarchical Data Format (HDF5), suitable for storing and organizing large-scale datasets and groups of data.

[0066] In some embodiments of this application, when using the current model to determine the similarity score between the text description of each product in the current training set and all category tags, since the category tags are the product categories, the cosine similarity between the text encoding vector of each product in the current training set and the category encoding vector corresponding to each category tag l in the category tag set L can be used as the similarity score. In one example, this process can be represented as follows: Figure 7 In step 1, inference, involves using the current model to infer the similarity score between the text description of each product and all category labels.

[0067] Step S402: Determine the predicted classification label for each product in the current training set based on the similarity score.

[0068] In some embodiments of this application, determining the predicted classification label for each product in the current training set based on the similarity score includes: determining the classification label with the highest similarity score as the target classification label; and when the similarity score corresponding to the target classification label is greater than a preset score threshold, using the target classification label as the predicted classification label.

[0069] Specifically, for any product i in the current training set, the classification label lj corresponding to the highest similarity score s(ti,lj) with the text description ti is selected as the target classification label. However, the highest similarity score s(ti,lj) may not actually be high; for example, the highest similarity score s(ti,lj) = 0.3. Therefore, the text description ti and the target classification label may not actually be similar. Thus, the similarity score s(ti,lj) corresponding to the target classification label can be compared with a preset score threshold (e.g., 0.7). Only when the similarity score s(ti,lj) corresponding to the target classification label is greater than the score threshold is it determined that the target classification label can be used as the predicted classification label (targetlabel).

[0070] In one example, step S402 can be represented as Figure 7 The preliminary classification shown in step 3 is to preliminarily determine the predicted classification label corresponding to the text description ti.

[0071] Step S403: Update the current training set according to the predicted classification label to obtain the updated training set.

[0072] In some embodiments of this application, for any product i in the current training set, the predicted classification label lj is the classification label with the highest similarity to the text description ti determined by the current model. The predicted classification label lj and the category in the category set Ci to which product i belongs can be regarded as the same type, that is, the category to which product i belongs can be regarded as having a high degree of similarity. Therefore, the predicted classification label lj can be used to expand the category pair set Pi corresponding to product i to realize the update of the current training set.

[0073] In some embodiments of this application, updating the current training set based on the predicted classification label includes: forming a data pair by combining the category of each product corresponding to the current training set with the corresponding predicted classification label, and updating the current training set using the data pair. Specifically, for any product i corresponding to the current training set, the predicted classification label lj can be paired with all elements (c1, c2, ..., ck) in the category set Ci of product i to obtain data pairs ((spu categories, target label) pairs): (c1, lj), (c2, lj), ..., (ck, lj). These data pairs are used to expand the category pair set Pi of product i, thereby updating the current training set. In one example, this process can be represented as follows: Figure 7 The selection pairs shown in step 3.

[0074] In one example, updating the current training set based on the predicted classification label can be represented as: Figure 7 Step 4 shows the process of using data pairs as new training samples.

[0075] Step S404: Optimize and update the base model based on the updated training set to obtain an updated model.

[0076] In some embodiments of this application, optimizing and updating the base model based on the updated training set includes: using the base model to determine the distance between the category and the classification label in each data pair in the updated training set; and optimizing and updating the base model when the distance exceeds a preset distance range.

[0077] In some embodiments of this application, the base model can be used to determine the cosine distance between the category and the classification label in each data pair in the updated training set, and to determine whether the cosine distance exceeds a preset distance range (e.g., (0, 0.3)). When the cosine distance exceeds the preset distance range, it indicates that the prediction accuracy of the base model is low at this time, and the base model needs to be optimized and updated to improve the model's performance. Specifically, the updated training set can be used to retrain or fine-tune the base model, such as adjusting the model's parameters, loss function, etc. Since the updated training set is larger than the initial training set, the generalization performance of the base model can be improved.

[0078] In some embodiments of this application, when the cosine distance does not exceed the preset distance range, it indicates that the prediction accuracy of the base model is high at this time. However, in order to improve the generalization ability of the model, the base model can still be optimized and updated using an updated training set.

[0079] In one example, step S404 can be represented as Figure 7 The first update fine-tuning (iteration 1) is shown in step 5.

[0080] Step S405: Use the test set to determine whether the updated model meets the preset requirements. If it is determined that the updated model does not meet the preset requirements, execute step S401; if it is determined that the updated model meets the preset requirements, execute step S406.

[0081] In some embodiments of this application, the preset requirement includes: the prediction accuracy of the predicted category label corresponding to the product determined by the updated model based on the text description of the product exceeds a preset accuracy threshold (e.g., 0.85).

[0082] Specifically, for a product w in the test set, the text description tw of product w in the test set can be input into the updated model; the updated model is used to determine the similarity score between the text description tw and each category label l in the category label set L, and the category label with the highest similarity score is selected as the predicted category label; it is determined whether the predicted category label belongs to the category to which product w belongs; if the predicted category label belongs to the category to which product w belongs, then the prediction accuracy of the updated model for product w is determined to be 100%.

[0083] In some embodiments of this application, when using the test set to determine whether the updated model meets the preset requirements, multiple text descriptions of multiple products in the test set can be input into the updated model; the updated model can output the predicted classification label corresponding to each product in the test set, and determine the number of products with a prediction accuracy of 100%; the ratio of this number to the number of multiple products in the input test set can be used as the prediction accuracy of the updated model.

[0084] In some embodiments of this application, when defining the preset requirements, since product w may belong to multiple categories, the number of predicted category labels for product w with a 100% prediction accuracy obtained by the updated model can also be taken into consideration. For example, if product w belongs to 5 categories, and the updated model predicts 3 category labels for product w with a 100% prediction accuracy, then the prediction accuracy of the updated model for product w is 3 / 5 = 60%. To determine whether the updated model meets the preset requirements using the test set, all text descriptions of all products in the test set can be input into the updated model to obtain the average prediction accuracy of the updated model for all products corresponding to the test set, and it can be determined whether the average value exceeds the preset accuracy threshold.

[0085] In some embodiments of this application, when defining the preset requirements, in conjunction with the description in the subsequent step S503, since the method provided by the embodiments of this application can be applied to providing users with products of categories corresponding to the input text description on e-commerce platforms, the prediction efficiency of the product category prediction model can be taken into consideration. For example, when the above method determines that the prediction accuracy of the updated model is greater than the preset accuracy threshold, it determines whether the time consumed by the updated model prediction exceeds the preset duration (e.g., 1 second). When the time consumed by the updated model prediction does not exceed the preset duration, it is determined that the updated model meets the preset requirements.

[0086] In some embodiments of this application, when it is determined that the updated model does not meet the preset requirements, the next update is performed, for example... Figure 7 As shown.

[0087] Step S406: Use the updated model as the product category prediction model.

[0088] In some embodiments of this application, for example Figure 7 As shown, when it is determined that the updated model meets the preset requirements, the updated model is used as the product category prediction model Mfinal.

[0089] In some embodiments of this application, for example Figure 7 As shown, if the product category prediction model Mfinal is model M2 obtained in the second update (iteration 2), according to the description in step S604, the training set used by model M2 is the training set updated when model M1 was last updated, that is... Figure 7 Step 7 in the middle means that the model Mfinal is obtained by fine-tuning the base model Mbase based on the training set updated in step 6 (Fine-tune with step 6 sample data).

[0090] The product category model training method provided in this application can train the model using labels instead of training the text based on the positive correlation between the text description of the product and the product category. Compared with the methods in related technologies that require text data annotation, it can reduce the difficulty of collecting training data. By combining the BERT model and the SPU product dataset, it can train the product category prediction by self-training, thereby improving the efficiency of model training and the generalization ability of the model.

[0091] In some embodiments of this application, the training process of the product category prediction model is described in detail above. Next, the application method of using the product category prediction model for product category prediction will be introduced. For example... Figure 8 As shown, the application method of the product category prediction model includes the following steps:

[0092] Step S501: Receive the text description of the product to be predicted input by the user.

[0093] In some embodiments of this application, the e-commerce platform of user terminal 10 can receive a text description of the product to be predicted input by the user. The text description of the product to be predicted input by the user can be a sequence of multiple words used by the user to query the corresponding product, such as "{2023 new genuine hundred-yuan backup mobile gaming smartphone **brand}".

[0094] Step S502: Input the text description into the product category prediction model and encode the text description using the product category prediction model.

[0095] In some embodiments of this application, the text description is input into a product category prediction model. In order to determine the category that is most relevant to the input text description, the input text description is encoded into an embedding vector.

[0096] Step S503: Use the product category prediction model to determine the target classification label with the highest similarity score to the encoded text description, and use the target classification label as the target category to which the product to be predicted belongs.

[0097] In some embodiments of this application, determining the target category label with the highest similarity score to the encoded text description using the product category prediction model includes: determining the similarity score (e.g., cosine similarity) between the encoded text description and all category labels using the product category prediction model, determining the category label with the highest similarity score as the target category label, and using the target category label as the target category to which the product to be predicted belongs.

[0098] In some embodiments of this application, the product category prediction model can also be used to determine multiple target classification labels with the highest similarity scores to the encoded text description. After obtaining the multiple target classification labels, the method may further include:

[0099] The multiple category tags are sorted according to their corresponding similarity scores. Multiple products corresponding to the multiple target category tags are selected from the e-commerce platform's product library. These products are then arranged in descending order of their similarity scores to their respective target category tags to obtain a list of products corresponding to the multiple target category tags; or...

[0100] Determine the overlap between the category set corresponding to each product in the product library of the e-commerce platform and the multiple target classification tags, and arrange the products in the product library in descending order of the corresponding overlap to obtain the product list corresponding to the multiple target classification tags;

[0101] The products corresponding to the product list are displayed to the user.

[0102] The product category prediction method provided in this application can be applied to the sorting part of e-commerce product retrieval, and can prioritize displaying products with the same category as the user's query content, which can effectively improve the sorting effect.

[0103] Please see Figure 9This is a schematic diagram of a product category prediction model training device provided in an embodiment of this application. It is provided to meet one of the purposes of this application and is a functional embodiment of the product category prediction model training method of this application. The product category prediction model training device includes: a construction module 61, used to construct an initial training set and a test set based on a product dataset; and an iterative update module 62, used to perform at least one iterative update on the pre-acquired basic model based on the initial training set until a product category prediction model that meets preset requirements is obtained.

[0104] Another embodiment of this application also provides an electronic device. Figure 1 The application environment described is merely an example. In other exemplary embodiments, the computer program product implementing the product category prediction model training or application method of this application can also run on any electronic device with sufficient computing power (such as...). Figure 10 The electronic device shown executes each step of the product category prediction model training or application method to provide the function of product category prediction model training or application.

[0105] Please see Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 10 As shown, in one embodiment of this application, the electronic device 800 can be a mobile phone, tablet computer, smart wearable device, augmented reality (AR) / virtual reality (VR) device, laptop computer, netbook, etc. This application embodiment does not limit the specific type of electronic device 800.

[0106] like Figure 10 As shown, the electronic device 800 may include, but is not limited to, a communication module 81, a memory 82, a processor 83, an input / output (I / O) interface 84, and a bus 85. The processor 83 is coupled to the communication module 81, the memory 82, and the I / O interface 84 via the bus 85.

[0107] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 800 and does not constitute a limitation on electronic device 800. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 800 may also include network access devices, etc.

[0108] The communication module 81 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) and Controller Area Network (CAN). The wireless communication module may provide one or more wireless communication solutions such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication networks, Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR) technologies.

[0109] The memory 82 can be used to store computer-readable instructions and / or modules. The processor 83 implements various functions of the electronic device 800 by running or executing the computer-readable instructions and / or modules stored in the memory 82 and by calling the data stored in the memory 82. The memory 82 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device 800, etc. The memory 82 may include non-volatile and volatile memory, such as: hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other storage devices.

[0110] The memory 82 can be an external memory and / or an internal memory of the electronic device 800. Furthermore, the memory 82 can be a physical memory, such as a memory module, a TF card (Trans-flash Card), etc.

[0111] Processor 83 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. Processor 83 is the computational core and control center of electronic device 800, connecting various parts of electronic device 800 through various interfaces and lines, and executing the operating system of electronic device 800 and various installed application programs and program code.

[0112] For example, computer-readable instructions can be divided into one or more modules / submodules / units, which are stored in memory 82 and executed by processor 83 to complete this application. One or more modules / submodules / units can be a series of computer-readable instruction segments capable of performing a specific function, describing the execution process of the computer-readable instructions in electronic device 800. For example, computer-readable instructions can be divided into a building module 61 and an iterative update module 62.

[0113] If the modules / units integrated in the electronic device 800 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium, and when executed by a processor, they can implement the steps of the various method embodiments described above.

[0114] Computer-readable instructions include computer-readable instruction code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer-readable instruction code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), and random access memory (RAM).

[0115] Combination Figures 2 to 8The memory 82 in the electronic device 800 stores computer-readable instructions, and the processor 83 can execute the computer-readable instructions stored in the memory 82 to achieve, for example, Figures 2 to 8 The training or application methods for the product category prediction model are shown.

[0116] Specifically, the specific implementation method of the processor 83 for the above-mentioned computer-readable instructions can be found in [reference]. Figures 2 to 6 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0117] I / O interface 84 is used to provide a channel for user input or output. For example, I / O interface 84 can be used to connect various input and output devices, such as mouse, keyboard, touch device, display screen, etc., so that users can enter information or visualize information.

[0118] Bus 85 is used at least to provide a channel for communication between communication modules 81, memory 82, processor 83, and I / O interface 84 in electronic device 800.

[0119] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0120] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0121] Furthermore, the functional modules in the various embodiments of this 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 integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0122] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0123] Furthermore, it is clear that the word "including" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices can also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. A method for training a product category prediction model, characterized in that, The method includes: Construct initial training and test sets based on the product dataset; Based on the initial training set, the pre-acquired basic model is updated at least once until a product category prediction model that meets the preset requirements is obtained, wherein any one of the at least one iteration update includes: The current model is used to determine the similarity score between the text description of each item in the current training set and all category labels; Determining the predicted classification label for each product in the current training set based on the similarity score includes: determining the classification label with the highest similarity score as the target classification label; when the similarity score corresponding to the target classification label is greater than a preset score threshold, the target classification label is used as the predicted classification label. The updated training set is obtained by updating the current training set according to the predicted classification label, including: forming a data pair by combining the category of each product in the current training set with the corresponding predicted classification label, and updating the current training set using the data pair; The base model is optimized and updated based on the updated training set to obtain an updated model; When the test set determines that the updated model does not meet the preset requirements, the next update is performed until the updated model meets the preset requirements, and the updated model is used as the product category prediction model.

2. The product category prediction model training method according to claim 1, characterized in that, The method further includes: The preset model is fine-tuned using the product dataset to obtain the base model, which is used to predict the similarity between product categories.

3. The product category prediction model training method according to claim 1, characterized in that, The product dataset includes product data for multiple products, and the product data includes a text description of each product and the category to which each product belongs; The process of constructing the initial training and test sets based on the commodity dataset includes: The products in the product dataset are divided into first products and second products; Construct a set of category pairs corresponding to the target products in the first product, and construct the initial training set using the set of category pairs of all target products; The test set is constructed using the data from the second product.

4. The product category prediction model training method according to claim 3, characterized in that, The construction of the category pair set corresponding to the target product in the first product includes: The first product whose category has a quantity greater than a preset value is identified as the target product; Each target product is paired with every two categories based on the set of categories to which it belongs. The set of all category pairs corresponding to each target product is then used as the category pair set.

5. The product category prediction model training method according to claim 1, characterized in that, The method further includes: The data in the product dataset is encoded using the base model to obtain an encoding vector for the data in the product dataset. The encoding vector includes: a text encoding vector for the text description of each product and a category encoding vector for the category to which each product belongs.

6. The product category prediction model training method according to claim 1, characterized in that, The optimization and updating of the base model based on the updated training set includes: The distance between the category and the classification label in each data pair in the updated training set is determined using the base model. When the distance exceeds a preset distance range, the base model is optimized and updated.

7. A method for applying a commodity category prediction model, characterized in that, The method includes: Receive text descriptions of the products to be predicted from user input; The text description is input into the product category prediction model, and the text description is encoded using the product category prediction model. The product category prediction model is obtained using the product category prediction model training method as described in any one of claims 1 to 6. The product category prediction model is used to determine the target category tag with the highest similarity score to the encoded text description, and the target category tag is used as the target category to which the product to be predicted belongs.

8. An electronic device, characterized in that, The electronic device includes a processor and a memory. The processor is used to execute a computer program stored in the memory to implement the product category prediction model training method as described in any one of claims 1 to 6, or to implement the product category prediction model application method as described in claim 7.

Citation Information

Patent Citations

  • Label prediction method and device, electronic equipment and medium

    CN110232403A

  • Product prediction robot for e-commerce commodities and implementation method thereof

    CN116186249A

  • Pre-training classification model training method and device, equipment and medium

    CN116522222A