CN114861057B - Resource sending method, training of recommendation model and device - Google Patents

Resource sending method, training of recommendation model and device Download PDF

Info

Publication number
CN114861057B
CN114861057B CN202210536097.2A CN202210536097A CN114861057B CN 114861057 B CN114861057 B CN 114861057B CN 202210536097 A CN202210536097 A CN 202210536097A CN 114861057 B CN114861057 B CN 114861057B
Authority
CN
China
Prior art keywords
index path
determining
combinations
elements
search word
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210536097.2A
Other languages
Chinese (zh)
Other versions
CN114861057A (en
Inventor
张文慧
吴志华
于佃海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210536097.2A priority Critical patent/CN114861057B/en
Publication of CN114861057A publication Critical patent/CN114861057A/en
Application granted granted Critical
Publication of CN114861057B publication Critical patent/CN114861057B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a resource sending method and a training and device of a recommendation model, relates to the technical field of computers, in particular to the field of artificial intelligence such as deep learning, and can be applied to the field of searching, and the specific implementation scheme is as follows: obtaining a search request sent by a client, wherein the search request comprises a search word; inputting the search word into a recommendation model to determine a target index path corresponding to the search word, wherein the target index path is generated according to a plurality of elements in a preset matrix; determining a target resource identifier corresponding to the target index path; and sending the resource corresponding to the target resource identifier to the client. According to the method, the index path corresponding to the search word is predicted by using the recommendation model, and the resources indexed by the index path are sent to the client, so that the resource searching efficiency and the resource recommendation accuracy are improved.

Description

Resource sending method, training of recommendation model and device
Technical Field
The disclosure relates to the technical field of computers, in particular to the field of artificial intelligence such as deep learning, which can be applied to the field of searching, and particularly relates to a resource sending method and a training and device of a recommendation model.
Background
With the development of internet technology, search engines are widely used, users can input search information on the search engines, and correspondingly, a server can search information on the internet to acquire resources matched with the search information and return the resources to a user terminal. And the internet has massive information, so how to improve the accuracy of resource recommendation is a problem to be solved.
Disclosure of Invention
The disclosure provides a resource sending method, training of a recommendation model and a device.
According to an aspect of the present disclosure, there is provided a resource transmission method, including:
obtaining a search request sent by a client, wherein the search request comprises a search word;
inputting the search word into a recommendation model to determine a target index path corresponding to the search word, wherein the target index path is generated according to a plurality of elements in a preset matrix;
determining a target resource identifier corresponding to the target index path;
and sending the resource corresponding to the target resource identifier to the client.
According to another aspect of the present disclosure, there is provided a training method of a recommendation model, including:
obtaining a training sample, wherein the training sample comprises a search word and a resource identifier;
Acquiring a first index path corresponding to the resource identifier, wherein the first index path is generated according to a plurality of elements in a preset matrix;
training the initial recommendation model according to the search word and the first index path to obtain an updated recommendation model;
inputting the search word into the updated recommendation model to determine a second index path corresponding to the resource identifier from a preset matrix;
updating the first index path corresponding to the resource identifier into a second index path, and further updating the model parameters according to the second index path to obtain a recommendation model.
According to another aspect of the present disclosure, there is provided a resource transmitting apparatus including:
the first acquisition module is used for acquiring a search request sent by the client, wherein the search request comprises search words;
the first determining module is used for inputting the search word into the recommendation model to determine a target index path corresponding to the search word, wherein the target index path is generated according to a plurality of elements in a preset matrix;
the second determining module is used for determining a target resource identifier corresponding to the target index path;
and the sending module is used for sending the resource corresponding to the target resource identifier to the client.
According to another aspect of the present disclosure, there is provided a training apparatus of a recommendation model, including:
the first acquisition module is used for acquiring a training sample, wherein the training sample comprises a search word and a resource identifier;
the second acquisition module is used for acquiring a first index path corresponding to the resource identifier, wherein the first index path is generated according to a plurality of elements in a preset matrix;
the training module is used for training the initial recommendation model according to the search word and the first index path so as to obtain an updated recommendation model;
the determining module is used for inputting the search word into the updated recommendation model so as to determine a second index path corresponding to the resource identifier from the preset matrix;
and the updating module is used for updating the first index path corresponding to the resource identifier into a second index path so as to further update the model parameters according to the second index path to obtain a recommendation model.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the above embodiments.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method according to the above-described embodiments.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described in the above embodiments.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flow chart of a resource sending method according to an embodiment of the disclosure;
FIG. 2 is a schematic diagram of an index path provided by the present disclosure;
fig. 3 is a flowchart of a resource transmission method according to another embodiment of the present disclosure;
fig. 4 is a flowchart of a resource transmission method according to another embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a training method of a recommendation model according to an embodiment of the disclosure;
FIG. 6 is a flowchart illustrating a training method of a recommendation model according to an embodiment of the disclosure;
FIG. 7 is a schematic diagram of training and application of a recommendation model provided by an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a resource transmitting device according to an embodiment of the present disclosure;
FIG. 9 is a schematic structural diagram of a training device for a recommendation model according to an embodiment of the disclosure;
fig. 10 is a block diagram of an electronic device used to implement a resource transmission method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The resource transmission method, the training method of the recommendation model, the device, the electronic equipment and the storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
Artificial intelligence is the discipline of studying certain mental processes and intelligent behaviors (e.g., learning, reasoning, thinking, planning, etc.) of a person using a computer, both in the technical field of hardware and in the technical field of software. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology comprises a computer vision technology, a voice recognition technology natural language processing technology, deep learning technology, big data processing technology, knowledge graph technology and the like.
Deep learning is a new research direction in the field of machine learning. Deep learning is the inherent regularity and presentation hierarchy of learning sample data, and the information obtained during such learning is helpful in interpreting data such as text, images and sounds. Its final goal is to have the machine have analytical learning capabilities like a person, and to recognize text, image, and sound data.
Fig. 1 is a flowchart of a resource transmission method according to an embodiment of the disclosure.
The resource sending method of the embodiment of the disclosure can be executed by the resource sending device of the embodiment of the disclosure, and the device can be configured in the electronic equipment, and by utilizing a recommendation model, a target index path corresponding to the search word is determined from a preset matrix, and the resource sent to the client is determined based on the target index path, so that the search result is determined based on the matrix index path, and the resource searching efficiency and the accuracy of resource recommendation are improved.
The electronic device may be any device with computing capability, for example, may be a personal computer, a mobile terminal, a server, etc., and the mobile terminal may be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, etc., which have various operating systems, touch screens, and/or display screens.
As shown in fig. 1, the resource transmission method includes:
step 101, obtaining a search request sent by a client, wherein the search request comprises a search word.
In the disclosure, a user may input a search word in a search engine of a client, so that the client may generate a search request and send the search request to a server, and the server may obtain the search request sent by the client, where the search request may include the search word, client information, and the like.
Step 102, inputting the search word into the recommendation model to determine a target index path corresponding to the search word.
In the present disclosure, the recommended model may be obtained through distributed training or through stand-alone training.
In the present disclosure, the target index path may be generated according to a plurality of elements in a preset matrix, where each element in the preset matrix may be used to represent different resource attributes, that is, represent different attributes of a resource. For example, the elements in the preset matrix may be used to represent various properties of the commodity such as "sweet", "bitter", "spicy", "white", "red", etc.
In the disclosure, a search word may be input into a recommendation model obtained by training in advance, the recommendation model may select one or more elements from each column of elements of a preset matrix, and a target index path corresponding to the search word is obtained based on a position of the selected element in the preset matrix, that is, an attribute related to the search word is determined. Therefore, by inputting the search word into the recommendation model, the target index path corresponding to the search word can be determined from the preset matrix by using the recommendation model.
Wherein the number of elements selected from each column of the preset matrix is the same, for example, one element is selected from each column, one index path can be obtained, and 3 elements are selected from each column, so that 3 index paths can be obtained.
It should be noted that, in the present disclosure, the target index path may be one or multiple, and may be set according to actual needs.
The positions of the elements in the preset matrix may be relative positions or absolute positions. For example, the relative positions of elements may be represented by the rows and columns in which the elements are located. For another example, the elements may be numbered according to a certain order according to the number of elements in the preset matrix, and the relative positions of the elements may be represented by the numbers.
Taking the matrix of 3*3 shown in fig. 2 as an example, two index paths are shown in fig. 2, with elements on one index path being a1-b2-c1, the index paths can be expressed as ((1, 1), (2, 2), (1, 3)) according to the position of 3 elements in the matrix; the elements on the other index path are a2-b1-c2, which can be denoted ((2, 1), (1, 2), (2, 3)) depending on the position of the 3 elements in the matrix.
Step 103, determining a target resource identifier corresponding to the target index path.
In the present disclosure, a resource identifier corresponding to a target index path may be determined according to a mapping relationship between a preset index path and a resource identifier, and for convenience of description, the resource identifier corresponding to the target index path may be referred to as a target resource identifier in the present disclosure.
Since different resources may have the same attributes, in this disclosure, an index path may index to a resource or resources. For example, for an index path of cake attributes, different commodities such as strawberry cake, chocolate cake, etc. can be indexed.
And 104, sending the resource corresponding to the target resource identifier to the client.
In the present disclosure, after determining the target resource identifier corresponding to the target index path, the resource corresponding to the target resource identifier may be sent to the client. Wherein the resource may be a web page, merchandise, video, etc.
For example, a user inputs a search word in a browser search engine, determines a target index path corresponding to the search word through a recommendation model, and determines a target URL (Uniform Resource Locator ) indexed by the target index path, so that a web page corresponding to the target URL can be pushed to the browser.
In the embodiment of the disclosure, a search request sent by a client is obtained, wherein the search request comprises a search word; inputting the search word into a recommendation model to determine a target index path corresponding to the search word; determining a target resource identifier corresponding to the target index path; and sending the resource corresponding to the target resource identifier to the client. Therefore, by utilizing the recommendation model, the index path corresponding to the search word is predicted, and the resources indexed by the index path are sent to the client, so that the resource searching efficiency and the resource recommendation accuracy are improved.
Fig. 3 is a flowchart illustrating a resource transmission method according to another embodiment of the present disclosure.
As shown in fig. 3, the resource transmission method includes:
step 301, obtaining a search request sent by a client, wherein the search request comprises a search word.
Step 302, inputting the search word into a recommendation model to determine a target index path corresponding to the search word from a preset matrix.
In the present disclosure, steps 301 to 302 are similar to the descriptions of the related contents in the above embodiments, and thus are not repeated here.
In the disclosure, if the recommendation model is obtained based on distributed training, then model parameters are stored in a distributed parameter server, and before determining a target index path corresponding to a search word by using the recommendation model, the model parameters may be acquired from the distributed parameter server, and the recommendation model is constructed based on the model parameters. Therefore, the recommendation model obtained by distributed training is utilized for recommending resources, and the resource searching efficiency can be improved.
Step 303, obtaining index paths corresponding to the resource identifiers.
In the present disclosure, the index path corresponding to each resource identifier may be preset or may be obtained from another device.
For example, the recommendation model is obtained by adopting distributed training, and the index paths corresponding to the resource identifiers are stored in the distributed parameter server, so that the index paths corresponding to the resource identifiers can be obtained from the distributed parameter server. Therefore, in the distributed scene, a new architecture is not required to store the index path of the resource identifier, and resources can be saved.
In the present disclosure, each resource identifier may correspond to one index path, or may correspond to multiple index paths. For example, a chocolate cake may be indexed by two indexing paths, the chocolate and the cake.
Step 304, determining the resource identifier corresponding to each index path according to the index path corresponding to each resource identifier.
In the present disclosure, reverse mapping may be performed on the index paths corresponding to each resource identifier, to obtain the resource identifiers corresponding to each index path, that is, to obtain the mapping relationship between the index paths and the resource identifiers.
In the present disclosure, one resource identifier may correspond to a plurality of index paths, that is, one resource may be indexed by a plurality of index paths, and one index path may also correspond to a plurality of resource identifiers, that is, may be indexed to a plurality of resources according to one index path.
Step 305, determining a target resource identifier corresponding to the target index path by querying the resource identifiers corresponding to the index paths according to the target index path.
After determining the resource identifiers corresponding to the index paths, the resource identifiers corresponding to the index paths can be queried according to the target index paths, and the target resource identifiers corresponding to the target index paths can be determined.
It can be understood that, if there are multiple target index paths, for each target index path, the resource identifier corresponding to each index path can be obtained by querying the resource identifiers corresponding to each index path, and then the resource identifiers corresponding to the target index paths are combined, so that the final target resource identifier can be obtained.
For example, m target index paths are provided, wherein m is a positive integer, and the m target index paths are converted into n resource identifiers by querying the resource identifiers corresponding to each target index path, wherein n is a positive integer, and n and m can be the same or different.
And step 306, sending the resource corresponding to the target resource identifier to the client.
In this disclosure, step 306 is similar to that described in the above embodiments, and thus will not be described herein.
In the embodiment of the disclosure, when determining the target resource identifier corresponding to the target index path, the index path corresponding to each resource identifier may be obtained; determining the resource identifiers corresponding to the index paths according to the index paths corresponding to the resource identifiers; and according to the target index paths, determining target resource identifiers corresponding to the target index paths by inquiring the resource identifiers corresponding to the index paths. Therefore, the resource identification corresponding to the target index path can be effectively determined according to the index path corresponding to each resource identification.
Fig. 4 is a flowchart of a resource transmission method according to another embodiment of the present disclosure.
As shown in fig. 4, the resource transmission method includes:
step 401, obtaining a search request sent by a client, wherein the search request comprises a search word.
In the present disclosure, step 401 is similar to that described in the above embodiments, and thus will not be described herein.
Step 402, determining the probability of each element in M elements in the first column of the preset matrix as a node on an index path corresponding to the search word according to the search word, and determining k elements with highest probability from the M elements in the first column.
Assuming that the size of the preset matrix is m×n, the number of target index paths is k, k is smaller than M, and both M, N and k are positive integers.
In the disclosure, a search word may be mapped to obtain a word vector corresponding to the search word, a recommendation model may determine, based on the word vector corresponding to the search word, a probability of each element in M elements in a first column of a preset matrix as a node on an index path corresponding to the search word, and determine k elements with highest probability from the M elements.
Step 403, determining, according to the search word and the k elements, a probability that each combination of the k elements and k×m combinations of M elements in a second column of the preset matrix is used as a node on an index path corresponding to the search word, and determining k combinations with highest probability from the k×m combinations.
After determining k elements from the M elements in the first column, a probability that each element in the second column of the preset matrix is used as a node on the index path corresponding to the search word may be determined based on each element in the k elements and the search word, that is, a probability that each combination of each element and M combinations of the M elements in the second column is used as a node on the index path corresponding to the search word is determined. Then, the probabilities of M combinations corresponding to the k elements are compared, and k combinations with the highest probability are determined from the k×m combinations. Thus, based on the elements and search terms selected in the first column, the nodes on the index path are selected from the second column, and accuracy is improved.
For example, k=2, m=3, and n=2, and 2 elements a1 and a2 with highest probability are selected from the first column, and 3 elements of the second column are b1, b2, and b3. For element a1, element a1 and the search term may be used as inputs to determine the probabilities of elements b1, b2, and b3 in the second column as nodes on the index path as 0.7, 0.1, 0.2, respectively. Likewise, using element a2 and the search term as inputs, the probabilities of elements b1, b2, and b3 in the second column being nodes on the index path are determined to be 0.2, 0.6, 0.2, respectively. Then the probability 0.8 corresponding to the combination a1-b1 of the 6 probabilities, the probability 0.6 corresponding to the combination a2-b2 is highest, i.e. the highest probability combination is determined to be a1-b1, a2-b2 from the total 6 combinations of a1 and a2 with 3 elements in the second column.
Step 404, starting from the third column of the preset matrix, determining, according to the search word and the k combinations determined in the previous column, the probability that each combination of the k combinations corresponding to the previous column and the k×m combinations of the M elements in the current column is used as a node on the index path corresponding to the search word, and determining the k combinations with the highest probability from the k×m combinations.
In the present disclosure, starting from the third column of the preset matrix, the probability that each element in the M elements in the current column is taken as a node on the index path may be determined based on each combination of the k combinations determined in the previous column and the search word, that is, the probability that each combination in the M combinations determined in the previous column and the M elements in the current column is taken as a node on the index path corresponding to the search word is determined, then the probabilities of the M combinations corresponding to the k combinations are compared, and k combinations with the highest probability are determined from the k×m combinations.
Thus, k combinations with highest probability can be determined in the third column, then k combinations with highest probability can be determined in the fourth column based on k combinations determined in the third column and the search word, and k combinations with highest probability can be determined in the nth column based on k combinations with highest probability determined in the nth-1 column and the search word.
Step 405, determining k number of target index paths corresponding to the search term according to the position of each element in the k combinations determined in the nth column in the preset matrix.
In this disclosure, the index path may be represented by the position of an element in the matrix.
In the present disclosure, after k combinations with highest probability are determined from k combinations and k×m combinations of elements in the N-1 th column based on k combinations determined in the N-1 th column and the search word, k number of target index paths corresponding to the search word may be determined according to positions of elements in each combination in the k combinations determined in the N-1 th column in a preset matrix.
In the implementation, for each combination, the elements may be sequentially spliced to obtain the index path according to the order of the columns of the elements in the matrix from small to large in the combination.
Based on the example in step 403, k=2, m=3, n=2, the k combinations determined finally are a1-b1, a2-b2, assuming the positions of the elements a1, a2, b1, b2 in the matrix of 3*2 are (1, 1), (2, 1), (1, 2), (2, 2), then the two index paths corresponding to the search terms are ((1, 1), (1, 2)), ((2, 1), (2, 2)).
Step 406, determining target resource identifiers corresponding to the k number of target index paths.
In the present disclosure, if k is greater than 1, determining a target resource identifier corresponding to each target index path. The determination method is similar to that described in the above embodiments, and thus will not be described here again.
Step 407, sending the resource corresponding to the target resource identifier to the client.
In this disclosure, step 407 is similar to the description of the above embodiments, and thus will not be repeated here.
In the embodiment of the disclosure, when the search word is input into the recommendation model to determine the target index path corresponding to the search word from the preset matrix, the elements with the number smaller than the number of rows of the matrix can be determined in sequence from each column of the preset matrix to determine the target index path corresponding to the search word, so that the search space of the index path can be reduced, and the calculation efficiency is improved.
Fig. 5 is a flowchart illustrating a training method of a recommendation model according to an embodiment of the disclosure.
As shown in fig. 5, the training method of the recommendation model includes:
step 501, a training sample is obtained, wherein the training sample comprises a search word and a resource identifier.
In the present disclosure, a plurality of training samples may be obtained, each of which may include a search term and a resource identifier. The resource corresponding to the resource identifier may be a resource clicked or browsed by the user when searching by using the search word.
It is understood that the resource identifications corresponding to different search terms may be the same.
Step 502, a first index path corresponding to the resource identifier is obtained, wherein the first index path is generated according to a plurality of elements in a preset matrix.
In the present disclosure, a first index path corresponding to a resource identifier may be obtained, so as to convert the resource identifier in the training sample into an index path. The first index path corresponding to the resource identifier may be obtained locally or may be obtained from other devices, where the first index path is generated according to a plurality of elements in a preset matrix, and each element in the preset matrix represents a different resource attribute, and for a specific explanation, reference may be made to the above embodiment.
In the present disclosure, the first index path may be one or more. For example, there are 3 index paths corresponding to the resource identifiers in a training sample, so that the model can be trained by using the search word and each index path as one training data.
Step 503, training the initial recommendation model according to the search word and the first index path to obtain an updated recommendation model.
In the disclosure, the initial recommendation model may be trained according to the search term and the first index path to obtain gradient information, and parameters of the initial model are updated according to the gradient information to obtain an updated model. Therefore, the model parameters can be effectively updated, and an updated model is obtained.
When determining the gradient information, as a possible implementation manner, the search word may be input into an initial recommendation model, the initial recommendation model may determine a probability of selecting a corresponding node on the first index path from each column of the preset matrix, multiply the probabilities of selecting the nodes from the preset matrix to obtain a probability of outputting the first index path by the initial recommendation model, and then determine the gradient information based on a difference between the first index probability and the target probability. Therefore, the target probability is used as a target of the probability of the initial recommendation model output first index path, gradient information can be effectively determined, and model parameters can be updated.
For example, a matrix of 4*3 is preset, the target probability is 1, each element in the matrix may be numbered from left to right and from top to bottom with 0 to 11, if the first index path is 3-4-2, a search word is input to the initial recommendation model, the initial recommendation model may determine that the probability of selecting the element of number 3 from the first column is p1, the probability of selecting the element of number 4 from the second column is p2 based on the search word and the element of number 3, the probability of selecting the element of number 2 from the third column is p3 based on the search word and the elements of number 3 and 4, the probability of outputting the first index path using p1×p2×p3 as the initial recommendation model, and gradient information is determined based on the difference between the obtained probability of the first index path and 1.
In the present disclosure, the target probability may be 1, 0.95, or other values, which are not limited in this disclosure.
As another possible implementation manner, the search word may be input into the initial recommendation model, a prediction index path output by the initial recommendation model may be obtained, a loss value may be determined based on a difference between the prediction index path and the first index path, and gradient information may be determined based on the loss value. Therefore, gradient information can be effectively calculated, and model parameters can be updated.
Step 504, the search word is input into the updated recommendation model, so as to determine a second index path corresponding to the resource identifier from the preset matrix.
In this disclosure, the method of determining the second index path is similar to the method of determining the target index path in the above-described embodiment.
In the present disclosure, the search term may be input into an updated recommendation model, and the updated recommendation model may select one or more elements from each column of elements of the preset matrix, and obtain the second index path based on the position of the selected element in the preset matrix. Thus, the index path corresponding to the resource identifier can be redetermined by using the updated recommendation model.
The second index path may be one or more.
In implementation, the number of elements selected from each column of the preset matrix is the same, for example, one element is selected from each column, so that an index path can be obtained, and 3 elements are selected from each column, so that 3 index paths can be obtained.
The number of first index paths may be the same as the number of second index paths in the present disclosure.
Step 505, updating the first index path corresponding to the resource identifier to a second index path, so as to further update the model parameters according to the second index path, so as to obtain a recommendation model.
After determining the second index path corresponding to the resource identifier, the first index path corresponding to the resource identifier may be updated to the second index path.
In practical application, in a plurality of training samples, the same resource identifier may correspond to a plurality of search words, the training samples may be utilized one by one to update model parameters and index paths corresponding to the resource identifier, or an index path corresponding to the resource identifier may be determined according to each search word, and a preset number of index paths with highest probability are selected from index paths obtained based on three search words as second index paths corresponding to the resource identifier, and the second index paths are utilized to update the first index paths.
In the present disclosure, if the training sample for training includes the resource identifier, a second index path corresponding to the resource identifier may be obtained, and based on the search word and the second index path, the model parameters may be further updated, and if the training ending condition is satisfied, the recommendation model may be obtained. If the training ending condition is not met, determining an index path corresponding to the resource identifier according to the current recommended model and the search word, and updating a second index path corresponding to the resource identifier to the index path so as to further update model parameters according to the index path until the training ending condition is met, thereby obtaining the recommended model. The recommendation model may be used to predict an index path corresponding to a search term.
In the embodiment of the disclosure, the model parameters can be updated based on the search terms and the index paths corresponding to the resource identifiers, the index paths corresponding to the resource identifiers are predicted based on the updated recommendation model, and the original index paths of the resource identifiers are updated by utilizing the latest index paths, so that in the model training process, not only the model parameters but also the index paths corresponding to the resource identifiers are updated, and at the end of the model training, not only the recommendation model for predicting the index paths but also the index paths corresponding to the resource identifiers finally can be obtained, thereby predicting the index paths corresponding to the resource identifiers by utilizing the recommendation model, and carrying out resource recommendation based on the predicted index paths, so that the resource searching efficiency and the resource recommendation accuracy can be improved.
Fig. 6 is a flowchart illustrating a training method of a recommendation model according to an embodiment of the disclosure.
As shown in fig. 6, the training method of the recommendation model includes:
step 601, obtaining a training sample, wherein the training sample comprises a search word and a resource identifier.
Due to explosive growth of data, requirements for data capacity and performance, model training may be performed in a distributed manner in the present disclosure.
In the present disclosure, a distributed working node may obtain a plurality of training samples, where the training samples may include search terms and resource identifiers.
Step 602, a first index path corresponding to a resource identifier is obtained from a distributed parameter server.
In the disclosure, the distributed parameter server may store index paths corresponding to the resource identifiers, and the distributed working node may send a data request to the distributed parameter server to obtain a first index path corresponding to the resource identifier from the distributed parameter server, so as to convert the resource identifier in the training sample into the index path.
And 603, training the initial recommendation model according to the search word and the first index path to update parameters of the initial recommendation model in the distributed parameter server and obtain an updated recommendation model.
In the disclosure, the distributed working node may train the initial recommendation model according to the search word and the first index path to obtain gradient information, and send the gradient information to the distributed parameter server, where the distributed parameter server updates parameters of the initial recommendation model according to the gradient information to obtain an updated recommendation model.
In the present disclosure, the method for determining gradient information is similar to the method described in the above embodiments, and thus will not be described here again.
Step 604, inputting the search term into the updated recommendation model to determine a second index path corresponding to the resource identifier from the preset matrix.
In the disclosure, the distributed working node may input the search word into the updated recommendation model, and the updated recommendation model determines a second index path corresponding to the resource identifier from the preset matrix.
Assuming that the size of the preset matrix is m×n, the number of the second index paths is t, t is smaller than M, and both M, N and t are positive integers.
In the disclosure, a search word may be mapped to obtain a word vector corresponding to the search word, a recommendation model may determine, based on the word vector corresponding to the search word, a probability of each element in M elements in a first column of a preset matrix as a node on an index path of the search word, and determine t elements with highest probability from the M elements.
After t elements are determined from the M elements in the first column, a probability that each element in the second column of the preset matrix is used as a node on the index path can be determined based on each element in the t elements and the search word, that is, a probability that each combination of each element and M combinations of the M elements in the second column is used as a node on the index path corresponding to the resource identifier is determined. And then, comparing the probabilities of M combinations corresponding to the t elements respectively, and determining t combinations with highest probabilities from the t combinations.
In the disclosure, starting from the third column of the preset matrix, the probability that each element in the M elements in the current column is taken as a node on the index path corresponding to the resource identifier may be determined based on each combination of the search term and the t combinations determined in the previous column, that is, the probability that each combination in the M combinations of the M elements in the current column is taken as a node on the index path corresponding to the resource identifier is determined, then the probabilities of the M combinations corresponding to the t combinations are compared, and t combinations with the highest probability are determined from the t×m combinations.
After k combinations with highest probability are determined from t combinations and t×m combinations of elements in the N-1 th column based on t combinations and search words determined in the N-1 th column, t number of second index paths corresponding to the search words may be determined according to positions of elements in a preset matrix in each of the t combinations determined in the N-1 th column.
In the present disclosure, t may be the same as or different from k in the above embodiment, and may be set according to actual needs.
In the method, the target index path corresponding to the search word is determined by sequentially determining the elements with the number smaller than the number of rows of the matrix from each column of the preset matrix, so that the search space of the index path can be reduced, and the calculation efficiency is improved.
Step 605, updating the first index path corresponding to the resource identifier in the distributed parameter server to a second index path, so as to further update the model parameters according to the second index path, so as to obtain a recommendation model.
After determining the second index path corresponding to the resource identifier, the distributed working node may send the second index path to the distributed parameter server, and the distributed parameter server updates the first index path corresponding to the resource identifier to the second index path, so that the first index path corresponding to the resource identifier in the distributed parameter server may be updated to the second index path, so that the model parameters may be further updated according to the second index path to obtain the recommendation model, and the specific process is similar to that described in the above embodiment, so that details are not repeated here.
In the present disclosure, model parameters and index paths corresponding to each resource identifier may be stored in a distributed parameter server, when performing distributed training, model training may be performed according to a search word and a first index path corresponding to a resource identifier, model parameters in the distributed parameter server may be updated, a second index path corresponding to a resource identifier may be determined by using the model, and the first index path corresponding to the resource identifier in the distributed parameter server may be updated to the second index path, so as to implement updating of the index paths, thereby obtaining a recommendation model and an index path corresponding to each resource identifier finally when model training is completed.
In the embodiment of the disclosure, a training sample is obtained, wherein the training sample comprises a search word and a resource identifier; acquiring a first index path corresponding to a resource identifier from a distributed parameter server; training the initial recommendation model according to the search word and the first index path to update parameters of the initial recommendation model in the distributed parameter server and obtain an updated recommendation model; inputting the search word into the updated recommendation model to determine a second index path corresponding to the resource identifier from a preset matrix; updating the first index path corresponding to the resource identifier in the distributed parameter server to a second index path so as to further update the model parameters according to the second index path to obtain a recommendation model. In addition, the index structure and the parameter server mode are effectively combined, namely, the original parameter representation of the resource is combined with the matrix index structure to form a new format storage, so that the new architecture storage and the processing of the index path are not required to be set, and the resource is saved.
To facilitate understanding of the above embodiments, a distributed training will be described below with reference to fig. 7, where fig. 7 is a schematic diagram of training and application of a recommendation model according to an embodiment of the disclosure.
As shown in fig. 7, assuming that the matrix is a matrix of k×3, d=1, d=2, and d=3 represent the first column, the second column, and the third column of the matrix, respectively, and 1,2, …, and K represent the positions of the elements in each column, where K is an integer greater than 1.
During training, the working node acquires a training sample, wherein the training sample comprises a search word and a resource identifier, and then a first index path corresponding to the resource identifier of the parameter server can be used for converting the resource identifier in the training sample into an index path, wherein the index path is determined from a K3 matrix.
The parameter server stores a parameter table of the neural network, the working node can acquire parameters of the neural network from the parameter server, train the neural network by utilizing the search word and the index path to obtain gradient information, send the gradient information to the parameter server, and update the parameters of the neural network according to the gradient information.
Then, the working node may obtain the current parameters of the neural network from the parameter server, determine J index paths with the highest probability corresponding to the resource identifier based on the current parameters of the neural network and the search word, and then send the J index paths to the parameter server, where the method for determining the J index paths may be referred to the foregoing embodiments and will not be described herein. Repeating the updating process of the neural network parameters and the index path until the model training ending condition is met, and obtaining the recommended model.
When the search request is obtained, the search word in the search request may be input into the recommendation model obtained through training, so as to determine K index paths corresponding to the search word from the matrix with K being 3, where the determining process of the K index paths may refer to the above embodiment and will not be described herein.
Because the mapping relation from the resource identifier to the index path, namely the resource identifier- > index path is stored on the parameter server, the mapping relation from the index path to the resource identifier, namely the index path- > resource identifier, can be obtained based on the mapping relation. Therefore, by utilizing the mapping relation between the index paths and the resource identifiers, the index can be converted to the resource identifiers according to each index path in the k index paths, so that the k index paths can be converted into f resource identifiers, and the resources corresponding to the f resource identifiers can be sent to the client.
In order to achieve the above embodiments, the embodiments of the present disclosure further provide a resource sending device. Fig. 8 is a schematic structural diagram of a resource transmitting device according to an embodiment of the present disclosure.
As shown in fig. 8, the resource transmitting apparatus 800 includes:
a first obtaining module 810, configured to obtain a search request sent by a client, where the search request includes a search term;
A first determining module 820, configured to input a search word into the recommendation model to determine a target index path corresponding to the search word, where the target index path is generated according to a plurality of elements in a preset matrix;
a second determining module 830, configured to determine a target resource identifier corresponding to the target index path;
and the sending module 840 is configured to send the resource corresponding to the target resource identifier to the client.
In one possible implementation of the embodiment of the disclosure, the second determining module 830 includes:
the acquisition unit is used for acquiring index paths corresponding to the resource identifiers;
the first determining unit is used for determining the resource identifier corresponding to each index path according to the index path corresponding to each resource identifier;
and the second determining unit is used for determining the target resource identifier corresponding to the target index path by inquiring the resource identifier corresponding to each index path according to the target index path.
In one possible implementation manner of the embodiment of the present disclosure, the obtaining unit is configured to:
and obtaining index paths corresponding to the resource identifiers from the distributed parameter server.
In one possible implementation manner of the embodiment of the present disclosure, the preset matrix is m×n, the number of target index paths is k, k is smaller than M, and both M, N and k are positive integers, and the first determining module 820 is configured to:
According to the search word, determining the probability of each element in M elements in the first column of the preset matrix as a node on an index path corresponding to the search word, and determining k elements with highest probability from the M elements in the first column;
according to the search word and k elements, determining the probability that each combination of k elements and k x M combinations of M elements in a second column of a preset matrix is used as a node on an index path corresponding to the search word, and determining k combinations with highest probability from the k x M combinations;
starting from a third column of a preset matrix, according to the search word and k combinations determined in the last column, determining k combinations corresponding to the last column and the probability that each combination in k x M combinations of M elements in the current column is used as a node on an index path corresponding to the search word, and determining k combinations with highest probability;
and determining k target index paths corresponding to the search word according to the position of each element in the k combinations determined in the N column in a preset matrix.
In one possible implementation manner of the embodiment of the present disclosure, a first determining module 820 is configured to:
according to the search word and each element in the k elements, determining the probability that each combination of the M combinations of each element and the M elements in the second column is used as a node on an index path corresponding to the search word;
And determining k combinations with highest probability from the k x M combinations according to the probabilities of the M combinations corresponding to the k elements respectively.
In one possible implementation manner of the embodiment of the disclosure, the apparatus may further include:
the second acquisition module is used for acquiring model parameters from the distributed parameter server;
and the construction module is used for constructing a recommendation model according to the model parameters.
It should be noted that the explanation of the foregoing embodiment of the resource transmission method is also applicable to the resource transmission device of this embodiment, and thus will not be repeated here.
In the embodiment of the disclosure, a search request sent by a client is obtained, wherein the search request comprises a search word; inputting the search word into a recommendation model to determine a target index path corresponding to the search word; determining a target resource identifier corresponding to the target index path; and sending the resource corresponding to the target resource identifier to the client. Therefore, by utilizing the recommendation model, the index path corresponding to the search word is predicted, and the resources indexed by the index path are sent to the client, so that the resource searching efficiency and the resource recommendation accuracy are improved.
In order to achieve the above embodiments, the embodiments of the present disclosure further provide a training device for a recommendation model. Fig. 9 is a schematic structural diagram of a training device of a recommendation model according to an embodiment of the disclosure.
As shown in fig. 9, the training apparatus 900 of the recommendation model includes:
a first obtaining module 910, configured to obtain a training sample, where the training sample includes a search term and a resource identifier;
a second obtaining module 920, configured to obtain a first index path corresponding to the resource identifier, where the first index path is generated according to a plurality of elements in a preset matrix;
training module 930, configured to train the initial recommendation model according to the search term and the first index path, so as to obtain an updated recommendation model;
a determining module 940, configured to input the search term into the updated recommendation model, so as to determine a second index path corresponding to the resource identifier from the preset matrix;
the updating module 950 is configured to update the first index path corresponding to the resource identifier to a second index path, so as to further update the model parameter according to the second index path, so as to obtain the recommendation model.
In one possible implementation manner of the embodiment of the present disclosure, a second obtaining module 920 is configured to obtain a first index path corresponding to a resource identifier from a distributed parameter server;
the updating module 950 is configured to update a first index path corresponding to the resource identifier in the distributed parameter server to a second index path.
In one possible implementation manner of the embodiment of the present disclosure, the size of the preset matrix is m×n, the number of the second index paths is t, t is smaller than M, and both M, N and t are positive integers, and the determining module 940 is configured to:
according to the search word, determining the probability of each element in M elements in a first column of a preset matrix as a node on an index path corresponding to the resource identifier, and determining t elements with highest probability from the M elements in the first column;
according to the search word and t elements, determining the probability that each combination of t elements and t x M combinations of M elements in a second column of a preset matrix is used as a node on an index path corresponding to the resource identifier, and determining t combinations with highest probability from the t x M combinations;
starting from a third column of a preset matrix, according to the search word and t combinations determined in the last column, determining the probability that each combination of t combinations corresponding to the last column and t x M combinations of M elements in the current column is used as a node on an index path corresponding to the resource identifier, and determining t combinations with highest probability from the t x M combinations;
and generating t number of target index paths according to the position of each element in t combinations determined in the N column in a preset matrix.
In one possible implementation manner of the embodiment of the present disclosure, the second obtaining module 920 includes:
the determining unit is used for training the initial recommendation model according to the search word and the first index path so as to obtain gradient information;
and the updating unit is used for updating the parameters of the initial model according to the gradient information so as to acquire an updated model.
In a possible implementation manner of the embodiment of the disclosure, the determining unit is configured to:
inputting the search word into the initial recommendation model to determine the probability that the initial recommendation model outputs the first index path;
gradient information is determined based on a difference between the probability of outputting the first index path and the target probability.
In a possible implementation manner of the embodiment of the disclosure, the determining unit is configured to:
inputting the search word into an initial recommendation model to obtain a prediction index path corresponding to the resource identifier;
gradient information is determined based on a difference between the predicted index path and the first index path.
Note that, the explanation of the foregoing training embodiment of the recommendation model is also applicable to the training device of the recommendation model of this embodiment, and therefore will not be described herein.
In the embodiment of the disclosure, the model parameters can be updated based on the search terms and the index paths corresponding to the resource identifiers, the index paths corresponding to the resource identifiers are predicted based on the updated recommendation model, and the original index paths of the resource identifiers are updated by utilizing the latest index paths, so that in the model training process, not only the model parameters but also the index paths corresponding to the resource identifiers are updated, and at the end of the model training, not only the recommendation model for predicting the index paths but also the index paths corresponding to the resource identifiers finally can be obtained, thereby predicting the index paths corresponding to the resource identifiers by utilizing the recommendation model, and carrying out resource recommendation based on the predicted index paths, so that the resource searching efficiency and the resource recommendation accuracy can be improved.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 10 shows a schematic block diagram of an example electronic device 1000 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 10, the apparatus 1000 includes a computing unit 1001 that can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 1002 or a computer program loaded from a storage unit 1008 into a RAM (Random Access Memory ) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other by a bus 1004. An I/O (Input/Output) interface 1005 is also connected to bus 1004.
Various components in device 1000 are connected to I/O interface 1005, including: an input unit 1006 such as a keyboard, a mouse, and the like; an output unit 1007 such as various types of displays, speakers, and the like; a storage unit 1008 such as a magnetic disk, an optical disk, or the like; and communication unit 1009 such as a network card, modem, wireless communication transceiver, etc. Communication unit 1009 allows device 1000 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks.
The computing unit 1001 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 1001 include, but are not limited to, a CPU (Central Processing Unit ), GPU (Graphic Processing Units, graphics processing unit), various dedicated AI (Artificial Intelligence ) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor ), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the respective methods and processes described above, such as the resource transmission method. For example, in some embodiments, the resource transmission method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 1000 via ROM 1002 and/or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by computing unit 1001, one or more steps of the resource transmission method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform the resource transmission method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit System, FPGA (Field Programmable Gate Array ), ASIC (Application-Specific Integrated Circuit, application-specific integrated circuit), ASSP (Application Specific Standard Product, special-purpose standard product), SOC (System On Chip ), CPLD (Complex Programmable Logic Device, complex programmable logic device), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory, erasable programmable read-Only Memory) or flash Memory, an optical fiber, a CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display ) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network ), WAN (Wide Area Network, wide area network), internet and blockchain networks.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service (Virtual Private Server, virtual special servers) are overcome. The server may also be a server of a distributed system or a server that incorporates a blockchain.
It should be noted that, the training method of the recommendation model in the embodiment of the disclosure may also be implemented by the electronic device illustrated in fig. 10.
According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, which when executed by an instruction processor in the computer program product, performs the resource transmission method or the training method of the recommendation model set forth in the above embodiment of the present disclosure.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (23)

