Method, device, electronic device and readable storage medium for training model
By obtaining random sorting results from historical search data, statistically analyzing click probabilities, and weighting the results to train the model, the positional bias problem of the click-through rate prediction model is solved, thereby improving the accuracy of click-through rate prediction and the precision of search results.
Patent Information
- Application Number
- CN202011263628.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-12
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2040-11-12
AI Technical Summary
Existing click-through rate (CTR) prediction models suffer from reduced accuracy in search results due to ranking bias. Search results ranked higher naturally have higher CTRs, but this is not entirely due to higher content relevance or quality, leading to misjudgments and decreased accuracy.
By obtaining random sorting results from historical search data, calculating the click probability of each sorting position, determining the bias parameters, and using these parameters to weight the sample data, the target model is trained to eliminate position bias and obtain an unbiased click-through rate prediction model.
It improves the accuracy of click-through rate prediction, avoids the fixed display order of search results items, and enhances the accuracy of search results and user experience.
Smart Images

Figure CN112487283B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of Internet, and in particular, to a method and device for training a model, an electronic device, and a readable storage medium. BACKGROUND
[0002] With the rapid development of information technology, how to accurately obtain information required by a user from a large amount of information is a main problem to be solved in the search field.
[0003] When a user searches through a search engine, the user usually inputs a search term in an interface displayed by the search engine, the search engine then crawls search result items related to the search term, and estimates a click rate of each search result item by using a click rate estimation model, and finally displays the search result items to the user after sorting the search result items according to a certain sorting strategy.
[0004] Generally, the sorting order of the search result items is positively correlated with the estimated click rate of the search result items, and the search result items with a high estimated click rate will be displayed at a front position in a search result list. However, in actual application, the search result items at the front position naturally have a higher click rate, and it is not completely because the content relevance of the search result items is higher or the quality of the search result items is better, thereby causing a misjudgment of the click rate estimation model, that is, the search result items at the front position will always be at the front position with a high probability, and further causing a decrease in the accuracy of the search results. SUMMARY
[0005] Embodiments of the present disclosure provide a method and device for training a model, an electronic device, and a readable storage medium, to improve the accuracy of a click rate estimation model in estimating a click rate, and further improve the accuracy of search results.
[0006] According to a first aspect of embodiments of the present disclosure, a method for training a model is provided, and the method comprises:
[0007] obtaining historical search data with effective clicks as sample data, the historical search data containing random sorting results displayed with a preset probability;
[0008] For each sample data, determining a bias parameter of each sorting position according to a click probability of the sorting position in the random sorting results;
[0009] weighting the sample data according to the bias parameter to obtain weighted sample data;
[0010] training a target model by using the weighted sample data.
[0011] According to a second aspect of embodiments of the present disclosure, a sorting method is provided, and the method comprises:
[0012] receiving query information input by a user;
[0013] obtaining a set of search result items related to the query information;
[0014] inputting each search result item in the set of search result items into a target model with the query information, estimating a click rate of each search result item in the set of search result items by the target model, and outputting a ranking result of the set of search result items according to the estimated click rate, the target model being trained according to the method of the training model.
[0015] According to a third aspect of embodiments of the present disclosure, a device for training a model is provided, and the device comprises:
[0016] a sample obtaining module configured to obtain historical search data with valid clicks as sample data, the historical search data including random ranking results displayed with a preset probability;
[0017] a parameter determining module configured to determine a bias parameter of each ranking position in the random ranking results according to a click probability corresponding to each ranking position for each sample data;
[0018] a sample weighting module configured to weight the sample data according to the bias parameter to obtain weighted sample data;
[0019] a model training module configured to train a target model by using the weighted sample data.
[0020] According to a fourth aspect of embodiments of the present disclosure, a ranking device is provided, and the device comprises:
[0021] an information receiving module configured to receive query information input by a user;
[0022] a search obtaining module configured to obtain a set of search result items related to the query information;
[0023] a result ranking module configured to input each search result item in the set of search result items into a target model with the query information, estimate a click rate of each search result item in the set of search result items by the target model, and output a ranking result of the set of search result items according to the estimated click rate, the target model being trained according to the method of the training model.
[0024] According to a fifth aspect of embodiments of the present disclosure, an electronic device is provided, and the device comprises:
[0025] Processor, memory, and computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, implements the method of training the model.
[0026] According to a sixth aspect of embodiments of the present disclosure, a readable storage medium is provided, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method of training the model.
[0027] Embodiments of the present disclosure provide a method and device for training a model, an electronic device, and a readable storage medium. The method comprises:
[0028] In the user search process, the embodiments of the present disclosure show the user a random ranking result according to a preset probability. Thus, the sample data obtained from the historical search data contains the random ranking result shown according to the preset probability. For each sample data, a bias parameter of each ranking position is determined according to the click probability of each ranking position in the random ranking result. The sample data is weighted according to the bias parameter to obtain weighted sample data, and then the target model is trained using the weighted sample data. The click behavior of the user on the random ranking result is more reflective of the real click demand of the user rather than the click demand under the ranking strategy. The bias parameter can reflect the deviation between the click behavior of the user without the ranking strategy and the click behavior under the ranking strategy. The embodiments of the present disclosure use the bias parameter to weight the sample data, which can eliminate the position bias of the sample data, and then the target model obtained by training is an unbiased click rate estimation model, that is, the click rate predicted by the target model does not have position bias, which can improve the accuracy of the predicted click rate, avoid the display order of the search result items being fixed, and thus improve the accuracy of the search results. BRIEF DESCRIPTION OF DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor.
[0030] Figure 1 A step flowchart of the method of training the model in one embodiment of the present disclosure is shown;
[0031] Figure 2 A step flowchart of the ranking method in one embodiment of the present disclosure is shown;
[0032] Figure 3A structural diagram of an apparatus for training a model in one embodiment of the present disclosure is shown.
[0033] Figure 4 A structural diagram of an ordering apparatus in one embodiment of the present disclosure is shown.
[0034] Figure 5 A structural diagram of an electronic device provided in one embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the embodiments of the present disclosure.
[0036] Embodiment One
[0037] Referring to Figure 1 A step flowchart of a method for training a model in one embodiment of the present disclosure is shown, the method comprising:
[0038] Step 101, obtaining historical search data with valid clicks as sample data, the historical search data containing random ordering results displayed with a preset probability;
[0039] Step 102, for each sample data, determining a bias parameter of each ordering position according to a click probability corresponding to the ordering position in the random ordering result;
[0040] Step 103, weighting the sample data according to the bias parameter to obtain weighted sample data;
[0041] Step 104, training a target model using the weighted sample data.
[0042] The method for training a model provided by the present disclosure can be applied to an electronic device, including but not limited to: a smartphone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer, an in-vehicle computer, a desktop computer, a set-top box, a smart television, a wearable device, and the like.
[0043] It should be understood that in the description of the present disclosure, the words "first", "second", etc. are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor indicating or implying sequence.
[0044] When a user searches through a search engine, the user usually inputs a query in an interface displayed by the search engine, and then the search engine displays search result items corresponding to the query to the user in a certain display order. It can be understood that the search result items corresponding to the query can be obtained by crawling, indexing, and storing network data in a specific form, and then applying a calculation method such as an association degree calculation method, wherein the existing or future crawling, indexing, storing, and maintenance technologies and / or the association degree calculation technology involved can be applied to the embodiments of the present disclosure, which are not limited by the embodiments of the present disclosure. During the search of the user through the search engine, the search engine or other computing devices record various search data of the user through log files and the like, such as recording search data of the user for a certain query (for example, including search times and search frequency) and / or click data of the user for search result items of the query (for example, including click times, click time, display times, display time, and / or display order of the clicked search result items, etc.).
[0045] Because the search result items in the front of the display order have a higher click rate due to their display order, and the search result items in the rear of the display order have a lower click rate due to their display order, the display order of the search result items is fixed, and there is a position bias of the search result items. The position bias of the search result items refers to the search result items that are clicked by the user and are in the rear of the sorting position. The search result item is clicked by the user, so it should be placed in a more front position, that is, there is a deviation between the actual sorting position and the ideal sorting position of the search result item.
[0046] In order to eliminate the position bias of the search result items and solve the problem that the search result items in the front of the display order will always be in the front with a high probability, thereby reducing the accuracy of the search results, the embodiments of the present disclosure display random sorting results to the user according to a preset probability (such as a probability of 0.1%) during the search of the user. That is, for each query of the user, there is a 0.1% probability that the sorting result items displayed to the user are random sorting results. The random sorting result refers to a search result list obtained by randomly rearranging the sorting result items obtained by sorting according to a preset sorting strategy.
[0047] The value of the preset probability can be set according to actual needs, and the preset probability can be a small value. On the basis of not affecting the display of the search result items to the user according to the existing sorting strategy, the probability of being clicked at each position is counted by using the small flow of random sorting results.
[0048] According to the click behavior of the user on the random ranking result, the click probability of each ranking position in the random ranking result can be counted, and then the bias parameter of each ranking position can be determined. The bias parameter is determined according to the click behavior of the user on the random ranking result, and the random ranking result is a randomly shuffled ranking result, that is, a ranking result without a ranking strategy. The click behavior of the user on the random ranking result more reflects the real click demand of the user, rather than the click demand under the ranking strategy. The bias parameter can reflect the deviation between the click behavior of the user under the ranking strategy and the click behavior under the ranking strategy.
[0049] Based on the above premise of showing the random ranking result to the user with a preset probability (such as a probability of 0.1%), the historical search data with effective clicks is obtained as sample data, and the historical search data contains random ranking results displayed with a preset probability. The obtained historical search data can be any time period, such as last month or last year. Effective clicks refer to the time from the entry of the page to the 100% display of the page and the leaving of the browsing content, which is considered as an effective click.
[0050] In the obtained sample data, for the random ranking result therein, the click probability of the user on each ranking position corresponding to the random ranking result can be counted, so as to restore the bias parameter of each ranking position. For example, the bias parameter can be understood as the normalized result of the probability of the user clicking each ranking position in the random ranking result.
[0051] The bias parameter is used to weight the sample data to eliminate the position bias in the sample data. For example, the reverse weighting can be performed according to the ranking position, such as giving a greater weight to the search result item with a click but a late ranking position. Since the search result item at the late ranking position is less likely to be seen and clicked by the user, giving a greater weight to the search result item at the late ranking position and clicked by the user can eliminate the position bias of the search result item.
[0052] Finally, the target model is trained by using the weighted sample data. Since the weighted sample data is the sample data without position bias, the target model trained by using the weighted sample data can be used to predict the click rate of the search result item, and the prediction result does not have position bias, which can improve the accuracy of the predicted click rate and avoid the solidification of the display order of the search result item, thereby improving the accuracy of the search result.
[0053] The target model can be obtained by supervised training of an existing neural network according to a large amount of sample data and a machine learning method. It should be noted that the model structure and the training method of the target model are not limited in the embodiments of the present disclosure. The target model can be a deep neural network model that fuses multiple neural networks. The neural network includes, but is not limited to, at least one of the following or a combination, superposition, or nesting of at least two of the following: a CNN (Convolutional Neural Network), an LSTM (Long Short-Term Memory) network, an RNN (Simple Recurrent Neural Network), an attention neural network, and the like.
[0054] For example, first, the target model is constructed and initialized, and the model parameters of the initial model are set; then, the sample data is input into the initial model one by one, and the initial model is iteratively optimized according to the difference between the output result of the initial model and the labeled information in the sample data and a gradient descent algorithm, and the model parameters are adjusted until the optimized model reaches a preset convergence condition, the iteration optimization is stopped, and the model obtained by the last optimization is taken as the target model trained.
[0055] It should be noted that the sample data in the embodiments of the present disclosure is aggregated in a search dimension, and each search triggered by a user obtains a plurality of search result items. The query input in each search and the search result items displayed under the query are taken as a sample data. It should be noted that for one search, when there is a clicked search result item in the search result items of the search, the query of the search and all the search result items returned by the query are taken as a sample data. The labeled information refers to whether each search result item in a sample data is clicked.
[0056] After the target model is trained, the target model can be used to estimate the click rate of the search result items of an online search. Since the target model eliminates the position bias of the search result items, the click rate estimated by the target model is no longer affected by the historical ranking position, thereby improving the accuracy of the estimated click rate, improving the accuracy of the ranking of the search result items, obtaining a ranking result that is more in line with the user demand, and improving the user experience.
[0057] In an optional embodiment of the present disclosure, the step 102 comprises:
[0058] In step S11, a random ranking result in each sample data is obtained.
[0059] Step S12, counting the click probability corresponding to each ranking position in the random ranking result;
[0060] Step S13, determining the click probability corresponding to each ranking position as the bias parameter of each ranking position.
[0061] Specifically, the embodiment of the present disclosure aggregates historical search results according to search dimensions, and when there is a valid clicked search result item in a search, the entire ranking list under the search is taken as a sample data.
[0062] For the sample data selected from the historical search data, the random ranking result shown to the user with a preset probability (such as a 0.1% probability) is obtained, and the click probability corresponding to each ranking position in the random ranking result is counted, and the click probability corresponding to the corresponding ranking position is taken as the bias parameter of the ranking position.
[0063] For example, a user inputs the query word "big plate chicken" to trigger a search behavior, and for this search, the embodiment of the present disclosure shows the random ranking result corresponding to the query word "big plate chicken" to the user with a probability of 0.1%, and counts the click probability corresponding to each ranking position in the random ranking result corresponding to "big plate chicken", as the bias parameter of each ranking position in the random ranking result.
[0064] For example, a user inputs the query word "2020 New Year blockbuster" to trigger a search behavior, and for this search, the embodiment of the present disclosure shows the random ranking result corresponding to the query word "2020 New Year blockbuster" to the user with a probability of 0.1%, and counts the click probability corresponding to each ranking position in the random ranking result corresponding to "2020 New Year blockbuster", as the bias parameter of each ranking position in the random ranking result.
[0065] It can be understood that in the embodiment of the present disclosure, each ranking position in the random ranking result corresponding to different query words can correspond to different bias parameters.
[0066] In an optional embodiment of the present disclosure, the step 103 of weighting the sample data according to the bias parameter to obtain weighted sample data comprises:
[0067] Step S21, for each sample data, normalizing the bias parameter corresponding to each ranking position in its ranking result to obtain the bias amount corresponding to each ranking position;
[0068] Step S22, determining the weight corresponding to each ranking position according to the bias amount corresponding to each ranking position;
[0069] Step S23, weighting the clicked search result item according to the weight corresponding to the ranking position where the clicked search result item is located, to obtain weighted sample data.
[0070] For each sample data, after obtaining the bias parameter of each ranking position corresponding to the click probability of each ranking position in the statistical random ranking result, the bias parameter corresponding to each ranking position is normalized to obtain the deviation of each ranking position.
[0071] The normalization process can be as follows: the bias parameter of each ranking position is divided by the bias parameter of the first ranking position, and the result is the deviation of each ranking position. For example, for a random ranking result generated by a search process, including n ranking positions, the bias parameters corresponding to the n ranking positions are p1-pn. For the first ranking position, the deviation is the bias parameter of the first ranking position divided by the bias parameter of the first ranking position, i.e. p1 / p1; for the second ranking position, the deviation is the bias parameter of the second ranking position divided by the bias parameter of the first ranking position, i.e. p2 / p1; for the third ranking position, the deviation is the bias parameter of the third ranking position divided by the bias parameter of the first ranking position, i.e. p3 / p1; and so on. For the nth ranking position, the deviation is the bias parameter of the nth ranking position divided by the bias parameter of the first ranking position, i.e. pn / p1.
[0072] According to the deviation of each ranking position, the weight corresponding to each ranking position is determined. Specifically, the deviation can be directly used as the weight, or the deviation can be calculated to obtain the corresponding weight.
[0073] The disclosed embodiments utilize the deviation to inversely weight the random ranking result. For example, if the search result item in the first ranking position of the random ranking result is clicked, the deviation of this position is p1 / p1=1, i.e. the ranking position of the search result item itself does not have position deviation and does not need to be weighted. For example, if the search result item in the second ranking position of the random ranking result is clicked, the deviation of this position is p2 / p1, and assuming p2 is 1 / 2 of p1, the search result item can be given a weight of 2 times. For example, if the search result item in the fifth ranking position of the random ranking result is clicked, the deviation of this position is p5 / p1, and assuming p5 is 1 / 5 of p1, the search result item can be given a weight of 5 times. It can be seen that the later the clicked search result item is ranked, the greater the weight it gets.
[0074] Since the click probability of the search result item in the rear position (such as after the 30th position) is low, the deviation amount of the position can be extremely low, such as 0.001, and the clicked search result item in the rear position is sparse, which can cause the sample data in the rear position to be magnified by more than 1000 times if not compressed, so that the model is over-fitted to the sparse sample. Therefore, to avoid the model being over-fitted to the sparse sample, the deviation amount is compressed to between 0.01 and 1, that is, all deviation amounts less than 0.01 are regarded as 0.01.
[0075] Optionally, the determining, according to the deviation amount corresponding to each ranking position, of the weight corresponding to each ranking position comprises: determining the weight corresponding to each ranking position according to the loss value calculated by the initial model and the deviation amount corresponding to each ranking position. For example, the quotient of the loss value calculated by the original model and the deviation amount corresponding to each ranking position is taken as the weight corresponding to each ranking position.
[0076] The loss value can represent the deviation degree between the click probability predicted by the initial model and the actual statistical click probability. If the loss value is outside the preset range, it is considered that the deviation between the click probability predicted by the initial model and the actual statistical click probability is large, at this time, the model parameters of the initial model can be adjusted, and the initial model is iteratively trained to make the loss value finally obtained within the preset range.
[0077] According to the deviation amount corresponding to each ranking position, the weight corresponding to each ranking position is determined in the embodiment of the present disclosure. Since the deviation amount of each ranking position is the click probability of the ranking position divided by the click probability of the first ranking position, the farther the ranking position is, the smaller the deviation amount is, and the larger the quotient obtained by dividing the loss value calculated by the original model by the deviation amount corresponding to the ranking position is, and the larger the weight corresponding to the ranking position is. In actual application, the farther the ranking position of the merchant is, the less likely the merchant is seen and clicked by the user. Therefore, the embodiment of the present disclosure gives a larger weight to the search result item in the farther ranking position, so as to eliminate the position bias of the clicked search result.
[0078] It can be understood that the embodiment of the present disclosure does not limit the specific way of determining the weight. For example, the quotient obtained by dividing 1 by the deviation amount corresponding to each ranking position can also be taken as the weight corresponding to each ranking position.
[0079] In an optional embodiment of the present disclosure, after the training of the target model by using the weighted sample data, the method can further comprise:
[0080] In step S31, unbiased evaluation data is determined according to the historical search data.
[0081] Step S32, calculating an unbiased evaluation index of the target model according to the unbiased evaluation data;
[0082] Step S33, if the unbiased evaluation index does not satisfy a preset condition, continuing to train the target model;
[0083] Step S34, if the unbiased evaluation index satisfies the preset condition, stopping training the target model, and obtaining the trained target model.
[0084] The evaluation index refers to NDCG (Normalized Discounted Cumulative Gain). NDCG can be used to evaluate the ranking result of a recommendation system, and evaluate the accuracy of ranking. The recommendation system usually returns a ranking list to a user, and the ranking list contains topK search result items. Assuming that the list length is K, NDCG@K can be used to evaluate the gap between the ranking list and the user's real interaction list.
[0085] To evaluate how good the ranking list returned by a recommendation system is, a relevant score value needs to be calculated for each search result item in the ranking list. Usually, the score value is a non-negative number, which is gain. In addition, for search result items without user feedback, the gain is usually set to 0. The score values are added, that is, Cumulative Gain. In order to evaluate the most relevant items located in the front of the list, each item is divided by an increasing number, that is, the discount value, before the score values are added, and DCG is obtained. DCGs are not directly comparable between users, so they need to be normalized. Usually, all items in the test set are placed in an ideal order, the top K items are taken, and their DCGs are calculated. Then the original DCG is divided by the DCG in the ideal state, and NDCG@K is obtained, which is a number between 0 and 1.
[0086] The goal of NDCG is to get a higher quality ranking list as much as possible, and if more relevant search result items are placed in the front, the calculated NDCG will be higher.
[0087] In specific applications, the evaluation data used to calculate NDCG can be obtained offline. For example, the evaluation data can be selected from historical search data. In an example, historical search data generated in one day online can be selected as evaluation data. Further, the selected evaluation data is not in the sample data used to train the target model.
[0088] As can be seen from the foregoing, the search result items in the historical search data can have position bias, in which case the obtained evaluation data can also have position bias, which in turn leads to inaccurate evaluation indicators calculated. To solve this problem, the embodiments of the present disclosure obtain unbiased evaluation data, and use the unbiased evaluation data to calculate unbiased evaluation indicators of the target model. The unbiased evaluation data refers to evaluation data that does not have or eliminates position bias. The unbiased evaluation indicators refer to accurate evaluation indicators obtained by correcting the evaluation indicators calculated for the evaluation samples that originally have position bias.
[0089] If the calculated unbiased evaluation indicators do not meet the preset condition, the training of the target model is continued, and the model parameters of the target model are optimized; if the calculated unbiased evaluation indicators meet the preset condition, the training of the target model is stopped, and the trained target model is obtained.
[0090] The preset condition is used to determine whether the NDCG of the target model meets the requirements of online use, that is, whether the accuracy of the click rate predicted by the target model meets the expectation. When it is determined that the unbiased evaluation indicators of the target model meet the preset condition, the target model at this time can be used as the final trained target model and used online.
[0091] In an optional embodiment of the present disclosure, step S31 of determining unbiased evaluation data according to the historical search data comprises:
[0092] Step S311, determining original evaluation data in the historical search data;
[0093] Step S312, weighting the original evaluation data according to the bias parameter and the click data in the original evaluation data to obtain weighted evaluation data;
[0094] Step S313, using the weighted evaluation data as unbiased evaluation data. Unbiased evaluation indicators
[0095] Since the search result items in the historical search data can have position bias, in which case the obtained evaluation data can also have position bias. To obtain unbiased evaluation data, the embodiments of the present disclosure first determine original evaluation data in the historical search data, for example, selecting the historical search data generated in one day online as the original evaluation data. Then, the original evaluation data is weighted according to the bias parameter and the click data in the original evaluation data to obtain weighted evaluation data, and the weighted evaluation data is used as unbiased evaluation data, which can be used to calculate unbiased evaluation indicators of the target model.
[0096] In an optional embodiment of the present disclosure, the step S312 of weighting the original evaluation data according to the bias parameter and the click data in the original evaluation data to obtain weighted evaluation data comprises:
[0097] The step S3121 of obtaining the first ranking result in the original evaluation data;
[0098] The step S3122 of re-ranking the first ranking result by using the target model to obtain a second ranking result;
[0099] The step S3123 of comparing the click data in the first ranking result with the click data in the second ranking result;
[0100] The step S3124 of weighting the click data in the first ranking result according to the bias parameter to obtain weighted evaluation data if the ranking position of the same click data in the second ranking result is higher than the ranking position of the same click data in the first ranking result.
[0101] After obtaining the original evaluation data from the historical search data, the first ranking result in the original evaluation data is obtained. In an example, for the original evaluation data under a certain search, the original ranking list is the first ranking result, for example, the top 5 search result items are a1-a5, and the ranking is a1, a3, a2, a4, a5. If the user clicks a3, a3 is the positive sample, and a1, a2, a4, and a5 are the negative samples. The target model of the present disclosure is used to re-rank the first ranking result, and it is assumed that the second ranking result is a3, a1, a2, a4, a5.
[0102] The click data in the first ranking result is compared with the click data in the second ranking result. If the ranking position of the same click data in the second ranking result is higher than the ranking position of the same click data in the first ranking result, it indicates that the second ranking result is better than the first ranking result. That is, the current target model is better than the original ranking model, or the current target model is better than the last target model.
[0103] For example, in the above example, the first ranking result is a1, a3, a2, a4, a5, and the second ranking result is a3, a1, a2, a4, a5. Since the user clicks a3, and after re-ranking by the target model, a3 is ranked from the second position to the first position, that is, the ranking position of a3 in the second ranking result is higher than the ranking position of a3 in the first ranking result, which indicates that the second ranking result is better than the first ranking result. At this time, according to the bias parameter of a3, a3 in the first ranking result is weighted to obtain weighted evaluation data.
[0104] It should be noted that, for the above example, if a3 is ranked first in the first ranking result, indicating that there is no position bias for a3, then a3 does not need to be weighted. In addition, the more the clicked search result item in the first ranking result is improved in the second ranking result, the greater the weight is given. For example, in the above example, if the first ranking result is a1, a2, a4, a3, a5, and the second ranking result is a3, a1, a2, a4, a5. a3 is improved from the fourth position to the first position, then a greater weight is given relative to the improvement from the second position to the first position.
[0105] According to the bias parameter, the clicked search result item in the first ranking result is weighted to obtain the weighted evaluation data, that is, the unbiased evaluation data. The DCG is calculated by using the unbiased evaluation data, and then the unbiased NDCG can be obtained. According to the unbiased NDCG, the model parameters of the target model can be adjusted by the gradient descent method, so that the scores of the search result items at each ranking position are changed after each model parameter update, so as to improve the NDCG.
[0106] The bias parameter can be used to correct the evaluation index to obtain the unbiased evaluation index. Similar to the training process, for the evaluation data, the disclosed embodiment also differentially weights the sample data with different click positions on the basis of the original evaluation index, so as to obtain the unbiased evaluation data, and then obtain the unbiased evaluation index. The unbiased evaluation index can be used to more truly and objectively evaluate the quality of the target model. It can be understood that the way of weighting the click data in the first ranking result can adopt the way of inversely weighting the random ranking result. The weighting process is similar, for example, the NDCG calculated for each sample data with query as the granularity is inversely weighted according to the position of the clicked search result item in the first ranking result.
[0107] In an optional embodiment of the present disclosure, the step S31 of determining the unbiased evaluation data according to the historical search data comprises: obtaining the historical search data of the random ranking result displayed with a preset probability as the unbiased evaluation data.
[0108] The disclosed embodiment can provide two ways to obtain unbiased evaluation data. In addition to weighting the clicked search result item in the first ranking result by using the bias parameter to obtain the unbiased evaluation data, the historical search data of the random ranking result displayed with a preset probability can also be directly obtained as the unbiased evaluation data.
[0109] The random ranking result shown to the user according to the preset probability (such as a probability of 0.1%) is a random ranking result, that is, a ranking result without a ranking strategy. The click behavior of the user on the random ranking result is more reflective of the real click demand of the user. There is no position bias caused by a ranking strategy or sequence solidification in the random ranking result, and therefore, the random ranking result can be used as unbiased evaluation data to calculate an unbiased evaluation index.
[0110] To sum up, in the user search process, the embodiment of the present disclosure shows the user a random ranking result according to a preset probability, so that the sample data obtained from the historical search data contains the random ranking result shown according to the preset probability. For each sample data, a bias parameter of each ranking position is determined according to the click probability of each ranking position in the random ranking result; and the sample data is weighted according to the bias parameter to obtain weighted sample data, and then the target model is trained using the weighted sample data. The click behavior of the user on the random ranking result is more reflective of the real click demand of the user, rather than the click demand under a ranking strategy. The bias parameter can reflect the deviation between the click behavior of the user under a ranking strategy and the click behavior under a ranking strategy. The embodiment of the present disclosure weights the sample data using the bias parameter, which can eliminate the position bias existing in the sample data, and then the target model obtained by training is an unbiased click rate estimation model, that is, the click rate predicted using the target model does not have position bias, which can improve the accuracy of the predicted click rate, avoid the sequence solidification of the search result items, and then improve the accuracy of the search results.
[0111] It should be noted that, for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present disclosure is not limited by the described action sequence, because according to the embodiment of the present disclosure, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the embodiment of the present disclosure.
[0112] Embodiment two
[0113] Reference Figure 2 which shows a step flowchart of a ranking method in an embodiment of the present disclosure, the method comprising:
[0114] Step 201, receiving query information input by a user;
[0115] Step 202, obtaining a set of search result items related to the query information;
[0116] In step 203, each search result item in the search result item set is input into the query information input target model, the click rate of each search result item in the search result item set is estimated by the target model, and a ranking result of the search result item set is output according to the estimated click rate. The target model is trained according to the method of the training model.
[0117] The ranking method provided by the present disclosure can be applied to an electronic device, including but not limited to a smartphone, a tablet computer, an e-book reader, an MP3 player, an MP4 player, a laptop computer, an on-board computer, a desktop computer, a set-top box, a smart television, a wearable device, and the like. The electronic device includes a human-computer interaction interface, through which a user can operate to make the electronic device perform a specific function, such as an online search function of a search engine. The human-computer interaction interface can be implemented in the form of a webpage, an application page, a window, or the like.
[0118] After a user inputs query information into a search box of a search engine, a query request for obtaining search results corresponding to the query information can be triggered, and the query request carries the query information.
[0119] It should be noted that the present embodiment does not limit the specific type of the query information. The query information can be text information, voice information, image information, or the like. When the query information is text information, the text information can be analyzed, such as word segmentation analysis, to obtain query keywords in the text information; when the query information is voice information, voice recognition can be performed on the voice information to obtain corresponding text information, and the text information is analyzed to obtain query keywords in the text information; when the query information is image information, if the image information includes text content, text recognition can be performed on the image information to obtain corresponding text information, and the text information is analyzed to obtain query keywords in the text information; if the image information does not include text content, image processing can be performed on the image information to recognize the content contained in the image information, and the content is taken as query content for image retrieval.
[0120] According to the method of the training model, the target model trained by the present embodiment can eliminate the position bias of the search result item when estimating the click rate of each search result item in the search result item set, and obtain a more accurate click rate. The ranking result output according to the estimated click rate is a ranking result eliminating the position bias, which can improve the accuracy of the predicted click rate, avoid the display order of the search result item being fixed, and further improve the accuracy of the search result.
[0121] Embodiment Three
[0122] Referring to Figure 3 , which shows a structural diagram of an apparatus for training a model in one embodiment of the present disclosure, as follows.
[0123] The sample obtaining module 301 is configured to obtain historical search data with valid clicks as sample data, the historical search data containing random ranking results displayed with a preset probability.
[0124] The parameter determining module 302 is configured to determine, for each sample data, a bias parameter of each ranking position in the random ranking result according to a click probability corresponding to the ranking position.
[0125] The sample weighting module 303 is configured to weight the sample data according to the bias parameter to obtain weighted sample data.
[0126] The model training module 304 is configured to train a target model by using the weighted sample data.
[0127] Optionally, the apparatus further includes:
[0128] The data obtaining module is configured to determine unbiased evaluation data according to the historical search data.
[0129] The model evaluation module is configured to calculate an unbiased evaluation index of the target model according to the unbiased evaluation data.
[0130] The condition determining module is configured to continue training the target model if the unbiased evaluation index does not meet a preset condition.
[0131] The condition determining module is further configured to stop training the target model to obtain a trained target model if the unbiased evaluation index meets the preset condition.
[0132] Optionally, the data obtaining module includes:
[0133] The obtaining sub-module is configured to determine original evaluation data in the historical search data.
[0134] The weighting sub-module is configured to weight the original evaluation data according to the bias parameter and click data in the original evaluation data to obtain weighted evaluation data.
[0135] The determining sub-module is configured to take the weighted evaluation data as unbiased evaluation data.
[0136] Optionally, the weighting sub-module includes:
[0137] The first ranking unit is configured to obtain a first ranking result in the original evaluation data.
[0138] a second ranking unit, configured to reorder the first ranking result by using the target model to obtain a second ranking result;
[0139] a result comparison unit, configured to compare the click data in the first ranking result with the click data in the second ranking result;
[0140] a data weighting unit, configured to, if the ranking position of the same click data in the second ranking result is higher than the ranking position of the same click data in the first ranking result, weight the click data in the first ranking result according to the bias parameter to obtain weighted evaluation data.
[0141] Optionally, the data acquisition module is specifically configured to acquire historical search data of randomly ranked results displayed with a preset probability as unbiased evaluation data.
[0142] Optionally, the parameter determination module comprises:
[0143] a random result acquisition submodule, configured to acquire the random ranking result in each sample data;
[0144] a click probability counting submodule, configured to count the click probability corresponding to each ranking position in the random ranking result;
[0145] a bias parameter determination submodule, configured to determine the click probability corresponding to each ranking position as the bias parameter of each ranking position.
[0146] Optionally, the sample weighting module comprises:
[0147] a normalization submodule, configured to, for each sample data, normalize the bias parameter corresponding to each ranking position in the ranking result of the sample data to obtain the bias amount corresponding to each ranking position;
[0148] a weight determination submodule, configured to determine the weight corresponding to each ranking position according to the bias amount corresponding to each ranking position;
[0149] a sample weighting submodule, configured to weight the clicked search result item according to the weight corresponding to the ranking position of the clicked search result item to obtain weighted sample data.
[0150] The bias parameter is used to weight the sample data, so that the position bias in the sample data can be eliminated, and the target model obtained by training is an unbiased target model, that is, the prediction result of the target model can eliminate the position bias, improve the accuracy of the predicted click rate, avoid the display order of the search result item being fixed, and thus the precision of the search result can be improved.
[0151] Embodiment Four
[0152] Referring to Figure 4 which shows a structural diagram of a ranking device in one embodiment of the present disclosure, as follows.
[0153] The information receiving module 401 is configured to receive query information input by a user.
[0154] The search obtaining module 402 is configured to obtain a search result item set related to the query information.
[0155] The result ranking module 403 is configured to respectively input each search result item in the search result item set into the query information input target model, estimate the click rate of each search result item in the search result item set through the target model, and output the ranking result of the search result item set according to the estimated click rate, wherein the target model is obtained by training according to the method of the training model.
[0156] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts can be referred to the part of the method embodiment.
[0157] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between the embodiments can be referred to each other.
[0158] For the device in the above embodiment, the specific manner in which each module performs an operation has been described in detail in the embodiment of the method, and will not be described in detail here.
[0159] The embodiment of the present disclosure further provides an electronic device, referring to Figure 5 , comprising a processor 501, a memory 502, and a computer program 5021 stored in the memory and executable on the processor, wherein the processor implements the method of the training model of the foregoing embodiment when executing the program.
[0160] The embodiment of the present disclosure further provides a readable storage medium, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the method of the training model of the foregoing embodiment.
[0161] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts can be referred to the part of the method embodiment.
[0162] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems can be used with programs in accordance with the teachings herein, or it can prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will be apparent from the description above. In addition, the embodiments of the present disclosure are not described with reference to any particular programming language. It will be appreciated that a variety of programming languages can be used to implement the embodiments of the disclosure described herein, and any references below to specific languages are provided for disclosure of enablement of the embodiments of the present disclosure.
[0163] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order not to obscure the understanding of this description.
[0164] Similarly, it is to be understood that the mechanical details of the embodiments of the present disclosure that have been described above are illustrative of the various embodiments of the present disclosure and are modified in application and scope by the allowing for any of the individual features of each of the embodiments to be separately acquired, interchanged or removed and / or replaced. Accordingly, claims can be presented without regard for whether an embodiment of the present disclosure incorporates one or more particular feature.
[0165] Those skilled in the art will appreciate that the modules in the apparatuses in the embodiments can be adapted and placed in one or more apparatuses other than the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and further can be divided into multiple sub-modules or sub-units or sub-components. Any combination of all the features disclosed in the specification (including the accompanying claims, abstract and drawings), and any method or apparatus so disclosed, can be made unless specifically stated otherwise. Unless explicitly stated otherwise, each feature disclosed in the specification (including the accompanying claims, abstract and drawings) can be replaced by alternative features that serve the same, equivalent or similar purpose.
[0166] Various component embodiments of the embodiments of the present disclosure can be implemented in hardware, or implemented in software modules running on one or more processors, or implemented in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components in the sequencing apparatus according to the embodiments of the present disclosure can be implemented in practice using a microprocessor or a digital signal processor (DSP). The embodiments of the present disclosure can also be implemented as a program for executing part or all of the methods described herein on a device or an apparatus. Such a program implementing the embodiments of the present disclosure can be stored on a computer-readable medium or can be in the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0167] It should be noted that the above-mentioned embodiments illustrate rather than limit the embodiments of the present disclosure, and that one skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word 'comprising' does not exclude the presence of elements or steps not listed in a claim. The word 'a' or 'an' preceding an element does not exclude the presence of a plurality of such elements. The embodiments of the present disclosure can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the claims, the word 'first','second', and 'third', etc. does not imply any order. These words are used to name the elements.
[0168] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0169] The above only describes preferred embodiments of the embodiments of the present disclosure, and does not limit the embodiments of the present disclosure. Any modifications, equivalent replacements and improvements made within the spirit and principle of the embodiments of the present disclosure shall be included in the protection scope of the embodiments of the present disclosure.
[0170] The above only describes specific embodiments of the embodiments of the present disclosure, but the protection scope of the embodiments of the present disclosure is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the embodiments of the present disclosure, which shall be included in the protection scope of the embodiments of the present disclosure. Therefore, the protection scope of the embodiments of the present disclosure shall be subject to the protection scope of the claims.
Claims
1. A method of training a model, the method comprising: The method comprises: obtaining historical search data with effective clicks as sample data, the historical search data containing random ranking results displayed with a preset probability; for each sample data, determining a bias parameter of each ranking position in the random ranking result according to a click probability corresponding to each ranking position; weighting the sample data according to the bias parameter to obtain weighted sample data; training a target model using the weighted sample data; after the target model is trained using the weighted sample data, the method further comprises: determining unbiased evaluation data according to the historical search data; calculating an unbiased evaluation index of the target model according to the unbiased evaluation data; if the unbiased evaluation index does not meet a preset condition, continue training the target model; if the unbiased evaluation index meets the preset condition, stop training the target model to obtain a trained target model; the determining of the unbiased evaluation data according to the historical search data comprises: determining original evaluation data in the historical search data; weighting the original evaluation data according to the bias parameter and click data in the original evaluation data to obtain weighted evaluation data; using the weighted evaluation data as unbiased evaluation data; the weighting of the original evaluation data according to the bias parameter and the click data in the original evaluation data to obtain weighted evaluation data comprises: obtaining a first ranking result in the original evaluation data; re-ranking the first ranking result using the target model to obtain a second ranking result; comparing click data in the first ranking result with click data in the second ranking result; if the ranking position of the same click data in the second ranking result is higher than the ranking position of the same click data in the first ranking result, weighting the click data in the first ranking result according to the bias parameter to obtain weighted evaluation data.
2. The method of claim 1, wherein, The determining of the unbiased evaluation data according to the historical search data comprises: obtaining historical search data with random ranking results displayed with a preset probability as unbiased evaluation data.
3. The method of claim 1, wherein, The determining of the bias parameter of each ranking position in the random ranking result according to a click probability corresponding to each ranking position for each sample data comprises: obtaining the random ranking result in each sample data; counting the click probability corresponding to each ranking position in the random ranking result; determining the click probability corresponding to each ranking position as the bias parameter of each ranking position.
4. The method of claim 1, wherein, The weighting of the sample data according to the bias parameter to obtain weighted sample data comprises: for each sample data, normalizing the bias parameter corresponding to each ranking position in the ranking result of the sample data to obtain a bias amount corresponding to each ranking position; determining a weight corresponding to each ranking position according to the bias amount corresponding to each ranking position; weighting a clicked search result item according to the weight corresponding to the ranking position of the clicked search result item to obtain weighted sample data.
5. A method of sorting, characterized by, The method comprises: receiving query information input by a user; obtaining a search result item set related to the query information; inputting each search result item in the search result item set into the query information input target model respectively, estimating the click rate of each search result item in the search result item set through the target model, and outputting a ranking result of the search result item set according to the estimated click rate, wherein the target model is trained according to the method of the training model in any one of claims 1-4.
6. An apparatus for training a model, the apparatus comprising: The device comprises: a sample acquisition module configured to acquire historical search data with valid clicks as sample data, the historical search data containing random ranking results displayed with a preset probability; a parameter determination module configured to determine, for each sample data, a bias parameter of each ranking position in the random ranking result according to a click probability corresponding to the ranking position; a sample weighting module configured to weight the sample data according to the bias parameter to obtain weighted sample data; and a model training module configured to train a target model using the weighted sample data; the device further comprises: a data acquisition module configured to determine unbiased evaluation data according to the historical search data; a model evaluation module configured to calculate an unbiased evaluation index of the target model according to the unbiased evaluation data; a condition judgment module configured to continue training the target model if the unbiased evaluation index does not meet a preset condition; the condition judgment module is further configured to stop training the target model and obtain a trained target model if the unbiased evaluation index meets the preset condition; and the data acquisition module comprises: an acquisition submodule configured to determine original evaluation data in the historical search data; a weighting submodule configured to weight the original evaluation data according to the bias parameter and click data in the original evaluation data to obtain weighted evaluation data; a determination submodule configured to take the weighted evaluation data as unbiased evaluation data; and the weighting submodule comprises: a first ranking unit configured to obtain a first ranking result in the original evaluation data; a second ranking unit configured to reorder the first ranking result using the target model to obtain a second ranking result; a result comparison unit configured to compare click data in the first ranking result with click data in the second ranking result; and a data weighting unit configured to weight the click data in the first ranking result according to the bias parameter to obtain weighted evaluation data if the same click data has a higher ranking position in the second ranking result than in the first ranking result.
7. The apparatus of claim 6, wherein, The data acquisition module is specifically configured to acquire historical search data with random ranking results displayed with a preset probability as unbiased evaluation data.
8. The apparatus of claim 6, wherein, The parameter determination module comprises: a random result acquisition submodule configured to acquire random ranking results in each sample data; a click probability statistics submodule configured to count a click probability corresponding to each ranking position in the random ranking result. The bias parameter determination submodule is configured to determine the click probability corresponding to each ranking position as a bias parameter of the ranking position.
9. The apparatus of claim 6, wherein, The sample weighting module comprises: The normalization submodule is configured to normalize the bias parameter corresponding to each ranking position in the ranking result of each sample data to obtain a bias amount corresponding to each ranking position. The weight determination submodule is configured to determine the weight corresponding to each ranking position according to the bias amount corresponding to the ranking position. The sample weighting submodule is configured to weight the clicked search result item according to the weight corresponding to the ranking position where the clicked search result item is located to obtain weighted sample data.
10. A sequencing device, characterized in that, The device comprises: The information receiving module is configured to receive query information input by a user. The search obtaining module is configured to obtain a search result item set related to the query information. The result ranking module is configured to respectively input each search result item in the search result item set into the target model with the query information, estimate the click rate of each search result item in the search result item set through the target model, and output a ranking result of the search result item set according to the estimated click rate, wherein the target model is trained according to the method of the training model of any one of claims 1-4.
11. An electronic device, comprising: The device comprises: A processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of the training model of any one of claims 1-4 when executing the program.
12. A readable storage medium, characterized by, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the method of the training model of any one of claims 1-4.
Citation Information
Patent Citations
Method and device for determining sequence of search items, electronic equipment and computer readable storage medium
CN110598102A
Information recommendation method and device, computer equipment and storage medium
CN111382349A