Method and apparatus for generating information
By using pre-trained target encoding model and information generation model, combined with penalty factor constraints, the target embedding vector is generated to improve the probability prediction accuracy of the product being purchased simultaneously, and the problem of insufficient prediction accuracy in the prior art is solved.
Patent Information
- Application Number
- CN202110146244.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-03
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-02-03
AI Technical Summary
When the prior art predicts the probability that two commodities are purchased simultaneously, it is difficult to effectively capture the deep characteristics between the commodities, resulting in insufficient prediction accuracy.
A pre-trained target encoding model is adopted to generate a target embedding vector by receiving the adjacency vector of the target product, and a penalty factor is used to introduce the probability constraint that the product is purchased simultaneously, and then the pre-trained target information is input to generate a model to estimate the probability that the product is purchased simultaneously.
By reflecting the deep characteristics of the target product being purchased simultaneously, the accuracy of predicting the probability of the product being purchased simultaneously is improved.
Smart Images

Figure CN113793167B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, specifically to the field of machine learning, and more particularly to a method and apparatus for generating information. Background Art
[0002] Nowadays, Internet shopping is becoming more and more common in people's daily life. In order to improve the shopping experience of users, e-commerce platforms will push user-sensitive product information to users. This includes pushing other products for the product currently selected by the user based on the probability of two products being purchased at the same time.
[0003] In the related art, there are two main methods for predicting the probability of two products being purchased at the same time: one is to generate an embedding vector of the product in an unsupervised manner, represent the product features through the embedding vector, and then estimate the probability of the products being purchased at the same time by solving the distance between the vectors. The other is to estimate the probability of two products being purchased at the same time based on the historical data of the two products being purchased at the same time through the association rule-related algorithm. Summary of the invention
[0004] Embodiments of the present disclosure provide methods and devices for generating information.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for generating information, the method comprising: receiving a target adjacency vector of two target commodities, the target adjacency vector representing the number of times the target commodity and other commodities are purchased simultaneously; inputting the target adjacency vector into a pre-trained target encoding model to obtain a target embedding vector of the target commodity, wherein the loss function of the target encoding model includes a preset penalty factor, and the penalty factor represents the probability of the two commodities being purchased simultaneously; inputting the target embedding vectors of the two target commodities into a pre-trained target information generation model to obtain target information, the target information generation model representing the correspondence between the similarity of the two target embedding vectors and the probability of the two target commodities being purchased simultaneously, and the target information representing the probability of the two target commodities being purchased simultaneously.
[0006] In some embodiments, the target coding model is obtained through the following training steps: constructing an initial classification model and a model loss function, the initial classification model includes an initial coding layer, an initial decoding layer and an initial deep neural network, and the model loss function includes a penalty factor; obtaining sample historical sales data, the sample historical sales data includes historical sales data of a preset number of sample items; based on the sample historical sales data, generating a sample adjacency vector for each sample item; forming a sample item pair from any two sample items; generating a sample label for the sample item pair, the sample label characterizing whether the two sample items in the sample item pair are purchased at the same time; inputting the sample adjacency vectors of the two sample items in the sample item pair into the initial classification model, taking the sample label of the sample item pair as the expected output, training the initial classification model, and obtaining a trained classification model; extracting the trained coding layer from the trained classification model to obtain a target coding model.
[0007] In some embodiments, the target embedding vectors of two target commodities are input into a pre-trained target information generation model to obtain the target information, including: decoding the target embedding vector and inputting it into a pre-trained decoding layer to obtain a decoded target embedding vector; connecting the decoded target embedding vectors of the two target commodities to obtain a connected decoded target embedding vector; and inputting the connected target embedding vector into a pre-trained fully connected layer to obtain the target information.
[0008] In some embodiments, before inputting the target adjacency vector into a pre-trained target encoding model, the method further includes: in response to determining that the arrangement order of other commodities represented by the numerical values in the two target adjacency vectors is different, adjusting the arrangement order of other commodities represented by the numerical values in the two target adjacency vectors to be the same.
[0009] In some embodiments, the target adjacency vector is generated based on the following method: obtaining target historical sales data, the target historical sales data including historical sales data of two target products and historical sales data of at least one non-target product; extracting the number of times the target product and other products are purchased at the same time from the target historical sales data; arranging the number of times the target product and other products are purchased at the same time according to a preset arrangement order to obtain the target adjacency vector.
[0010] In a second aspect, an embodiment of the present disclosure provides a device for generating information, the device comprising: a receiving unit, configured to receive a target adjacency vector of two target commodities, the target adjacency vector representing the number of times the target commodity and other commodities are purchased at the same time; an encoding unit, configured to input the target adjacency vector into a pre-trained target encoding model to obtain a target embedding vector of the target commodity, wherein the loss function of the target encoding model includes a preset penalty factor, and the penalty factor represents the probability of the two commodities being purchased at the same time; a generating unit, configured to input the target embedding vector of the two target commodities into a pre-trained target information generation model to obtain target information, the target information generation model representing the correspondence between the similarity of the two target embedding vectors and the probability of the two target commodities being purchased at the same time, and the target information representing the probability of the two target commodities being purchased at the same time.
[0011] In some embodiments, the device also includes a model training unit, which is configured to: construct an initial classification model and a model loss function, the initial classification model includes an initial encoding layer, an initial decoding layer and an initial deep neural network, and the model loss function includes a penalty factor; obtain sample historical sales data, the sample historical sales data includes historical sales data of a preset number of sample products; based on the sample historical sales data, generate a sample adjacency vector for each sample product; form a sample product pair with any two sample products; generate a sample label for the sample product pair, the sample label represents whether the two sample products in the sample product pair are purchased at the same time; input the sample adjacency vectors of the two sample products in the sample product pair into the initial classification model, use the sample label of the sample product pair as the expected output, train the initial classification model, and obtain a trained classification model; extract the trained encoding layer from the trained classification model to obtain a target encoding model.
[0012] In some embodiments, the generation unit further includes: a decoding module, configured to decode the target embedding vector and input it into a pre-trained decoding layer to obtain a decoded target embedding vector; a connection module, configured to connect the decoded target embedding vectors of two target products to obtain a connected decoded target embedding vector; and an output module, configured to input the connected target embedding vector into a pre-trained fully connected layer to obtain target information.
[0013] In some embodiments, the apparatus further includes an adjustment unit configured to: in response to determining that the arrangement orders of the other commodities represented by the values in the two target adjacency vectors are different, adjust the arrangement orders of the other commodities represented by the values in the two target adjacency vectors to be the same.
[0014] In some embodiments, the device also includes a vector generation unit, which is configured to: obtain target historical sales data, the target historical sales data includes historical sales data of two target products and historical sales data of at least one non-target product; extract the number of times the target product and other products are purchased at the same time from the target historical sales data; arrange the number of times the target product and other products are purchased at the same time according to a preset arrangement order to obtain a target adjacency vector.
[0015] The method and device for generating information provided by the embodiments of the present disclosure use a pre-trained target encoding model to generate a target embedding vector based on the adjacency vector of the target product, and then estimate the probability of two target products being purchased at the same time based on the similarity of the two target embedding vectors. Through the penalty factor, the probability of the products being purchased at the same time is introduced into the encoding process of the vector, so that the target embedding vector can reflect the deep characteristics of the target products being purchased at the same time, thereby improving the accuracy of predicting the probability of the products being purchased at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0017] Figure 1 is an exemplary system architecture diagram in which some embodiments of the present disclosure may be applied;
[0018] Figure 2 is a flow chart of one embodiment of a method for generating information according to the present disclosure;
[0019] Figure 3 is a flowchart of generating a target coding model in one embodiment of a method for generating information according to the present disclosure;
[0020] Figure 4 is a flow chart of yet another embodiment of a method for generating information according to the present disclosure;
[0021] Figure 5 is a structural schematic diagram of an embodiment of a device for generating information according to the present disclosure;
[0022] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0023] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] Figure 1 An exemplary system architecture 100 is shown to which a method for generating information or an apparatus for generating information according to an embodiment of the present disclosure can be applied.
[0026] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0027] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. For example, the adjacency vector of the target product can be sent to the server, and the target information can be received from the server to determine the probability of two target products being purchased at the same time.
[0028] Terminal devices 101, 102, 103 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be electronic devices with communication functions, including but not limited to smart phones, tablet computers, e-book readers, laptop computers, desktop computers, etc. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules for providing distributed services, or they can be implemented as a single software or software module. No specific limitation is made here.
[0029] The server 105 may be a server that provides various services, such as a background data server that processes the data uploaded by the terminal devices 101, 102, and 103 (for example, generates a target embedding vector based on the target adjacency vector of the target product). The background data server may analyze and identify the received data, and feed back the processing results (such as target information) to the terminal device.
[0030] It should be noted that the method for generating information provided in the embodiment of the present disclosure can be executed by the terminal device 101, 102, 103, or by the server 105. Accordingly, the device for generating information can be set in the terminal device 101, 102, 103, or in the server 105. No specific limitation is made here.
[0031] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules for providing distributed services, or it can be implemented as a single software or software module. No specific limitation is made here.
[0032] Continue to refer Figure 2 , shows a process 200 of an embodiment of a method for generating information according to the present disclosure. The method for generating information comprises the following steps:
[0033] Step 201: Receive target adjacency vectors of two target commodities.
[0034] In this embodiment, the target adjacency vector represents the number of times the target product and other products are purchased at the same time. Figure 1 The server 105 shown in can receive the target adjacency vectors of two target commodities sent by the terminal device through the network. As an example, the target commodities are SKU1 (Stock Keeping Unit) and SKU4, and the order record of a certain user includes the following information: the number of times SKU1 and SKU2 are purchased at the same time is 2, the number of times SKU1 and SKU3 are purchased at the same time is 0, the number of times SKU1 and SKU4 are purchased at the same time is 0, the number of times SKU4 and SKU2 are purchased at the same time is 1, and the number of times SKU4 and SKU3 are purchased at the same time is 1, then the target adjacency vector of SKU1 is (0,2,0,0), and the target adjacency vector of SKU2 is (0,2,1,0).
[0035] In some optional implementations of the present embodiment, the target adjacency vector may be generated based on the following method: obtaining target historical sales data, the target historical sales data including historical sales data of two target commodities and historical sales data of at least one non-target commodity; extracting the number of times the target commodity and other commodities are purchased at the same time from the target historical sales data; arranging the number of times the target commodity and other commodities are purchased at the same time according to a preset arrangement order to obtain the target adjacency vector.
[0036] In this implementation, the target historical sales data may be, for example, order records of one or more users within a preset time period. The ranking order represents the order of the commodities pointed to by the individual values in the target adjacency vector, for example, the order of commodity numbers from large to small.
[0037] In a specific example, the target historical sales data may be the historical sales data of all commodities on a certain e-commerce platform, and the execution subject may obtain the target historical sales data from the database of the e-commerce platform. Then, the number of times the target commodity and other commodities are purchased at the same time is determined from the target historical sales data to obtain a numerical set, and then the numerical sets are combined into a target adjacency vector according to a preset arrangement order.
[0038] Step 202: Input the target adjacency vector into a pre-trained target encoding model to obtain a target embedding vector for the target product.
[0039] In this embodiment, the loss function of the target coding model includes a preset penalty factor, which represents the probability that two products are purchased at the same time. The target coding model represents the correspondence between the adjacency vector and the embedding vector, so that the probability that the products are purchased at the same time can be introduced into the target coding model as a constraint, so that the embedding vector can represent the potential features between the products, and the similarity of the two target embedding vectors can be represented by the cosine distance of the two target embedding vectors.
[0040] Typically, the loss function is used to guide the training of a machine learning model to constrain the machine learning model. As an example, the loss function may adopt a cross entropy loss function and introduce a penalty factor as a coefficient, as shown in formula (1).
[0041]
[0042] In the formula, loss encode represents the loss function of the target encoder, y (SKUA,SKUB) represents the penalty factor, f(SKUA) represents the target adjacent vector of the target product SKUA, and f(SKUB) represents the target adjacent vector of the target product SKUB.
[0043] During the training phase of the target encoder, the penalty factor can be set according to the sample label. For example, when the input sample contains items that are purchased at the same time, the penalty factor can be set to 1, and the value of the loss function is larger at this time; when the input sample does not contain items that are purchased at the same time, the penalty factor can be set to 0, and the value of the loss function is smaller at this time. This guides the target encoder to learn the weight vector and offset vector of each layer during the training phase.
[0044] Step 203: input the target embedding vectors of the two target commodities into a pre-trained target information generation model to obtain target information.
[0045] In this embodiment, the target information generation model represents the corresponding relationship between the similarity of two target embedding vectors and the probability of two target commodities being purchased at the same time, and the target information represents the probability of two target commodities being purchased at the same time.
[0046] In this embodiment, the cosine distance of the two target embedding vectors can be used to represent the similarity of the two target embedding vectors. The smaller the cosine distance, the higher the similarity, and correspondingly the higher the probability that the two products are purchased at the same time.
[0047] As an example, the execution subject may use a pre-trained classification model as a target information generation model. The execution subject inputs the two target embedding vectors obtained in step 202 into the classification model, and the output classification label is the target information. For example, it may be 1 or 0, 1 indicating that the two target products will be purchased at the same time, and 0 indicating that the two target products will not be purchased at the same time.
[0048] For another example, the execution entity may also use a pre-trained regression model as the target information generation model. The execution entity inputs the two target embedding vectors obtained in step 202 into the regression model. The output confidence is the target information. The confidence can represent the probability of the two target products being purchased at the same time.
[0049] In some optional implementations of the present embodiment, the target embedding vectors of two target commodities are input into a pre-trained target information generation model to obtain target information, including: decoding the target embedding vector and inputting it into a pre-trained decoding layer to obtain a decoded target embedding vector; connecting the decoded target embedding vectors of the two target commodities to obtain a connected decoded target embedding vector; and inputting the connected target embedding vector into a pre-trained fully connected layer to obtain target information.
[0050] In this implementation, the decoding process of the target embedding vector by the pre-trained decoding layer is opposite to the encoding process in step 202, the parameters of the first decoding layer are the same as the last layer parameters of the target encoding model, and the parameters of the last decoding layer (such as the weight vector and the offset vector) are the same as the first layer parameters of the target encoding model, so that it can be ensured that the dimensions of the input target embedding vector and the decoded target embedding vector remain unchanged.
[0051] The execution subject can directly connect the two decoding target embedding vectors in parallel to obtain the connected decoding target embedding vector. For example, the decoding target embedding vector of target product SKU1 is (1,2), and the decoding target embedding vector of target product SKU2 is (2,3), then the connected decoding target embedding vector generated by the execution subject is (1,2,2,3).
[0052] The execution subject can use a neural network as a fully connected layer, such as DNN (Deep Neural Networks), CNN (Convolutional Neural Network) or other neural networks. The execution subject inputs the decoded target embedding vector after connection into the fully connected layer, multiplies it by the weight matrix of each layer, obtains the reduced dimension vector, and inputs it into the next layer. The last layer of the fully connected layer is the Sigmoid layer, which converts the numerical value into a numerical value in the interval [0,1] to represent the probability of two target products being purchased at the same time.
[0053] In a specific example of this embodiment, the method for generating information disclosed in the present invention can be applied to the business scenario of information push of an e-commerce platform. Specifically, the execution subject is the business server of the e-commerce platform. When the execution subject detects that the user places an order for commodity A at the terminal, commodity A can be used as the first target commodity, and then other commodities in the historical sales data can be used as the second target commodity in turn, and the above steps are performed: the target adjacency vectors of commodity A and the second target commodity are extracted, and the two target adjacency vectors are input into the target encoding model to obtain two target embedding vectors. Afterwards, the two target embedding vectors are input into the pre-trained information generation model to obtain the target information of commodity A and the commodity. In this way, the probability of other commodities being purchased at the same time as commodity A can be obtained. The execution subject can arrange other commodities in order from large to small according to the probability of being purchased at the same time as commodity A, and push the commodities with the highest ranking to the user to increase the probability of the user placing an order.
[0054] The method and device for generating information provided by the embodiments of the present disclosure use a pre-trained target encoding model to generate a target embedding vector based on the adjacency vector of the target product, and then estimate the probability of two target products being purchased at the same time based on the similarity of the two target embedding vectors. Through the penalty factor, the probability of the products being purchased at the same time is introduced into the encoding process of the vector, so that the target embedding vector can reflect the deep characteristics of the target products being purchased at the same time, thereby improving the accuracy of predicting the probability of the products being purchased at the same time.
[0055] Continue to see Figure 3 , Figure 3 FIG. 1 is a flowchart of generating a target coding model in one embodiment of a method for generating information according to the present disclosure. Figure 3 The process 300 shown includes the following steps:
[0056] Step 301, construct an initial classification model and a model loss function, the initial classification model includes an initial encoding layer, an initial decoding layer and an initial deep neural network, and the model loss function includes a penalty factor.
[0057] In this embodiment, the model loss function is used to guide the training process of the initial classification model. The penalty factor can be determined based on the sample label. When the sample label indicates that the sample products are purchased at the same time, the penalty factor can be set to 1; when the sample label indicates that the sample products are not purchased at the same time, the penalty factor can be set to 0.
[0058] As an example, the loss function can be expressed as:
[0059] loss=-y (SKUA,SKUB) *logp (SKUA,SKUB) +[1-y (SKUA,SKUB) *logp(1-p (SKUA,SKUB) )]
[0060] In the formula, loss indicates the loss function; y (SKUA,SKUB) represents the penalty factor; p (SKUA,SKUB) It represents the result output by the initial classification model, representing the probability of two sample products SKUA and SKUB being purchased at the same time, predicted by the initial classification model based on the input samples.
[0061] In this embodiment, the number of layers of the initial coding layer and the initial decoding layer is the same, and the calculation process is opposite.
[0062] Step 302, obtaining sample historical sales data, where the sample historical sales data includes historical sales data of a preset number of sample commodities.
[0063] In this embodiment, the sample historical sales data includes historical sales data of at least three commodities, that is, the preset number is not less than 3. The larger the preset number, the larger the dimension of the sample data, the higher the efficiency and accuracy of model training, but the corresponding amount of calculation is also larger. The historical sales data can include the order time and order number of each commodity, and the order number is used to determine whether the commodities are purchased at the same time.
[0064] As an example, the sample historical sales data can be an order record of a user, or it can be the historical sales data of all products on an e-commerce platform.
[0065] Step 303: Generate a sample adjacency vector for each sample commodity based on the sample historical sales data.
[0066] In this embodiment, the execution entity may extract the number of times each sample product is purchased simultaneously with other sample products from the sample historical sales data, and then generate a sample adjacency vector based on the number of times each sample product is purchased simultaneously with other sample products.
[0067] For example, the sample history records include 5 products: SKU5, SKU6, SKU7, SKU8, and SKU9. SKU5 and SKU6 were purchased together twice, and SKU5 and SKU8 were purchased together three times. The sample adjacency vector of SKU5 is (0, 2, 0, 3, 0), and the sample adjacency vectors of other sample products can be obtained from this.
[0068] Step 304: any two sample commodities are combined into a sample commodity pair.
[0069] Continuing with the example in step 303, the execution entity may use a permutation and combination method to determine 10 sample commodity pairs from the sample historical records.
[0070] Step 305: Generate a sample tag for the sample product pair, where the sample tag indicates whether the two sample products in the sample product pair are purchased at the same time.
[0071] As an example, if two sample items in a sample item pair are purchased at the same time, the sample tag may be set to 1, otherwise, the sample tag may be set to 0.
[0072] Step 306: input the sample adjacency vectors of the two sample products in the sample product pair into the initial classification model, take the sample labels of the sample product pair as the expected output, train the initial classification model, and obtain a trained classification model.
[0073] In this embodiment, the execution subject can obtain a sample confidence output by the initial classification model each time it inputs a sample commodity pair into the initial classification model, and then inputs the sample confidence into the pre-constructed model loss function to obtain the loss value of the initial classification model in this training, and then corrects various parameters in the initial classification model based on the loss function, such as the initial weight vector and initial offset vector of the initial coding layer. Until the loss value meets the preset conditions, or the number of iterations reaches the preset number, the execution subject can determine that the training step is completed, and the classification model at this time is the target classification model.
[0074] Step 307, extracting the trained coding layer from the trained classification model to obtain a target coding model.
[0075] In this embodiment, the execution entity can extract all parameters of the coding layer (for example, the number of layers and the weight vector and offset vector of each layer) from the trained classification model to obtain the target coding model.
[0076] The method for generating a target coding model provided in this embodiment couples the training steps of the target coding model to the training process of the classification model, and introduces the penalty factor into the loss function of the classification model to guide the training process of the classification model and the target coding model. This can enable the embedding vector generated by the target coding model to more accurately reflect the potential association between commodities, thereby improving the accuracy of the prediction information.
[0077] Further references Figure 4 , which shows a process 400 of another embodiment of a method for generating information. The process 400 of the method for generating information includes the following steps:
[0078] Step 401, receiving target adjacency vectors of two target commodities, wherein the target adjacency vectors represent the number of times the target commodity and the other commodity are purchased at the same time. This step corresponds to the aforementioned step 201, and will not be described in detail here.
[0079] Step 402 : in response to determining that the arrangement orders of the other commodities represented by the values in the two target adjacency vectors are different, adjusting the arrangement orders of the other commodities represented by the values in the two target adjacency vectors to be the same.
[0080] As an example, the two target adjacency vectors received in step 401 are the target adjacency vectors of SKU1 and SKU2 respectively, and the other commodities included in the target adjacency vector are SKU3 and SKU4. If the commodities corresponding to the values in the target adjacency vector of SKU1 are sorted as (SKU1, SKU2, SKU3, SKU4), and the commodities corresponding to the values in the target adjacency vector of SKU2 are sorted as (SKU4, SKU3, SKU2, SKU1), then the execution entity may adjust the arrangement order of the values in SKU2 to (SKU1, SKU2, SKU3, SKU4).
[0081] Step 403: Input the target adjacency vector into the pre-trained target encoding model to obtain the target embedding vector of the target product. This step corresponds to the aforementioned step 202 and will not be repeated here.
[0082] Step 404: Input the target embedding vectors of the two target products into the pre-trained target information generation model to obtain target information. This step corresponds to the aforementioned step 203 and will not be repeated here.
[0083] from Figure 4 It can be seen that the process 400 of the method for generating information in this embodiment highlights the step of adjusting the arrangement order of the numerical values corresponding to each commodity in the target adjacent vector. By constraining the arrangement order of the numerical values corresponding to each commodity in the target adjacent vector, the interference of inconsistent parameters of the target adjacent vector on the prediction result can be avoided, thereby improving the accuracy of the prediction result.
[0084] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for generating information, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0085] like Figure 5 As shown, the device 500 for generating information in this embodiment includes: a receiving unit 501, configured to receive a target adjacency vector of two target commodities, the target adjacency vector representing the number of times the target commodity and other commodities are purchased at the same time; an encoding unit 502, configured to input the target adjacency vector into a pre-trained target encoding model to obtain a target embedding vector of the target commodity, wherein the loss function of the target encoding model includes a preset penalty factor, and the penalty factor represents the probability of the two commodities being purchased at the same time; a generating unit 503, configured to input the target embedding vector of the two target commodities into a pre-trained target information generation model to obtain target information, the target information generation model represents the corresponding relationship between the similarity of the two target embedding vectors and the probability of the two target commodities being purchased at the same time, and the target information represents the probability of the two target commodities being purchased at the same time.
[0086] In this embodiment, the device 500 also includes a model training unit, which is configured to: construct an initial classification model and a model loss function, the initial classification model includes an initial encoding layer, an initial decoding layer and an initial deep neural network, and the model loss function includes a penalty factor; obtain sample historical sales data, the sample historical sales data includes historical sales data of a preset number of sample commodities; based on the sample historical sales data, generate a sample adjacency vector of each sample commodity; form a sample commodity pair with any two sample commodities; generate a sample label for the sample commodity pair, the sample label represents whether the two sample commodities in the sample commodity pair are purchased at the same time; input the sample adjacency vectors of the two sample commodities in the sample commodity pair into the initial classification model, use the sample label of the sample commodity pair as the expected output, train the initial classification model, and obtain a trained classification model; extract the trained encoding layer from the trained classification model to obtain a target encoding model.
[0087] In this embodiment, the generation unit 503 further includes: a decoding module, configured to decode the target embedding vector and input it into a pre-trained decoding layer to obtain a decoded target embedding vector; a connection module, configured to connect the decoded target embedding vectors of two target products to obtain a connected decoded target embedding vector; and an output module, configured to input the connected target embedding vector into a pre-trained fully connected layer to obtain target information.
[0088] In this embodiment, the device 500 further includes an adjustment unit configured to: in response to determining that the arrangement orders of other commodities represented by the values in the two target adjacency vectors are different, adjust the arrangement orders of other commodities represented by the values in the two target adjacency vectors to be the same.
[0089] In this embodiment, the device 500 also includes a vector generation unit, which is configured to: obtain target historical sales data, the target historical sales data includes historical sales data of two target products and historical sales data of at least one non-target product; extract the number of times the target product and other products are purchased at the same time from the target historical sales data; arrange the number of times the target product and other products are purchased at the same time according to a preset arrangement order to obtain a target adjacency vector.
[0090] Reference below Figure 6 , which shows an electronic device (eg, Figure 1 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0091] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0092] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0093] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus, or a device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus, or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0094] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: receives the target adjacency vectors of two target commodities, the target adjacency vector represents the number of times the target commodity and other commodities are purchased at the same time; inputs the target adjacency vector into a pre-trained target coding model to obtain the target embedding vector of the target commodity, wherein the loss function of the target coding model includes a preset penalty factor, and the penalty factor represents the probability of the two commodities being purchased at the same time; inputs the target embedding vectors of the two target commodities into a pre-trained target information generation model to obtain target information, the target information generation model represents the corresponding relationship between the similarity of the two target embedding vectors and the probability of the two target commodities being purchased at the same time, and the target information represents the probability of the two target commodities being purchased at the same time.
[0095] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0096] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0097] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor includes a receiving unit, an encoding unit, and a generating unit. The names of these units do not constitute a limitation on the units themselves in certain circumstances, for example, the receiving unit may also be described as a "unit for receiving target adjacency vectors of two target commodities".
[0098] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. A method for generating information, wherein: include: Receive target adjacency vectors corresponding to two target products respectively, where the target adjacency vectors represent the number of times the target product and other products are purchased simultaneously in user order records within a preset time period; Inputting the target adjacency vector into a pre-trained target encoding model to obtain a target embedding vector of the target product, wherein the loss function of the target encoding model includes a preset penalty factor, and the penalty factor represents the probability that two products are purchased at the same time; The target embedding vectors of the two target commodities are input into a pre-trained target information generation model to obtain target information, wherein the target information generation model represents the corresponding relationship between the similarity of the two target embedding vectors and the probability that the two target commodities are purchased at the same time, and the target information represents the probability that the two target commodities are purchased at the same time.
2. The method according to claim 1, wherein: The target coding model is obtained through the following training steps: Constructing an initial classification model and a model loss function, wherein the initial classification model includes an initial encoding layer, an initial decoding layer, and an initial deep neural network, and the model loss function includes the penalty factor; Acquire sample historical sales data, where the sample historical sales data includes historical sales data of a preset number of sample commodities; Based on the sample historical sales data, generate a sample adjacency vector for each of the sample commodities; Combine any two sample products into a sample product pair; generating a sample tag for the sample commodity pair, wherein the sample tag indicates whether two sample commodities in the sample commodity pair are purchased at the same time; Inputting the sample adjacency vectors of the two sample commodities in the sample commodity pair into the initial classification model, taking the sample labels of the sample commodity pair as expected outputs, training the initial classification model, and obtaining a trained classification model; The trained coding layer is extracted from the trained classification model to obtain the target coding model.
3. The method according to claim 1, wherein: Input the target embedding vectors of the two target commodities into the pre-trained target information generation model to obtain target information, including: Decoding the target embedding vector and inputting it into a pre-trained decoding layer to obtain a decoded target embedding vector; Connecting the decoded target embedding vectors of the two target products to obtain a connected decoded target embedding vector; The connected target embedding vector is input into a pre-trained fully connected layer to obtain the target information.
4. The method according to claim 1, wherein: Before inputting the target adjacency vector into a pre-trained target encoding model, the method further includes: In response to determining that the arrangement orders of the other commodities pointed to by the values in the two target adjacency vectors are different, the arrangement orders of the other commodities pointed to by the values in the two target adjacency vectors are adjusted to be the same.
5. The method according to claim 1, wherein: The target adjacency vector is generated based on the following method: Acquire target historical sales data, where the target historical sales data includes historical sales data of the two target commodities and historical sales data of at least one non-target commodity; Extracting the number of times the target product and other products are purchased simultaneously from the target historical sales data; The target adjacency vector is obtained by arranging the number of times the target product and other products are purchased at the same time according to a preset arrangement order.
6. A device for generating information, wherein: include: A receiving unit is configured to receive target adjacency vectors corresponding to two target products, wherein the target adjacency vectors represent the number of times the target product and other products are purchased simultaneously in the user order records within a preset time period; an encoding unit configured to input the target adjacency vector into a pre-trained target encoding model to obtain a target embedding vector of the target product, wherein a loss function of the target encoding model includes a preset penalty factor, and the penalty factor represents a probability that two products are purchased at the same time; The generating unit is configured to input the target embedding vectors of the two target commodities into a pre-trained target information generating model to obtain target information, wherein the target information generating model represents the corresponding relationship between the similarity of the two target embedding vectors and the probability that the two target commodities are purchased at the same time, and the target information represents the probability that the two target commodities are purchased at the same time.
7. The device according to claim 6, wherein: The device also includes a model training unit configured to: Constructing an initial classification model and a model loss function, wherein the initial classification model includes an initial encoding layer, an initial decoding layer, and an initial deep neural network, and the model loss function includes the penalty factor; Acquire sample historical sales data, where the sample historical sales data includes historical sales data of a preset number of sample commodities; Based on the sample historical sales data, generate a sample adjacency vector for each of the sample commodities; Combine any two sample products into a sample product pair; generating a sample tag for the sample commodity pair, wherein the sample tag indicates whether two sample commodities in the sample commodity pair are purchased at the same time; Inputting the sample adjacency vectors of the two sample commodities in the sample commodity pair into the initial classification model, taking the sample labels of the sample commodity pair as expected outputs, training the initial classification model, and obtaining a trained classification model; The trained coding layer is extracted from the trained classification model to obtain the target coding model.
8. The device according to claim 6, wherein: The generating unit further comprises: A decoding module is configured to decode the target embedding vector and input it into a pre-trained decoding layer to obtain a decoded target embedding vector; a connection module configured to connect the decoded target embedding vectors of the two target products to obtain a connected decoded target embedding vector; The output module is configured to input the connected target embedding vector into a pre-trained fully connected layer to obtain the target information.
9. The device according to claim 6, further comprising an adjustment unit configured to: In response to determining that the arrangement orders of the other commodities represented by the values in the two target adjacency vectors are different, the arrangement orders of the other commodities represented by the values in the two target adjacency vectors are adjusted to be the same.
10. The apparatus according to claim 6, further comprising a vector generation unit configured to: Extracting the number of times the target product and other products are purchased simultaneously from the target historical sales data; The target adjacency vector is obtained by arranging the number of times the target product and other products are purchased at the same time according to a preset arrangement order.
11. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
12. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method and device for recommending commodity combination, electronic equipment and readable storage medium
CN110060090A
Product recommendation method, device and equipment and storage medium
CN110298718A