1. A resource transmission method, comprising:
Obtaining a search request sent by a client, wherein the search request comprises a search word;
inputting the search word into a recommendation model to determine a target index path corresponding to the search word, wherein the target index path is generated according to a plurality of elements in a preset matrix and used for representing attributes related to the search word, and each element in the preset matrix is used for representing different resource attributes;
determining a target resource identifier corresponding to the target index path;
transmitting the resource corresponding to the target resource identifier to the client;
the size of the preset matrix is m×n, the number of the target index paths is k, k is smaller than M, and both M, N and k are positive integers, and the step of inputting the search word into the recommendation model to determine the target index path corresponding to the search word includes:
vector mapping is carried out on the search words to obtain word vectors corresponding to the search words;
according to the word vector corresponding to the search word, determining the probability that each element in M elements in a first column of the preset matrix is used as a node on an index path corresponding to the search word, and determining k elements with highest probability from the M elements in the first column;
According to the word vector corresponding to the search word and the k elements, determining the probability that each combination of the k elements and k x M combinations of M elements in a second column of the preset matrix is used as a node on an index path corresponding to the search word, and determining k combinations with highest probability from the k x M combinations;
starting from the third column of the preset matrix, determining the probability that each combination of k combinations corresponding to the previous column and k x M combinations of M elements in the current column is used as a node on an index path corresponding to the search word according to the word vector corresponding to the search word and the k combinations determined in the previous column, and determining k combinations with highest probability from the k x M combinations;
determining k target index paths corresponding to the search word according to the position of each element in the k combinations determined in the N column in the preset matrix;
the probability that each element in M elements in each column of the preset matrix is used as a node on an index path corresponding to a search word is determined by the recommendation model based on a word vector of the search word, and the word vector is obtained by vector mapping of the search word.
2. The method of claim 1, wherein the determining the target resource identifier corresponding to the target index path comprises:
Acquiring index paths corresponding to the resource identifiers;
determining the resource identifiers corresponding to the index paths according to the index paths corresponding to the resource identifiers;
and according to the target index paths, determining target resource identifiers corresponding to the target index paths by inquiring the resource identifiers corresponding to the index paths.
3. The method of claim 2, wherein the obtaining the index path corresponding to each resource identifier comprises:
and acquiring index paths corresponding to the resource identifiers from a distributed parameter server.
4. The method of claim 1, wherein the determining, according to the search term and the k elements, each combination of the k elements and k x M combinations of M elements in the second column as a probability of a node on an index path corresponding to the search term, and determining k combinations with highest probability from the k x M combinations includes:
according to the search word and each element in the k elements, determining the probability that each combination of the M combinations of the M elements in the second column and each element is used as a node on an index path corresponding to the search word;
and determining k combinations with highest probability from k x M combinations according to the probabilities of the M combinations corresponding to the k elements respectively.
5. The method of claim 1, wherein prior to said entering the search term into a recommendation model to determine a target index path to which the search term corresponds, further comprising:
obtaining model parameters from a distributed parameter server;
and constructing the recommendation model according to the model parameters.
6. A training method of a recommendation model, comprising:
acquiring a training sample, wherein the training sample comprises search words and resource identifiers, and the resources corresponding to the resource identifiers are clicked or browsed resources when a user searches by using the search words;
acquiring a first index path corresponding to the resource identifier, wherein the first index path is generated according to a plurality of elements in a preset matrix, and each element in the preset matrix represents different resource attributes;
training an initial recommendation model according to the search word and the first index path to obtain an updated recommendation model;
inputting the search word into the updated recommendation model to determine a second index path corresponding to the resource identifier from the preset matrix;
updating the first index path corresponding to the resource identifier into the second index path to further update model parameters according to the second index path so as to obtain a recommendation model;
The size of the preset matrix is m×n, the number of the second index paths is t, t is smaller than M, and both M, N and t are positive integers, and the step of inputting the search word into the updated recommendation model to determine the second index path corresponding to the resource identifier from the preset matrix includes:
vector mapping is carried out on the search words to obtain word vectors corresponding to the search words;
according to the word vector corresponding to the search word, determining the probability that each element in M elements in a first column of the preset matrix is used as a node on an index path corresponding to the resource identifier, and determining t elements with highest probability from the M elements in the first column;
according to the word vector corresponding to the search word and the t elements, determining the probability that each combination of the t elements and t x M combinations of M elements in a second column of the preset matrix is used as a node on an index path corresponding to the resource identifier, and determining t combinations with highest probability from the t x M combinations;
starting from the third column of the preset matrix, determining the probability of each combination of t combinations corresponding to the last column and t combinations of M elements in the current column as a node on an index path corresponding to the resource identifier according to the word vector corresponding to the search word and the t combinations determined in the last column, and determining t combinations with highest probability from the t combinations;
Generating t number of second index paths according to the position of each element in t combinations determined in the N-th column in the preset matrix.
7. The method of claim 6, wherein the obtaining the first index path corresponding to the resource identifier comprises:
acquiring a first index path corresponding to the resource identifier from a distributed parameter server;
the updating the first index path corresponding to the resource identifier to the second index path includes:
and updating the first index path corresponding to the resource identifier in the distributed parameter server to the second index path.
8. The method of claim 6, wherein the training the initial recommendation model based on the search term and the first index path to obtain an updated recommendation model comprises:
training the initial recommendation model according to the search word and the first index path to obtain gradient information;
and updating parameters of the initial recommended model according to gradient information to obtain the updated model.
9. The method of claim 8, wherein the training the initial recommendation model according to the search term and the first index path to obtain gradient information comprises:
Inputting the search term into the initial recommendation model to determine a probability that the initial recommendation model outputs the first index path;
and determining the gradient information according to the difference value between the probability of the output first index path and the target probability.
10. The method of claim 8, wherein the training the initial recommendation model according to the search term and the first index path to obtain gradient information comprises:
inputting the search word into the initial recommendation model to obtain a prediction index path corresponding to the resource identifier;
and determining the gradient information according to the difference between the prediction index path and the first index path.
11. A resource transmitting apparatus comprising:
the first acquisition module is used for acquiring a search request sent by the client, wherein the search request comprises a search word;
the first determining module is used for inputting the search word into a recommendation model to determine a target index path corresponding to the search word, wherein the target index path is generated according to a plurality of elements in a preset matrix and used for representing attributes related to the search word, and each element in the preset matrix is used for representing different resource attributes;
The second determining module is used for determining a target resource identifier corresponding to the target index path;
a sending module, configured to send, to the client, a resource corresponding to the target resource identifier;
the size of the preset matrix is m×n, the number of the target index paths is k, k is smaller than M, and both M, N and k are positive integers, and the first determining module is configured to:
vector mapping is carried out on the search words to obtain word vectors corresponding to the search words;
according to the word vector corresponding to the search word, determining the probability of taking each element in M elements in a first column of the preset matrix as a node on an index path corresponding to the search word, and determining k elements with highest probability from the M elements in the first column;
according to the word vector corresponding to the search word and the k elements, determining the probability that each combination of the k elements and k x M combinations of M elements in a second column of the preset matrix is used as a node on an index path corresponding to the search word, and determining k combinations with highest probability from the k x M combinations;
starting from the third column of the preset matrix, determining the probability that each combination of k combinations corresponding to the previous column and k x M combinations of M elements in the current column is used as a node on an index path corresponding to the search word according to the word vector corresponding to the search word and the k combinations determined in the previous column, and determining k combinations with highest probability from the k x M combinations;
And determining k target index paths corresponding to the search word according to the positions of each element in the k combinations determined in the N column in the preset matrix.
12. The apparatus of claim 11, wherein the second determination module comprises:
the acquisition unit is used for acquiring index paths corresponding to the resource identifiers;
the first determining unit is used for determining the resource identifier corresponding to each index path according to the index path corresponding to each resource identifier;
and the second determining unit is used for determining the target resource identifier corresponding to the target index path by inquiring the resource identifier corresponding to each index path according to the target index path.
13. The apparatus of claim 12, wherein the acquisition unit is configured to:
and acquiring index paths corresponding to the resource identifiers from a distributed parameter server.
14. The apparatus of claim 11, wherein the first determining module is configured to:
according to the search word and each element in the k elements, determining the probability that each combination of the M combinations of the M elements in the second column and each element is used as a node on an index path corresponding to the search word;
And determining k combinations with highest probability from k x M combinations according to the probabilities of the M combinations corresponding to the k elements respectively.
15. The apparatus of claim 11, further comprising:
the second acquisition module is used for acquiring model parameters from the distributed parameter server;
and the construction module is used for constructing the recommendation model according to the model parameters.
16. A training device of a recommendation model, comprising:
the first acquisition module is used for acquiring a training sample, wherein the training sample comprises a search word and a resource identifier, and the resource corresponding to the resource identifier is clicked or browsed when a user searches by using the search word;
a second obtaining module, configured to obtain a first index path corresponding to the resource identifier, where the first index path is generated according to a plurality of elements in a preset matrix, and each element in the preset matrix represents a different resource attribute;
the training module is used for training the initial recommendation model according to the search word and the first index path so as to obtain an updated recommendation model;
the determining module is used for inputting the search word into the updated recommendation model so as to determine a second index path corresponding to the resource identifier from the preset matrix;
The updating module is used for updating the first index path corresponding to the resource identifier into the second index path so as to further update model parameters according to the second index path to obtain a recommendation model;
the size of the preset matrix is m×n, the number of the second index paths is t, t is smaller than M, and both M, N and t are positive integers, and the determining module is configured to:
vector mapping is carried out on the search words to obtain word vectors corresponding to the search words;
according to the word vector corresponding to the search word, determining the probability that each element in M elements in a first column of the preset matrix is used as a node on an index path corresponding to the resource identifier, and determining t elements with highest probability from the M elements in the first column;
according to the word vector corresponding to the search word and the t elements, determining the probability that each combination of the t elements and t x M combinations of M elements in a second column of the preset matrix is used as a node on an index path corresponding to the resource identifier, and determining t combinations with highest probability from the t x M combinations;
starting from the third column of the preset matrix, determining the probability of each combination of t combinations corresponding to the last column and t combinations of M elements in the current column as a node on an index path corresponding to the resource identifier according to the word vector corresponding to the search word and the t combinations determined in the last column, and determining t combinations with highest probability from the t combinations;
Generating t number of second index paths according to the position of each element in t combinations determined in the N-th column in the preset matrix.
17. The apparatus of claim 16, wherein,
the second acquisition module is used for acquiring a first index path corresponding to the resource identifier from a distributed parameter server;
and the updating module is used for updating the first index path corresponding to the resource identifier in the distributed parameter server into the second index path.
18. The apparatus of claim 16, wherein the second acquisition module comprises:
the determining unit is used for training the initial recommendation model according to the search word and the first index path so as to obtain gradient information;
and the updating unit is used for updating the parameters of the initial recommendation model according to the gradient information so as to acquire the updated model.
19. The apparatus of claim 18, wherein the determining unit is configured to:
inputting the search term into the initial recommendation model to determine a probability that the initial recommendation model outputs the first index path;
and determining the gradient information according to the difference value between the probability of the output first index path and the target probability.
20. The apparatus of claim 18, wherein the determining unit is configured to:
inputting the search word into the initial recommendation model to obtain a prediction index path corresponding to the resource identifier;
and determining the gradient information according to the difference between the prediction index path and the first index path.
21. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5 or to perform the method of any one of claims 6-10.
22. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-5 or to perform the method of any one of claims 6-10.
23. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-5 or implements the steps of the method of any one of claims 6-10.
CN202210536097.2A 2022-05-17 2022-05-17 Resource sending method, training of recommendation model and device Active CN114861057B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210536097.2A CN114861057B (en) 2022-05-17 2022-05-17 Resource sending method, training of recommendation model and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210536097.2A CN114861057B (en) 2022-05-17 2022-05-17 Resource sending method, training of recommendation model and device

