CN107665349B - Training method and device for multiple targets in classification model - Google Patents
Training method and device for multiple targets in classification model Download PDFInfo
- Publication number
- CN107665349B CN107665349B CN201610614088.5A CN201610614088A CN107665349B CN 107665349 B CN107665349 B CN 107665349B CN 201610614088 A CN201610614088 A CN 201610614088A CN 107665349 B CN107665349 B CN 107665349B
- Authority
- CN
- China
- Prior art keywords
- training
- target
- targets
- sample
- samples
- 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
Links
- 238000012549 training Methods 0.000 title claims abstract description 429
- 238000013145 classification model Methods 0.000 title claims abstract description 88
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000007635 classification algorithm Methods 0.000 claims abstract description 32
- 238000005070 sampling Methods 0.000 claims description 11
- 238000000605 extraction Methods 0.000 claims description 10
- 238000001914 filtration Methods 0.000 claims description 10
- 230000015654 memory Effects 0.000 claims description 8
- 239000000284 extract Substances 0.000 claims description 3
- 238000004590 computer program Methods 0.000 claims description 2
- 238000011022 operating instruction Methods 0.000 claims 1
- 238000010801 machine learning Methods 0.000 abstract description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000004422 calculation algorithm Methods 0.000 description 5
- 230000006399 behavior Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 238000012937 correction Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 1
- 238000003066 decision tree Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007477 logistic regression Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
Landscapes
- Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a method and a device for training a plurality of targets in a classification model, which are used for improving the utilization rate of machine learning resources and improving the updating efficiency of the classification model. The embodiment of the invention provides a method for training a plurality of targets in a classification model, which comprises the following steps: extracting a training set used for current training from a training database, wherein the training set comprises M training samples; respectively acquiring target fields in each training sample from M training samples in the training set, respectively selecting M target values corresponding to the M target fields from N targets according to field contents included in the M target fields, and respectively configuring the selected M target values to the training sample where the target field corresponding to the target value is located; and constructing a classification model comprising the N targets by learning M training samples configured with M target values by using a preset classification algorithm, wherein the N targets correspond to different model parameters in the classification model.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for training a plurality of targets in a classification model.
Background
In the prior art, a Click-Through Rate Prediction (PCTR) of a certain advertisement can be calculated Through an advertisement prediction model, the PCTR is the most core technology in an advertisement algorithm, and the problem to be solved by the PCTR is to Predict the Click probability of a specific user on a specific advertisement in a specific environment at a specific advertisement position. In the current advertisement estimation model, only one target of the advertisement click-through rate is generally considered, that is, only one target of the advertisement click-through rate needs to be considered in estimation of the current PCTR, so that the target of the advertisement click-through rate can be identified as 0/1 in the training data, wherein 0 can represent exposure of the advertisement, and 1 can represent that the advertisement is clicked. The estimation method of the advertisement PCTR can only be applied to the traditional advertisement estimation model, so that other factors except the advertisement click rate need to be considered in the estimation of the PCTR in the traditional scheme. However, with the increasing of advertisement delivery fields, such as the friend circle advertisement delivery field, which is different from the traditional advertisement delivery, the PCTR pre-estimation in the friend circle advertisement delivery needs to consider the prediction of multiple targets besides the advertisement click rate, such as click details of the advertisement, click sharing, and the like. According to the prior art, given that each target trains the predictions individually, the machine learning resource consumption aspect would be huge and difficult to achieve in engineering terms.
Disclosure of Invention
The embodiment of the invention provides a method and a device for training a plurality of targets in a classification model, which are used for improving the utilization rate of machine learning resources and improving the updating efficiency of the classification model.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for training multiple targets in a classification model, including:
extracting a training set used for current training from a training database, wherein the training set comprises M training samples, and M is a natural number;
respectively acquiring target fields in each training sample from M training samples in the training set, respectively selecting M target values corresponding to the M target fields from N targets according to field contents included in the M target fields, and respectively configuring the selected M target values to the training samples where the target fields corresponding to the target values are located, wherein N is the number of targets to be trained, and N is a natural number greater than or equal to 2;
and constructing a classification model comprising the N targets by learning M training samples configured with M target values by using a preset classification algorithm, wherein the N targets correspond to different model parameters in the classification model.
In a second aspect, an embodiment of the present invention further provides a device for training a plurality of targets in a classification model, including:
the system comprises a sample extraction module, a training database and a training data base, wherein the sample extraction module is used for extracting a training set used by current training from the training database, the training set comprises M training samples, and M is a natural number;
the multi-target configuration module is used for respectively acquiring target fields in each training sample from M training samples in the training set, respectively selecting M target values corresponding to the M target fields from N targets according to field contents included in the M target fields, and respectively configuring the selected M target values to the training sample where the target field corresponding to the target value is located, wherein N is the number of targets to be trained, and N is a natural number greater than or equal to 2;
and the target training module is used for constructing a classification model comprising the N targets by learning M training samples configured with M target values by using a preset classification algorithm, wherein the N targets correspond to different model parameters in the classification model.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the embodiment of the invention, a training set used for current training is extracted from a training database, the training set comprises M training samples, then target fields in each training sample are respectively obtained from the M training samples in the training set, M target values corresponding to the M target fields are respectively selected from N targets according to field contents included in the obtained M target fields, the selected M target values are respectively configured to the training samples where the target fields corresponding to the target values are located, finally a classification model comprising N targets is constructed by using a preset classification algorithm through learning of the M training samples configured with the M target values, and the N targets correspond to different model parameters in the classification model. In the embodiment of the invention, after the training samples in the training set are obtained, M target values can be configured from N targets for M training samples in the training set, so that after the M training samples configured with M target values are learned by using a classification algorithm, a classification model comprising N targets can be constructed, the classification model can be used for estimating a plurality of targets, and the N values can be determined according to the number of the targets to be trained.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings.
FIG. 1 is a schematic flowchart of a method for training a plurality of targets in a classification model according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a process for training a plurality of targets in an advertisement prediction model according to an embodiment of the present invention;
FIG. 3-a is a schematic diagram of a structure of a training apparatus for classifying a plurality of targets in a model according to an embodiment of the present invention;
FIG. 3-b is a schematic diagram of a structure of a target training module according to an embodiment of the present invention;
FIG. 3-c is a schematic diagram of another exemplary target training module according to an embodiment of the present invention;
FIG. 3-d is a schematic diagram of a structure of a training apparatus for multiple targets in another classification model according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a server to which the method for training a plurality of targets in a classification model provided in the embodiment of the present invention is applied.
Detailed Description
The embodiment of the invention provides a method and a device for training a plurality of targets in a classification model, which are used for improving the utilization rate of machine learning resources and improving the updating efficiency of the classification model.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments that can be derived by one skilled in the art from the embodiments given herein are intended to be within the scope of the invention.
The terms "comprises" and "comprising," and any variations thereof, in the description and claims of this invention and the above-described drawings are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
In the prior art, the estimation method of the advertisement PCTR can only predict one target of the advertisement click rate. However, with the increasing of advertisement delivery fields, such as the friend circle advertisement delivery field, which is different from the traditional advertisement delivery, the PCTR pre-estimation in the friend circle advertisement delivery needs to consider the prediction of multiple targets besides the advertisement click rate, such as click details of the advertisement, click sharing, and the like. According to the prior art, given that each target trains the predictions individually, the machine learning resource consumption aspect would be huge and difficult to achieve in engineering terms. Therefore, in order to reduce the use of machine learning resources and simultaneously realize the training of a plurality of targets, the method provided by the embodiment of the invention provides multi-target training based on training data correction, the training efficiency of the model can be ensured under the condition of limited machine resources, and meanwhile, the method provided by the embodiment of the invention can support the flexible configuration of the number of targets in the model and can realize the flexible adjustment between the machine resources and the model efficiency. The following are detailed below.
Referring to fig. 1, an embodiment of a method for training a plurality of targets in a classification model according to the present invention may include the following steps:
101. and extracting a training set used for current training from a training database, wherein the training set comprises M training samples, and M is a natural number.
In the embodiment of the present invention, a plurality of training data are stored in a training database, which may also be updated in real time according to user needs, and each time a target training is performed, the training data in the training database in the current state is extracted first, and the extracted training data is used as a training set, for example, a training set used for current training may be extracted from the training database in a random extraction manner, the training data extracted from the training database may form a training set, and each training data included in the training set may be used as a training sample for subsequent processing. For example, in some embodiments of the present invention, the training samples included in the training set may specifically include basic attributes and behavior data of the user, for example, the training samples may include gender, age, region, mobile phone type, network type, and user operation behavior. The user operation behavior may specifically mean that the user clicks a picture, or forwards information, or makes a comment, and the like, and may be specifically determined by combining an application scenario.
In some embodiments of the present invention, after the step 101 extracts a training set used for current training from a training database, the method for training a plurality of targets in a classification model provided in the embodiments of the present invention may further include the following steps:
a1, judging whether the number M of training samples in a training set used by current training is larger than a preset sample capacity threshold value;
and A2, if the number M of the training samples is larger than the preset sample capacity threshold value, sampling the M training samples included in the training set to obtain the training samples sampled in the training set.
In an actual application scenario, in order to save machine learning resources and deal with the problem of too large training sample size, steps a1 to a2 may also be performed. Firstly, judging whether the number M of training samples in the training set obtained through the step 101 is larger than a preset sample capacity threshold, if the number M of training samples in the training set used by the current training is larger than the preset sample capacity threshold, the sample size of the training set extracted at present is over large, and the M training samples in the training set can be sampled to reduce the sample capacity in the training set, so that the training samples sampled in the training set are obtained. The sampling may be performed in various ways, such as using a specific algorithm to extract training samples with sample identifiers of specific values, or using a random extraction method to extract training samples from a training set. By sampling the training set, the loaded training samples can be reduced, and the machine learning efficiency is improved.
In some embodiments of the present invention, the step 101 of extracting a training set used for current training from a training database may specifically include the following steps:
and B1, extracting the training set updated in each data updating period from the training database according to the data updating period of the training sample as the training set used for the current training.
The training data in the training database can be periodically updated, and the training of the classification model also needs to be periodically updated, so that the training set also needs to be extracted according to the data updating period of the training samples when the training set is extracted, for example, the data updating period of the training samples is 30 minutes, the training set can be extracted every 30 minutes, so that the multi-target training described in the subsequent steps is executed, the model updating period is ensured, and the machine learning resources are greatly saved.
102. Respectively acquiring target fields in each training sample from M training samples in a training set, respectively selecting M target values corresponding to the M target fields from N targets according to field contents included in the M acquired target fields, respectively configuring the selected M target values to the training samples where the target fields corresponding to the target values are located, wherein N is the number of targets to be trained, and N is a natural number greater than or equal to 2.
In the embodiment of the present invention, after the training set is extracted, a specific target field can be obtained from each training sample for all M training samples included in the training set, and the field content configured in the target field written in a specific position in the training sample can be actually set according to the actual training sample. For example, in PCTR estimation timing in advertisement delivery in a circle of friends, for a target field of each training sample in M training samples of a training set, different field contents may be set in the target field according to an advertisement click rate, advertisement click details, advertisement click sharing, and the like, taking the number of targets to be trained as N as an example, a target value configured for each target field in the M target fields may be determined according to corresponding field contents, a specific target value may be a target value corresponding to one target in the N targets, a value of N may be 2, 3, or greater, and how many targets need to be configured for the target field of the training sample in actual application may be determined in combination with an actual training application scenario. For a target field obtained from a training sample, a target value corresponding to one target of N targets can be configured according to the field content of the target field, that is, each target corresponds to one target value, the target values corresponding to the N targets are different, and the target values of different targets are updated in real time when the training sample is learned. The type and the number of the number N of the targets needing to be trained can be configured according to a specific scene, taking PCTR estimation in advertisement delivery in a friend circle as an example, N targets can be respectively advertisement click rate, click details of an advertisement and advertisement click sharing, and then a target value can be set for each target, for example, the target value of the 1 st target can be 1, the target value of the 2 nd target can be 2, the target value of the 3 rd target can be 3, and the like. For example, a target field stored in a certain specific location is obtained from a training sample, and for a training sample 1, a training sample 2, and a training sample 3, the field content of the target field may be content a, content B, and content C, so that a target value a may be configured for the content a, a target value B may be configured for the target B, and a target value C may be configured for the target C, so that the target value a may be configured for the training sample 1, the target value B may be configured for the training sample 2, and the target value C may be configured for the training sample 3. In practical application, the corresponding target values are configured according to the field content of the target field, and the target values which need to be configured can be determined by combining an application scene.
In some embodiments of the present invention, in the implementation scenario of the foregoing steps a1 to a2, the step 102 of obtaining the preset target field from the training sample includes the following steps: and respectively acquiring target fields in the sampled training samples from the training samples sampled from the training set. That is, when the training set is sampled, the target field is read only for the sampled training samples.
103. And constructing a classification model comprising N targets by using a preset classification algorithm through learning M training samples configured with M target values, wherein the N targets correspond to different model parameters in the classification model.
In the embodiment of the invention, after a target value is configured for each of the M training samples, a classification model is created according to the M training samples configured with the M target values. Specifically, the preset classification algorithm can be a logistic regression algorithm, a decision tree algorithm, a neural network algorithm and the like to establish a classification model, and as M target values configured in M training samples adopted during learning come from N targets to be trained, N targets can be trained in the constructed classification model, different model parameters are applied to different targets in the classification model, so that prediction of estimation results by the targets can be estimated and realized when the classification model comprising the targets is used for prediction estimation. For example, the PCTR estimation timing in the advertisement delivery of the friend circle is carried out according to the embodiment of the invention, so that the prediction of a plurality of targets such as advertisement click rate, advertisement click details, advertisement click sharing and the like can be realized.
In some embodiments of the present invention, the step 103 constructs a classification model including N targets by learning M training samples configured with M target values using a preset classification algorithm, and specifically may include the following steps:
c1, respectively obtaining model parameters corresponding to each target in the N targets in the following modes: determining that a target value configured for a target field in a training sample currently being trained corresponds to the NthtAn object, judge the NthtAn objectThe corresponding training sample is either a positive sample or a negative sample if the Nth sampletIf the training sample corresponding to each target is a positive sample, updating the Nth sample by using a preset classification algorithmtModel parameters of each object, if NtThe training sample corresponding to each target is a negative sample, and the model parameters of each target in the N targets are updated by using a classification algorithm, wherein N istRepresents any natural number less than N;
and C2, finishing training the N targets by using M training samples for configuring M target values, and combining the model parameters corresponding to each target in the N targets to obtain a classification model comprising the N targets.
In step C1, taking any training sample currently being trained as an example, the training sample may be configured with a target value in step 102, and if the target value is any one of N targets, the any one target uses N targetstIndicate that for the NthtThe training samples corresponding to the targets are firstly judged to be positive samples or negative samples, wherein the positive samples refer to the training samples belonging to a certain class, and the negative samples can also be called as negative samples, which refer to the training samples not belonging to a certain class. For example, it is determined that N targets need to be trained, and then the N targets may be represented as 1, …, and N, and when the target value is 0, it indicates that the training sample is a negative sample, and when the target value is 1, 2, …, and N, it indicates that the training sample is a positive sample. If it is the NthtIf the training sample corresponding to each target is a positive sample, the Nth training sample can be updated by using a classification algorithmtModel parameters of the object, i.e. when the NthtWhen the training sample corresponding to each target is a positive sample, only the Nth sample is updatedtModel parameters of an object, and when NtThe training sample corresponding to each target is a negative sample, and then the classification algorithm is used to update the model parameters of each target in the N targets, that is, when the Nth target is a negative sampletWhen the training samples corresponding to the targets are negative samples, all the model parameters in the classification model need to be updated, and the model parameters of each of the N targets can be obtained through the description in step C1. Then executeStep C2, combining the model parameters corresponding to each of the N targets, that is, dividing the model parameters into multiple dimensions according to the multiple targets, and obtaining the model parameters of the multiple dimensions when combining the model parameters of each dimension, thereby obtaining a classification model including the N targets.
In the foregoing embodiment, the creation mode of the classification model is described by taking training of N targets in the classification model as an example. In other embodiments of the present invention, the step 103 constructs a classification model including N targets by learning M training samples configured with M target values using a preset classification algorithm, and specifically may include the following steps:
d1, respectively obtaining model parameters corresponding to each target in the N targets in the following modes: determining N currently in need of training1Filtering out target values not belonging to N from M training samples1Training samples of each target to obtain M1A training sample, M1Representing that the target value in M training samples configured with M target values belongs to the N1Number of training samples for each target, N1Represents any natural number of 1 or more and less than N; by using a preset classification algorithm for M1Learning of individual training samples to construct a training pattern corresponding to N1Model parameters of the individual targets;
d2, after the N targets are trained, combining the model parameters corresponding to each target in the N targets to obtain a classification model comprising the N targets.
In the implementation scenario of step D1, N of the N targets may be first selected1The target is taken as the target needing training currently, N1Represents 1 or more and less than N, for example, N may be 10, N1The value may be 3, and the first 3 targets of the 10 targets may be trained first. In this case, it is necessary to filter out non-N from all training samples in the training set1Training samples of each target are obtained by dividing N into M training samples configured with M target values1Filtering out training samples of other targets except the target to obtainTo M1Training samples, after filtering, using a preset classification algorithm to M1Each training sample is learned to construct a model corresponding to N1Model parameters of the individual targets. Divide by N for N targets1Targets other than the one target may also be trained in the manner described in step D1 so that model parameters for each target may be generated. Step D2 is similar to the implementation of step C2 in the previous embodiment and will not be described in detail.
In the foregoing embodiment, the creation mode of the classification model is described by taking training of N targets in the classification model as an example. N objects may be grouped to obtain a plurality of groups, and then a classification model may be created for each group individually, and then a classification model may be created for each group, for example, N may have a value of 10, and N may have a value of N1The value may be 3, and then 10 targets may be divided into 3 groups, for example, the 1 st target to the 4 th target are one group, the 5 th target to the 8 th target are one group, and the 9 th target and the 10 th target are one group, and then 3 classification models may be extracted for the 3 groups, respectively. Finally, a plurality of targets in the classification model are merged to obtain a classification model including more targets, which may be the classification model including N targets described in step 103.
It can be known from the description of the embodiment of the present invention in the above embodiment that, first, a training set used for current training is extracted from a training database, where the training set includes M training samples, then, target fields in each training sample are respectively obtained from M training samples in the training set, M target values corresponding to M target fields are respectively selected from N targets according to field contents included in the obtained M target fields, the selected M target values are respectively configured to the training samples where the target fields corresponding to the target values are located, and finally, a classification model including N targets is constructed by using a preset classification algorithm through learning the M training samples configured with the M target values, and the N targets correspond to different model parameters in the classification model. In the embodiment of the invention, after the training samples in the training set are obtained, M target values can be configured from N targets for M training samples in the training set, so that after the M training samples configured with M target values are learned by using a classification algorithm, a classification model comprising N targets can be constructed, the classification model can be used for estimating a plurality of targets, and the N values can be determined according to the number of the targets to be trained.
In order to better understand and implement the above-mentioned schemes of the embodiments of the present invention, the following description specifically illustrates corresponding application scenarios. Next, a description will be given by taking an example in which the multi-target training method in the classification model provided by the embodiment of the present invention is applied to a PCTR predictor. Conventional PCTR estimates only consider ad click-through rate as one target, so the target is 0/1, 0 for exposure and 1 for click in the training data. However, in the estimation scene of the circle of friends, a plurality of targets need to be estimated. Each goal is trained separately according to the prior art, and machine resources are too expensive. Therefore, in order to reduce machine resources, the training samples may be modified according to embodiments of the present invention. For example, the training sample includes basic information of the user, which may include, for example, the user's gender, age, region, cell phone type, network type, and the like. The target fields in the training samples may be set to be different targets according to field contents, for example, N targets that can be set to different field contents in the target fields are provided, and the target value of each target field may be 0 to N. For example, taking 10 targets configured in a training sample as an example, 0 may represent exposure, 1 may represent a click avatar, 2 may represent a click name, 3 may represent a click picture, 4 may represent a click video play, 5 may represent a click share, 6 may represent a click favorite, 7 may represent a user to post comments, 8 may represent a user interest, 9 may represent click details, and 10 represents a user type. In practical applications, a mixed language data standard may be used to store the training set, for example, a PB (Protocol Buffer) file format may be used to store the training samples, and then the training samples are parsed according to a PB Protocol, for example, N may be configured in the training samples to represent the number of targets. The embodiment of the invention can ensure that N targets can use the same training sample, namely N targets can be trained by the same training sample, thereby reducing the storage resources of a machine. In addition, because it takes time to train the PCTR estimation model of the actual model, the early data is loaded to the memory of the training machine, which may take a certain time. Therefore, when multiple targets are trained, training of multiple model parameters can share one training sample and feature analysis. And then according to the corrected training samples, when the model is trained, all model parameters are updated when the negative samples are encountered, and only the model parameters corresponding to the positive samples are updated when the positive samples are encountered, so that one-time training sample loading can be realized, and a plurality of targets can be trained. Under the condition of ensuring the model updating period, the machine resources are saved greatly, different targets can be configured flexibly for each model, and thus the flexible adjustment between the machine resources and the model efficiency can be realized.
Referring to fig. 2, a schematic diagram of a training process for multiple targets in an advertisement prediction model according to an embodiment of the present invention is shown. The method mainly comprises the following steps:
1. generating a training set: in the embodiment of the present invention, the training sample corresponds to a plurality of targets, and the number of the targets is assumed to be N, so that the targets of the training sample need to be mapped to 0-N, for example, 0 represents exposure, 1 represents click details, 2 represents a click avatar, and the like. The main purpose of the target mapping is to distinguish different targets in subsequent model filtering and model training.
2. Loading a training sample: by giving the periodic data parameters of the training samples, the corresponding training samples are loaded, for example, the training samples can be loaded every 30 minutes to ensure real-time update of the classification model.
3. Filtering a training sample: in order to improve the training effect of the classification model, for example, the training samples may be sampled, and the sampling process may be required because the loaded training samples are too large. As another example, filtering non-training target samples, such as training 1/2, may filter training samples for 3-N targets when filtering data.
4. A new training sample is obtained and then step 5 is performed.
5. Training and updating a classification model: and when the input training sample is a negative sample, updating all the model parameters, and when the input training sample is a positive sample, only updating the model parameters corresponding to the target.
6. Merging model parameters of a plurality of targets in the model: and directly combining the results of each model obtained by training into a large model, and outputting the large model as a local file to obtain the final multi-target model.
7. And (3) loading the multi-target classification model, outputting the classification model as a local file after the classification model is generated, loading the file by a recommendation engine, and predicting the click rate of the advertisement on line.
In the embodiment of the invention, multi-model training can be carried out based on training sample correction, the requirement of multi-target PCTR estimation in a circle of friends can be supported, and meanwhile, the updating efficiency of the model and the flexible adjustment of machine resources can be ensured.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
To facilitate a better implementation of the above-described aspects of embodiments of the present invention, the following also provides relevant means for implementing the above-described aspects.
Referring to fig. 3-a, an apparatus 300 for training a plurality of targets in a classification model according to an embodiment of the present invention may include: a sample extraction module 301, a multi-objective configuration module 302, and an objective training module 303, wherein,
a sample extraction module 301, configured to extract a training set used for current training from a training database, where the training set includes M training samples, where M is a natural number;
a multi-target configuration module 302, configured to obtain target fields in each training sample from M training samples in the training set, select M target values corresponding to the M target fields from N targets according to field contents included in the obtained M target fields, and configure the selected M target values to the training sample in which the target field corresponding to the target value is located, where N is the number of targets to be trained, and N is a natural number greater than or equal to 2;
the target training module 303 is configured to construct a classification model including the N targets by learning M training samples configured with M target values using a preset classification algorithm, where the N targets correspond to different model parameters in the classification model.
In some embodiments of the present invention, referring to fig. 3-b, the goal training module 303 comprises:
a first model updating module 3031, configured to obtain model parameters corresponding to each of the N targets respectively by: determining that a target value configured for a target field in a training sample currently being trained corresponds to the NthtA target, judging the NthtThe training sample corresponding to each target is a positive sample or a negative sample if the Nth sampletIf the training sample corresponding to each target is a positive sample, updating the Nth sample by using a preset classification algorithmtModel parameters of each object, if the NthtUpdating the model parameters of each target in N targets by using the classification algorithm if the training sample corresponding to each target is a negative sample, wherein N istRepresents any natural number less than the N;
the first parameter combination module 3032 is configured to complete training on N targets using M training samples configuring M target values, and then combine model parameters corresponding to each target of the N targets to obtain a classification model including the N targets.
In some embodiments of the present invention, referring to fig. 3-c, the goal training module 303 comprises:
a second model updating module 3033, configured to obtain model parameters corresponding to each of the N targets respectively by: determining N currently in need of training1Filtering out target values from the M training samples which do not belong to the N1Training samples of each target to obtain M1A training sample, said M1Representing that the target value in M training samples configured with M target values belongs to the N1Number of training samples of each target, N1Represents any natural number not less than 1 and less than N; by using a preset classification algorithm for said M1Learning of individual training samples to construct a model corresponding to said N1Model parameters of the individual targets;
a second parameter combining module 3034, configured to combine the model parameters corresponding to each of the N targets after the N targets are trained, so as to obtain a classification model including the N targets.
In some embodiments of the present invention, referring to fig. 3-d, the apparatus 300 for training a plurality of targets in a classification model further includes: a sample sampling module 304, wherein,
the sample sampling module 304 is configured to, after the sample extraction module 301 extracts a training set used for current training from a training database, determine whether the number M of training samples included in the training set used for current training is greater than a preset sample capacity threshold; if the number M of the training samples is larger than a preset sample capacity threshold value, sampling the M training samples included in the training set to obtain the training samples sampled in the training set;
the multi-target configuration module 302 is specifically configured to obtain target fields in the sampled training samples from the training set respectively.
In some embodiments of the present invention, the sample extracting module 301 is specifically configured to extract, from the training database, training sets updated in each data update period according to the data update period of a training sample, as training sets used for current training.
As can be seen from the above description of the embodiments of the present invention, a training set used for current training is first extracted from a training database, where the training set includes M training samples, then target fields in each training sample are respectively obtained from M training samples in the training set, M target values corresponding to M target fields are respectively selected from N targets according to field contents included in the obtained M target fields, the selected M target values are respectively configured to training samples where the target fields corresponding to the target values are located, and finally a classification model including N targets is constructed by using a preset classification algorithm through learning of the M training samples configured with the M target values, where the N targets correspond to different model parameters in the classification model. In the embodiment of the invention, after the training samples in the training set are obtained, M target values can be configured from N targets for M training samples in the training set, so that after the M training samples configured with M target values are learned by using a classification algorithm, a classification model comprising N targets can be constructed, the classification model can be used for estimating a plurality of targets, and the N values can be determined according to the number of the targets to be trained.
Fig. 4 is a schematic diagram of a server 1100 according to an embodiment of the present invention, where the server 1100 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1122 (e.g., one or more processors) and a memory 1132, and one or more storage media 1130 (e.g., one or more mass storage devices) for storing applications 1142 or data 1144. Memory 1132 and storage media 1130 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 1130 may include one or more modules (not shown), each of which may include a series of instruction operations for the server. Still further, the central processor 1122 may be provided in communication with the storage medium 1130 to execute a series of instruction operations in the storage medium 1130 on the server 1100.
The server 1100 may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input-output interfaces 1158, and/or one or more operating systems 1141, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and so forth.
The steps of the method for training a plurality of targets in a classification model performed by a server in the above embodiment may be based on the server structure shown in fig. 4.
It should be noted that the above-described embodiments of the apparatus are merely schematic, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by software plus necessary general hardware, and may also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions may be various, such as analog circuits, digital circuits, or dedicated circuits. However, the implementation of a software program is a more preferable embodiment for the present invention. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk of a computer, and includes instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
In summary, the above embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the above embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the above embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for training a plurality of targets in a classification model is characterized by comprising the following steps:
extracting a training set used for current training from a training database, wherein the training set comprises M training samples, and M is a natural number;
respectively acquiring target fields in each training sample from M training samples in the training set, respectively selecting M target values corresponding to the M target fields from N targets according to field contents included in the M target fields, and respectively configuring the selected M target values to the training samples where the target fields corresponding to the target values are located, wherein N is the number of targets to be trained, and N is a natural number greater than or equal to 2;
constructing a classification model comprising the N targets by learning M training samples configured with M target values by using a preset classification algorithm, wherein the classification model comprises the following steps:
obtaining model parameters corresponding to each of the N targets respectively by: determining that a target value configured for a target field in a training sample currently being trained corresponds to the NthtA target, judging the NthtThe training sample corresponding to each target is a positive sample or a negative sample if the Nth sampletIf the training sample corresponding to each target is a positive sample, updating the Nth sample by using a preset classification algorithmtModel parameters of each object, if the NthtUpdating the model parameters of each target in N targets by using the classification algorithm if the training sample corresponding to each target is a negative sample, wherein N istRepresents any natural number less than the N;
after training the N targets is completed by using M training samples for configuring M target values, model parameters corresponding to each target in the N targets are combined together to obtain a classification model comprising the N targets;
the N targets correspond to different model parameters in the classification model.
2. The method of claim 1, wherein the constructing a classification model including the N targets through learning of M training samples configured with M target values using a preset classification algorithm comprises:
obtaining model parameters corresponding to each of the N targets respectively by: determining N currently in need of training1Filtering out target values from the M training samples which do not belong to the N1Training samples of each target to obtain M1A training sample, said M1Representing that the target value in M training samples configured with M target values belongs to the N1Number of training samples for each target, N1Represents any one of 1 or more and less than the NA natural number; by using the preset classification algorithm to the M1Learning of individual training samples to construct a model corresponding to said N1Model parameters of the individual targets;
after the N targets are trained, model parameters corresponding to each target in the N targets are combined together to obtain a classification model comprising the N targets.
3. The method of any one of claims 1-2, wherein after extracting the training set used for the current training from the training database, the method further comprises:
judging whether the number M of training samples included in a training set used for the current training is larger than a preset sample capacity threshold value or not;
if the number M of the training samples is larger than a preset sample capacity threshold value, sampling the M training samples included in the training set to obtain the training samples sampled in the training set;
the obtaining the target field in each training sample from the M training samples in the training set includes:
and respectively acquiring target fields in the sampled training samples from the training samples sampled from the training set.
4. The method of any one of claims 1 to 2, wherein extracting the training set used for the current training from the training database comprises:
and respectively extracting the training set updated in each data updating period from the training database according to the data updating period of the training sample as the training set used for the current training.
5. An apparatus for training a plurality of objects in a classification model, comprising:
the system comprises a sample extraction module, a training database and a training data base, wherein the sample extraction module is used for extracting a training set used by current training from the training database, the training set comprises M training samples, and M is a natural number;
the multi-target configuration module is used for respectively acquiring target fields in each training sample from M training samples in the training set, respectively selecting M target values corresponding to the M target fields from N targets according to field contents included in the M target fields, and respectively configuring the selected M target values to the training sample where the target field corresponding to the target value is located, wherein N is the number of targets to be trained, and N is a natural number greater than or equal to 2;
the target training module is configured to construct a classification model including the N targets by learning M training samples configured with M target values using a preset classification algorithm, and includes:
a first model updating module, configured to obtain model parameters corresponding to each of the N targets respectively in the following manner: determining that a target value configured for a target field in a training sample currently being trained corresponds to the NthtA target, judging the NthtThe training sample corresponding to each target is a positive sample or a negative sample if the Nth sampletIf the training sample corresponding to each target is a positive sample, updating the Nth sample by using a preset classification algorithmtModel parameters of each object, if the NthtUpdating the model parameters of each target in N targets by using the classification algorithm if the training sample corresponding to each target is a negative sample, wherein N istRepresents any natural number less than the N;
the first parameter combination module is used for combining model parameters corresponding to each target in the N targets after finishing training the N targets by using M training samples for configuring M target values to obtain a classification model comprising the N targets;
the N targets correspond to different model parameters in the classification model.
6. The apparatus of claim 5, wherein the goal training module comprises:
a second model updating module, configured to obtain model parameters corresponding to each of the N targets respectively in the following manner: determining N currently in need of training1Filtering out target values from the M training samples which do not belong to the N1Training samples of each target to obtain M1A training sample, said M1Representing that the target value in M training samples configured with M target values belongs to the N1Number of training samples of each target, N1Represents any natural number not less than 1 and less than N; by using the preset classification algorithm to the M1Learning of individual training samples to construct a model corresponding to said N1Model parameters of the individual targets;
and the second parameter combination module is used for combining the model parameters corresponding to each target in the N targets after the N targets are trained to obtain a classification model comprising the N targets.
7. The apparatus of any one of claims 5 to 6, wherein the means for training the plurality of targets in the classification model further comprises: a sample sampling module, wherein,
the sample sampling module is used for judging whether the number M of training samples in the training set used for the current training is larger than a preset sample capacity threshold value or not after the sample extracting module extracts the training set used for the current training from a training database; if the number M of the training samples is larger than a preset sample capacity threshold value, sampling the M training samples included in the training set to obtain the training samples sampled in the training set;
the multi-target configuration module is specifically configured to obtain target fields in the sampled training samples from the training set respectively.
8. The apparatus according to any one of claims 5 to 6, wherein the sample extraction module is specifically configured to extract, from the training database, the training sets updated in the respective data update periods as the training sets used for the current training according to the data update periods of the training samples.
9. A server, comprising: a memory and a processor;
the memory is used for storing computer operation instructions;
the processor is used for executing the computer operation instructions stored in the memory;
the computer operating instructions are used for executing the training method of the plurality of targets in the classification model according to any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program for executing the method of training a plurality of objects in a classification model according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610614088.5A CN107665349B (en) | 2016-07-29 | 2016-07-29 | Training method and device for multiple targets in classification model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610614088.5A CN107665349B (en) | 2016-07-29 | 2016-07-29 | Training method and device for multiple targets in classification model |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107665349A CN107665349A (en) | 2018-02-06 |
CN107665349B true CN107665349B (en) | 2020-12-04 |
Family
ID=61115690
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610614088.5A Active CN107665349B (en) | 2016-07-29 | 2016-07-29 | Training method and device for multiple targets in classification model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107665349B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110737446B (en) * | 2018-07-20 | 2021-10-12 | 杭州海康威视数字技术股份有限公司 | Method and device for updating parameters |
CN111325228B (en) * | 2018-12-17 | 2021-04-06 | 上海游昆信息技术有限公司 | Model training method and device |
CN112785005B (en) * | 2021-01-22 | 2023-02-03 | 中国平安人寿保险股份有限公司 | Multi-objective task assistant decision-making method and device, computer equipment and medium |
CN113361487B (en) * | 2021-07-09 | 2024-09-06 | 无锡时代天使医疗器械科技有限公司 | Foreign matter detection method, device, equipment and computer readable storage medium |
CN114169536B (en) * | 2022-02-11 | 2022-05-06 | 希望知舟技术(深圳)有限公司 | Data management and control method and related device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103217280A (en) * | 2013-03-18 | 2013-07-24 | 西安交通大学 | Multivariable support vector machine prediction method for aero-engine rotor residual life |
CN106203487A (en) * | 2016-06-30 | 2016-12-07 | 北京航空航天大学 | A kind of image classification method based on Multiple Kernel Learning Multiple Classifier Fusion and device |
-
2016
- 2016-07-29 CN CN201610614088.5A patent/CN107665349B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103217280A (en) * | 2013-03-18 | 2013-07-24 | 西安交通大学 | Multivariable support vector machine prediction method for aero-engine rotor residual life |
CN106203487A (en) * | 2016-06-30 | 2016-12-07 | 北京航空航天大学 | A kind of image classification method based on Multiple Kernel Learning Multiple Classifier Fusion and device |
Non-Patent Citations (3)
Title |
---|
A survey on multi-output regression;Hanen Borchani;《Wiley Interdisciplinary Reviews:Data Mining and Knowledge Discovery》;20151212;第1-27页 * |
基于多目标决策的数据挖掘模型选择研究;王国勋;《中国博士学位论文全文数据库 信息科技辑》;20131231;第5章 * |
王国勋.基于多目标决策的数据挖掘模型选择研究.《中国博士学位论文全文数据库 信息科技辑》.2013, * |
Also Published As
Publication number | Publication date |
---|---|
CN107665349A (en) | 2018-02-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107665349B (en) | Training method and device for multiple targets in classification model | |
US10958748B2 (en) | Resource push method and apparatus | |
CN114118640B (en) | Long-term precipitation prediction model construction method, long-term precipitation prediction method and device | |
CN105427129B (en) | Information delivery method and system | |
US10565525B2 (en) | Collaborative filtering method, apparatus, server and storage medium in combination with time factor | |
CN109376267B (en) | Method and apparatus for generating a model | |
CN112199580B (en) | Business processing method and artificial intelligence platform for cloud computing and big data positioning | |
CN114997412A (en) | A recommended method, training method and device | |
CN108121795A (en) | User's behavior prediction method and device | |
WO2019232772A1 (en) | Systems and methods for content identification | |
CN110413867B (en) | Method and system for content recommendation | |
CN112883265A (en) | Information recommendation method and device, server and computer readable storage medium | |
CN112163156A (en) | Big data processing method based on artificial intelligence and cloud computing and cloud service center | |
CN113326440A (en) | Artificial intelligence based recommendation method and device and electronic equipment | |
CN111783873A (en) | Incremental naive Bayes model-based user portrait method and device | |
CN117726884B (en) | Training method of object class identification model, object class identification method and device | |
CN114491093B (en) | Multimedia resource recommendation and object representation network generation method and device | |
CN114595367A (en) | Big data mining method based on user interest tendency and data analysis server | |
JPWO2017188048A1 (en) | Creation device, creation program, and creation method | |
CN113034168B (en) | Content item delivery method, device, computer equipment and storage medium | |
CN116579460A (en) | Information prediction method, apparatus, computer device and storage medium | |
CN115965463A (en) | Model training method and device, computer equipment and storage medium | |
CN113420227B (en) | Training method of click rate estimation model, click rate estimation method and device | |
CN117893355B (en) | Regional power simulation method, device, equipment and medium based on mobile trajectory | |
CN110503482B (en) | Article processing method, device, terminal and storage medium |
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 |