Publications (2)

Publication Number Publication Date
CN114861057A CN114861057A (en) 2022-08-05
CN114861057B true CN114861057B (en) 2023-05-30

Family

ID=82637041

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210536097.2A Active CN114861057B (en) 2022-05-17 2022-05-17 Resource sending method, training of recommendation model and device

Country Status (1)

Country Link
CN (1) CN114861057B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2006201110A1 (en) * 2006-02-02 2007-08-16 Queensland University Of Technology Dynamic match lattice spotting for indexing speech content
CN102253936A (en) * 2010-05-18 2011-11-23 阿里巴巴集团控股有限公司 Method for recording access of user to merchandise information, search method and server
WO2015180622A1 (en) * 2014-05-26 2015-12-03 北京奇虎科技有限公司 Method and apparatus for determining categorical attribute of queried word in search
CN110955822A (en) * 2018-09-25 2020-04-03 北京京东尚科信息技术有限公司 Commodity searching method and device
CN112860995A (en) * 2021-02-04 2021-05-28 北京百度网讯科技有限公司 Interaction method, device, client, server and storage medium
CN113468414A (en) * 2021-06-07 2021-10-01 广州华多网络科技有限公司 Commodity searching method and device, computer equipment and storage medium
CN114297338A (en) * 2021-12-02 2022-04-08 腾讯科技(深圳)有限公司 Text matching method, apparatus, storage medium and program product

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11514498B2 (en) * 2019-03-07 2022-11-29 Beijing Jingdong Shangke Information Technology Co., Ltd. System and method for intelligent guided shopping
CN112272188B (en) * 2020-11-02 2022-03-11 重庆邮电大学 Searchable encryption method for protecting data privacy of e-commerce platform
CN113961693A (en) * 2021-09-15 2022-01-21 北京三快在线科技有限公司 Search result recommendation method and device, electronic device and readable storage medium
CN114428907B (en) * 2022-01-27 2024-05-28 北京百度网讯科技有限公司 Information searching method, device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2006201110A1 (en) * 2006-02-02 2007-08-16 Queensland University Of Technology Dynamic match lattice spotting for indexing speech content
CN102253936A (en) * 2010-05-18 2011-11-23 阿里巴巴集团控股有限公司 Method for recording access of user to merchandise information, search method and server
WO2015180622A1 (en) * 2014-05-26 2015-12-03 北京奇虎科技有限公司 Method and apparatus for determining categorical attribute of queried word in search
CN110955822A (en) * 2018-09-25 2020-04-03 北京京东尚科信息技术有限公司 Commodity searching method and device
CN112860995A (en) * 2021-02-04 2021-05-28 北京百度网讯科技有限公司 Interaction method, device, client, server and storage medium
CN113468414A (en) * 2021-06-07 2021-10-01 广州华多网络科技有限公司 Commodity searching method and device, computer equipment and storage medium
CN114297338A (en) * 2021-12-02 2022-04-08 腾讯科技(深圳)有限公司 Text matching method, apparatus, storage medium and program product

Also Published As

Publication number Publication date
CN114861057A (en) 2022-08-05

Similar Documents

Publication Publication Date Title
JP7170082B2 (en) Method and device for generating information, electronic device, storage medium and computer program
KR20200109230A (en) Method and apparatus for generating neural network
JP7395445B2 (en) Methods, devices and electronic devices for human-computer interactive interaction based on search data
CN113590776B (en) Knowledge graph-based text processing method and device, electronic equipment and medium
CN113657100B (en) Entity identification method, entity identification device, electronic equipment and storage medium
KR20210132578A (en) Method, apparatus, device and storage medium for constructing knowledge graph
CN114357105B (en) Pre-training method and model fine-tuning method of geographic pre-training model
CN111241838B (en) Semantic relation processing method, device and equipment for text entity
JP7242994B2 (en) Video event identification method, apparatus, electronic device and storage medium
US11960517B2 (en) Dynamic cross-platform ask interface and natural language processing model
CN113868519B (en) Information searching method, device, electronic equipment and storage medium
CN114693934B (en) Training method of semantic segmentation model, video semantic segmentation method and device
WO2023142399A1 (en) Information search methods and apparatuses, and electronic device
WO2023155678A1 (en) Method and apparatus for determining information
CN113239157A (en) Method, device, equipment and storage medium for training conversation model
CN113468857B (en) Training method and device for style conversion model, electronic equipment and storage medium
CN113360683A (en) Method for training cross-modal retrieval model and cross-modal retrieval method and device
CN112288483A (en) Method and device for training model and method and device for generating information
CN114861057B (en) Resource sending method, training of recommendation model and device
CN115186738B (en) Model training method, device and storage medium
CN116049370A (en) Information query method and training method and device of information generation model
CN111177479A (en) Method and device for acquiring feature vectors of nodes in relational network graph
CN116030235A (en) Target detection model training method, target detection device and electronic equipment
CN113780827A (en) Article screening method and device, electronic equipment and computer readable medium
CN111552715B (en) User query method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant