CN110852446A - Machine learning model training method, device and computer readable storage medium - Google Patents
Machine learning model training method, device and computer readable storage medium Download PDFInfo
- Publication number
- CN110852446A CN110852446A CN201911107807.4A CN201911107807A CN110852446A CN 110852446 A CN110852446 A CN 110852446A CN 201911107807 A CN201911107807 A CN 201911107807A CN 110852446 A CN110852446 A CN 110852446A
- Authority
- CN
- China
- Prior art keywords
- sample data
- target domain
- sample
- domain sample
- training
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Medical Informatics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Artificial Intelligence (AREA)
- Image Analysis (AREA)
Abstract
The application relates to a machine learning model training method, a device, a computer readable storage medium and a computer device, wherein the method comprises the following steps: acquiring source domain sample data and target domain sample data of a machine learning model to be trained; determining a distribution density ratio between target domain sample data and source domain sample data; determining source domain sample weights respectively corresponding to the source domain sample data according to the distribution density ratio; obtaining training sample data according to the source domain sample data and the target domain sample data, and determining training sample weights respectively corresponding to the training sample data according to the target domain sample weights respectively corresponding to the source domain sample data and the target domain sample data; training the training sample data according to the training sample weight, and obtaining a machine learning model after training when the training end condition is met. The scheme provided by the application can improve the performance of the machine learning model obtained by training.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a machine learning model training method and apparatus, a computer-readable storage medium, and a computer device.
Background
Transfer Learning (Transfer Learning) refers to a Learning process of applying a model learned in an old domain (i.e., a source domain) to a new domain (i.e., a target domain) using similarities between data, tasks, or models. It is simply understood that the similarity is the basis of migration, and two scenes in which migration occurs need to have certain similarity, but there is a difference at the same time, so that a model trained by using source domain data cannot be directly used for target domain prediction. Model parameters (also understood as knowledge learned by the model) which are learned in the source domain can be shared to a new model of the migration target domain through migration learning in a certain mode, and zero learning is not needed like most networks, so that the learning efficiency of the model is accelerated and optimized.
However, due to the data difference between the source domain and the target domain, the migration learning is prone to have a negative migration phenomenon, that is, the effect after migration is poor or even reduced, and the performance of the model obtained by migration is low.
Disclosure of Invention
Based on this, it is necessary to provide a machine learning model training method, apparatus, computer-readable storage medium, and computer device for solving the technical problem that negative migration is easy to occur in migration learning to affect the performance of a model obtained by migration.
A machine learning model training method, comprising:
acquiring source domain sample data and target domain sample data of a machine learning model to be trained;
determining a distribution density ratio between the target domain sample data and the source domain sample data;
determining source domain sample weights respectively corresponding to the source domain sample data according to the distribution density ratio;
obtaining training sample data according to the source domain sample data and the target domain sample data, and determining training sample weights respectively corresponding to the training sample data according to the source domain sample weight and the target domain sample weight respectively corresponding to the target domain sample data;
training the training sample data according to the training sample weight, and obtaining a machine learning model after training when the training end condition is met.
A machine learning model training apparatus, the apparatus comprising:
the sample data acquisition module is used for acquiring source domain sample data and target domain sample data of the machine learning model to be trained;
a density ratio determination module for determining a distribution density ratio between the target domain sample data and the source domain sample data;
a source domain sample weight determining module, configured to determine, according to the distribution density ratio, a source domain sample weight corresponding to each source domain sample data;
a training sample weight determining module, configured to obtain training sample data according to the source domain sample data and the target domain sample data, and determine training sample weights corresponding to the training sample data according to target domain sample weights corresponding to the source domain sample data and the target domain sample data, respectively;
and the model training module is used for training the training sample data according to the training sample weight and obtaining a trained machine learning model when the training end condition is met.
A computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of the machine learning model training method as described above.
A computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the machine learning model training method as described above.
According to the machine learning model training method, the device, the computer readable storage medium and the computer equipment, the source domain sample weight corresponding to each source domain sample data is determined according to the distribution density ratio between the target domain sample data and the source domain sample data, the training sample data is obtained according to the source domain sample data and the target domain sample data, the training sample weight corresponding to the training sample data is determined according to the target domain sample weight corresponding to the source domain sample weight and the target domain sample data, and the training sample data is trained according to the training sample weight to obtain the trained machine learning model. The influence degree of the source domain sample data in the model training is controlled through the source domain sample weight determined by the distribution density ratio between the target domain sample data and the source domain sample data, the influence of the source domain sample data on the model training can be reduced while the source domain sample data is fully utilized, so that the influence degree of the target domain sample data on the training model is highlighted, the probability of occurrence of negative migration phenomenon is reduced, and the performance of the machine learning model obtained by training is improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for training a machine learning model in one embodiment;
FIG. 2 is a schematic flow chart diagram illustrating a method for machine learning model training in one embodiment;
FIG. 3 is a schematic flow chart illustrating the determination of the distribution density ratio in one embodiment;
FIG. 4 is a schematic flow chart diagram illustrating a method for machine learning model training in one embodiment;
FIG. 5 is a block diagram showing the structure of a machine learning model training apparatus according to an embodiment;
FIG. 6 is a block diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
FIG. 1 is a diagram of an application environment of a method for training a machine learning model in an embodiment. (example: referring to FIG. 1, the machine learning model training method is applied to a transfer learning system, which includes a server 120. the server 120 can be implemented by a separate server or a server cluster composed of a plurality of servers.)
As shown in FIG. 2, in one embodiment, a machine learning model training method is provided. The embodiment is mainly illustrated by applying the method to the server 120 in fig. 1. Referring to fig. 2, the machine learning model training method specifically includes the following steps:
s202, obtaining source domain sample data and target domain sample data of the machine learning model to be trained.
The method specially solves the problem that a model trained by using source domain data cannot be directly used for target domain prediction due to the fact that certain similarity exists between two scenes but difference exists, relaxes the assumption that machine learning 'training test data obeys homologic distribution', and can train a classifier with good performance by combining a large number of labeled samples in a source domain under the condition that a small amount of data in a target domain are labeled (a classifier is not trained enough). The migration can be classified into instance-based migration learning, feature-based migration learning, model-based migration learning, and relationship-based migration learning according to the form in which the migration occurs. Example-based migration refers to that different weight training models are given to a source domain sample according to the similarity of two scenes for prediction/classification on a target domain; the feature-based transfer learning is that a source domain and a target domain are respectively mapped to a common feature subspace through feature change, and a model is established in the common subspace by using a machine learning method to complete the prediction of the target domain; the model-based transfer learning is a Fine-Tune technology which assumes that a source domain and a target domain can share some model parameters, initializes a target domain model with the source domain parameters or performs certain limitation on the target domain parameters, such as deep learning.
In migration learning, a Domain (Domain) is composed of data and a probability distribution for generating the data, and generally D represents a Domain and P represents a probability distribution. In particular, there are two basic areas: source Domain (Source Domain) and Target Domain (Target Domain). The source domain is the object to be migrated, and there is generally a sufficient sample of labels; the target domain is the object that is ultimately desired (given the tag information). The migration learning completes the migration of knowledge from the source domain to the target domain. The learning target in the migration learning is Task (Task), which is composed of a label and a function. According to the existence or non-existence of labels of the source domain and the target domain, the method can be divided into inductive migration, direct push migration and unsupervised migration. The embodiment is based on the machine learning model training of the transfer learning.
The machine learning model to be trained is a model to be trained, and specifically may be a machine learning model obtained by migration in migration learning, such as a classifier. The source domain sample data is sample data in a source domain migrated in the migration learning, and the target domain sample data is sample data in a target domain. Generally, the data volume of the source domain sample data is sufficient, and a model corresponding to the source domain can be trained, while the data volume of the target domain sample data with a label in the target domain sample data is small, and is not enough to be directly used for model training to a machine learning model, so that the required machine learning model needs to be obtained by performing migration training from the source domain based on the migration learning. In specific application, source domain sample data and target domain sample data can be acquired from corresponding fields.
S204, determining the distribution density ratio between the target domain sample data and the source domain sample data.
The distribution density ratio is the edge distribution ratio of the target domain and the source domain in the migration learning, and the edge distribution is the probability distribution of partial variables in the multidimensional random variables. The difference between the target domain and the source domain is mainly reflected in that the data distribution is different, including the edge distribution and the condition distribution, and the difference between the two types of distributions affects the performance of the final model on the target domain.
The distribution density ratio can be expressed asWherein β is the distribution density ratio, XtRepresenting target domain sample data, XsRepresenting source domain sample data, P (X)t) For edge distribution of target domain sample data, P (X)s) For the edge distribution of the source domain sample data, the ratio of the two reflects the difference of the prior distribution of the target domain and the source domain. There are many density ratio estimation methods for determining the distribution density ratio, and they can be roughly classified into two categories: direct estimation and indirect estimation, indirect estimation requiringThe edge distribution of a source domain and a target is calculated respectively, and then a ratio is calculated, so that the calculation amount is large, and the process is complex; the direct estimation refers to directly estimating the ratio of the two without calculating the edge distribution.
And S206, determining the source domain sample weight corresponding to each source domain sample data according to the distribution density ratio.
The contribution of labeled samples in a source domain and a target domain to a model is possibly different, the importance of each sample in the source domain and the target domain is also different, the weight of the sample in the source domain represents the influence degree of sample data in each source domain on a machine learning model to be trained, the larger the weight of the sample in the source domain is, the larger the influence of the sample data in the corresponding source domain on the machine learning model to be trained is, the probability of occurrence of negative migration can be reduced and the performance of the machine learning model obtained by training can be improved by reasonably utilizing the sample data in the source domain and the target domain.
In this embodiment, after obtaining the distribution density ratio between the target domain sample data and the source domain sample data, the source domain sample weights corresponding to the source domain sample data respectively are determined according to the distribution density ratio, and specifically, the distribution density ratio may be normalized and then used as the source domain sample weights corresponding to the source domain sample data respectively.
S208, obtaining training sample data according to the source domain sample data and the target domain sample data, and determining training sample weights respectively corresponding to the training sample data according to the target domain sample weights respectively corresponding to the source domain sample data and the target domain sample data.
The training sample data is training data of a machine learning model to be trained, and can be obtained according to source domain sample data and target domain sample data, for example, the source domain sample data and the target domain sample data with a label in the target domain sample data can be combined to be used as the training sample data. After the training sample data is obtained, determining the weight of the training sample according to the corresponding weight of the source domain sample data in the training sample data; and determining the weight of the training sample according to the target domain sample data in the training sample data respectively corresponding to the target domain sample weights.
And S210, training the training sample data according to the training sample weight, and obtaining a machine learning model after training when the training end condition is met.
And after the training sample data and the training sample weight corresponding to each training sample data are determined, performing model training on the training sample data according to the training sample weight, and finishing the training when the training finishing condition is met, such as the training times reaches a time threshold or the training output meets an accuracy condition, so as to obtain a trained machine learning model. When the model is trained, corresponding training sample weights are set for each training sample data, and each training sample weight directly influences model parameters of the machine learning model, so that the performance of the machine learning model obtained through training is influenced. The data distribution difference between the source domain and the target domain is a main reason for causing performance degradation of a source domain model on the target domain, for example, prediction accuracy of a prediction model is reduced, the influence degree of source domain sample data in model training is controlled through the source domain sample weight determined by the distribution density ratio between the target domain sample data and the source domain sample data, the influence of the source domain sample data on model training can be reduced while the source domain sample data is fully utilized, so that the influence degree of the target domain sample data on the training model is highlighted, the negative migration phenomenon is relieved, and the performance of the machine learning model obtained by training is improved.
According to the machine learning model training method, the source domain sample weight corresponding to each source domain sample data is determined according to the distribution density ratio between the target domain sample data and the source domain sample data, the training sample data is obtained according to the source domain sample data and the target domain sample data, the training sample weight corresponding to the training sample data is determined according to the source domain sample weight and the target domain sample weight corresponding to the target domain sample data, and then the training sample data is trained according to the training sample weight to obtain the trained machine learning model. The influence degree of the source domain sample data in the model training is controlled through the source domain sample weight determined by the distribution density ratio between the target sample data and the source domain sample data, the influence of the source domain sample data on the model training can be reduced while the source domain sample data is fully utilized, so that the influence degree of the target domain sample data on the training model is highlighted, the probability of occurrence of negative migration phenomenon is reduced, and the performance of the machine learning model obtained by training is improved.
In one embodiment, as shown in fig. 3, the process of determining a distribution density ratio, i.e. determining a distribution density ratio between target domain sample data and source domain sample data, comprises:
s302, carrying out data standardization processing on the source domain sample data and the target domain sample data to obtain a source domain standardized sample corresponding to the source domain sample data and a target domain standardized sample corresponding to the target domain sample data.
In this embodiment, when the feature dimensions of the source domain sample data and the target domain sample data are high, the dimension reduction processing is performed, and the distribution density ratio between the target domain sample data and the source domain sample data is directly estimated by a density ratio estimation algorithm. Specifically, when the distribution density ratio is determined, data standardization processing is performed on the source domain sample data and the target domain sample data, for example, data standardization processing may be performed on the source domain sample data and the target domain sample data by a z-score zero-mean normalization method, so as to obtain a source domain standardized sample corresponding to the source domain sample data and a target domain standardized sample corresponding to the target domain sample data. After the data standardization processing is performed on the source domain sample data and the target domain sample data, the data ranges of the obtained source domain standardized sample and the target domain standardized sample can be mapped to a relative interval range, so that the subsequent processing can be performed.
S304, when the characteristic dimension of the source domain sample data and the characteristic dimension of the target domain sample data are larger than a preset dimension threshold value, respectively performing dimension reduction on the source domain standardized sample and the target domain standardized sample to obtain a source domain standardized sample after dimension reduction and a target domain standardized sample after dimension reduction.
And determining the characteristic dimensions of the source domain sample data and the target domain sample data, wherein the characteristic dimensions of the source domain sample data and the target domain sample data in the transfer learning are the same. When the characteristic dimensions of the source domain sample data and the target domain sample data are larger than a preset dimension threshold value, the characteristic dimensions of the source domain sample data and the target domain sample data are higher, along with the increase of the characteristic dimensions, the number of samples required by density ratio estimation is exponentially increased, namely, dimension disaster, and the number of estimated samples is limited when the density ratio estimation is directly carried out through a density ratio estimation algorithm, so that the estimation accuracy is limited. The dimension threshold value may be determined according to actual requirements, for example, may be set according to the accuracy of the distribution density ratio determined by the density ratio estimation algorithm. When the feature dimensions of the source domain sample data and the target domain sample data are greater than a preset dimension threshold, respectively performing dimension reduction processing on the source domain standardized sample and the target domain standardized sample, for example, performing dimension reduction processing on the source domain standardized sample and the target domain standardized sample respectively through LFDA (Local Fisher linear discriminant analysis), mapping high-dimensional features to a low-dimensional space, and obtaining the source domain standardized sample after dimension reduction and the target domain standardized sample after dimension reduction, thereby ensuring the accuracy of directly performing distribution density ratio estimation through a density ratio estimation algorithm.
S306, determining the dimension reduction distribution density ratio between the dimension reduced target domain standardized sample and the dimension reduced source domain standardized sample through a density ratio estimation algorithm, and taking the dimension reduction distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
And performing density ratio estimation on the reduced-dimension target domain standardized sample and the reduced-dimension source domain standardized sample through a density ratio estimation algorithm to obtain a reduced-dimension distribution density ratio between the reduced-dimension target domain standardized sample and the reduced-dimension source domain standardized sample, and taking the reduced-dimension distribution density ratio as a distribution density ratio between the target domain sample data and the source domain sample data.
In specific implementation, the density ratio estimation algorithm may adopt a uLSIF (Unconstrained Least squares importance Fitting) algorithm, the uLSIF needs to calculate edge distributions of a source domain and a target domain respectively, and directly estimate a two-distribution ratio, so that the calculation amount is greatly reduced, and meanwhile, a more accurate estimation value can be given. The usfif approximates the density ratio by linear weighting of a set of gaussian kernels, as shown in equation (1) below,
the method comprises the steps of β (x) representing the density ratio estimation result of uLSIF, x representing a variable for density ratio estimation, b representing the number of Gaussian kernels which can be randomly specified and generally selected to be 100, a representing a weighting coefficient, K representing a Gaussian kernel function, c representing a parameter of the Gaussian kernel function, and sigma representing the width of the Gaussian kernel, wherein the K-fold-cross validation theorem can effectively avoid the influence of randomness when a training set and a test set are divided on an evaluation result, specifically, the sample data is randomly divided into K parts during K-fold-cross validation processing, K-1 parts are randomly selected as the training set each time, the rest 1 parts are used as the test set, after one round of training is completed, K-1 parts are randomly selected to train data, after a plurality of rounds (less than K), a model and a parameter with optimal loss function evaluation are selected, the average value of error rates of the K models on respective validation sets is used as the evaluation result of a classifier, K is more than 3, and the distribution of the LSIF density of the sample data can be accurately determined by the distribution of a normalized source density reduction domain and a normalized sample data reduction domain.
In one embodiment, the data normalization processing of the source domain sample data and the target domain sample data to obtain a source domain normalized sample corresponding to the source domain sample data and a target domain normalized sample corresponding to the target domain sample data includes: determining a mean value and a standard deviation of source domain sample data; taking source domain sample data and target domain sample data as data to be standardized, and determining a data difference between the data to be standardized and the mean value; determining the ratio of the data difference to the standard difference, and taking the ratio as a standardized sample corresponding to the data to be standardized; the normalized samples include a source domain normalized sample corresponding to the source domain sample data and a target domain normalized sample corresponding to the target domain sample data.
In this embodiment, data normalization processing is performed on source domain sample data and target domain sample data by a z-score zero-mean normalization method. Specifically, the mean and the standard deviation of the source domain sample data are determined, and the mean and the standard deviation can be obtained by performing statistical processing on the source domain sample data. The method comprises the steps of taking source domain sample data and target domain sample data as data to be standardized, determining a data difference between the data to be standardized and a mean value, and specifically subtracting the mean value of the source domain sample data from the mean value of the target domain sample data to obtain the data difference. And determining a ratio of the data difference to the standard difference, and taking the ratio as a standardized sample corresponding to the data to be standardized, wherein the standardized sample comprises a source domain standardized sample corresponding to the source domain sample data and a target domain standardized sample corresponding to the target domain sample data, so that the data standardization processing of the source domain sample data and the target domain sample data is realized.
In one embodiment, the data normalization process is expressed asWherein x is a normalized sample, the mean value is 0, and the variance is 1; x is the sample data of the source domain,is the mean value of the source domain sample data, and σ is the standard deviation of the source domain sample data.
In one embodiment, when the characteristic dimensions of the source domain sample data and the target domain sample data are greater than a preset dimension threshold, performing dimension reduction on the source domain normalized sample and the target domain normalized sample respectively, and obtaining the dimension-reduced source domain normalized sample and the dimension-reduced target domain normalized sample includes: determining an unlabeled target domain standardized sample from the target domain standardized samples, wherein the unlabeled target domain standardized sample is obtained by carrying out data standardization processing on unlabeled target domain sample data in the target domain sample data; determining the characteristic dimensions of source domain sample data and target domain sample data; and when the characteristic dimension is larger than a preset dimension threshold value, respectively carrying out dimension reduction treatment on the source domain standardized sample and the unlabeled target domain standardized sample to obtain a source domain standardized sample after dimension reduction and an unlabeled target domain standardized sample after dimension reduction, and taking the unlabeled target domain standardized sample after dimension reduction as a target domain standardized sample after dimension reduction.
In this embodiment, considering that the number of samples with labels in the target domain is small, the labels are very precious, and the existing label training model should be reasonably utilized, the density ratio estimation processing is performed by using the standard samples of the source domain and the standard samples of the target domain without labels in the standard samples of the target domain. And the non-labeled target domain standard sample is obtained by carrying out data standardization processing on the non-labeled target domain sample data in the target domain sample data.
Specifically, after a source domain standardized sample corresponding to the source domain sample data and a target domain standardized sample corresponding to the target domain sample data are obtained, an unlabeled target domain standardized sample is determined from the target domain standardized sample, and the unlabeled target domain standardized sample is obtained by performing data standardization processing on the unlabeled target domain sample data in the target domain sample data. Generally, the target domain sample data in the target domain includes a large amount of unlabeled target domain sample data and a small amount of labeled target domain sample data, and in this example, the distribution density ratio estimation is performed by the unlabeled target domain sample data. And determining the characteristic dimensions of the source domain sample data and the target domain sample data, wherein the characteristic dimensions can be determined according to the data characteristics of the source domain sample data and the target domain sample data.
And inquiring a preset dimension threshold, wherein the dimension threshold is preset according to actual requirements. And comparing the characteristic dimension and the dimension threshold of the source domain sample data and the target domain sample data, respectively performing dimension reduction on the source domain standardized sample and the unlabeled target domain standardized sample if the characteristic dimension is greater than the preset dimension threshold to obtain a source domain standardized sample after dimension reduction and an unlabeled target domain standardized sample after dimension reduction, and taking the unlabeled target domain standardized sample after dimension reduction as a target domain standardized sample after dimension reduction. Therefore, the high-dimensional source domain standardized sample and the unlabeled target domain standardized sample are subjected to dimension reduction processing to ensure the accuracy of the density ratio estimation processing.
In one embodiment, further comprising: and when the characteristic dimension is not larger than the dimension threshold value, determining a low-dimensional distribution density ratio between the label-free target domain standardized sample and the source domain standardized sample through a density ratio estimation algorithm, and taking the low-dimensional distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
In this embodiment, when the feature dimensions of the source domain sample data and the target domain sample data are not greater than the dimension threshold, it is indicated that the sample features of the source domain sample data and the target domain sample data are in a low-dimensional space, and the density ratio estimation processing may be directly performed through a density ratio estimation algorithm. Specifically, when the characteristic dimension is not greater than the dimension threshold, a low-dimensional distribution density ratio between the unlabeled target domain standardized sample and the source domain standardized sample is determined through a density ratio estimation algorithm, and the low-dimensional distribution density ratio can be used as a distribution density ratio between target domain sample data and source domain sample data, so that the distribution density ratio between the target domain sample data and the source domain sample data is accurately determined.
In one embodiment, determining the source domain sample weight corresponding to each source domain sample data according to the distribution density ratio includes: and carrying out normalization processing on the distribution density ratio to obtain source domain sample weights respectively corresponding to the source domain sample data.
And respectively giving different weights to the source domain samples according to the difference of the data distribution of the source domain and the target domain. If the LR classifier is used, assuming that the conditional probabilities of the source domain and the target domain are equal, the method has the formula (2),
wherein the content of the first and second substances,for classifier parameters, P (X)t) For edge distribution of target domain sample data, P (X)s) For edge distribution of source domain sample data, NsIs the data size of the source domain sample data. As can be seen from the equation (2), when the weight of the source domain sample takes the two distribution ratios, the classifier trained by the source domain sample can replace the target domain sample for modeling, i.e., the model migration is realized.
In this embodiment, the distribution density ratio is normalized and used as the source domain sample weight corresponding to each source domain sample data. Specifically, when the source domain sample weight corresponding to each source domain sample data is determined according to the distribution density ratio, normalization processing is performed on the obtained distribution density ratio to obtain the source domain sample weight corresponding to each source domain sample data, and the value of the source domain sample weight is within the range of [0,1 ].
In one embodiment, obtaining training sample data from source domain sample data and target domain sample data comprises: extracting target domain sample data with labels from the target domain sample data; and taking the source domain sample data and the target domain sample data with the label as training sample data.
In this embodiment, training sample data used for model training is obtained according to the source domain sample data and the target domain sample data with the label in the target domain sample data. Specifically, when training sample data is obtained according to source domain sample data and target domain sample data, the target domain sample data with the label is extracted from the target domain sample data, and the data size of the target domain sample data with the label is generally small, which is not enough to support a single training model and has high value for model training. Training sample data is obtained according to the target domain sample data with the label and the source domain sample data, specifically, the source domain sample data and the target domain sample data with the label can be directly used as the training sample data, model training is carried out based on the training sample data, and a needed machine learning model can be obtained.
In one embodiment, further comprising: determining the sample number of the target domain sample data with the label in the target domain sample data; and when the number of samples is greater than a preset sample number threshold value, determining the target domain sample weight corresponding to the target domain sample data with the label through an iterative algorithm.
In this embodiment, before determining the training sample weights corresponding to the training sample data, the target domain sample weights corresponding to the target domain sample data with labels in the training sample data are determined, and the target domain sample weights represent the degree of influence of the corresponding target domain sample data on the model when the model training is performed on the corresponding target domain sample data. Specifically, the number of samples of the labeled target domain sample data in the target domain sample data is determined, the labeled target domain sample data may be obtained through statistics, the number of samples is compared with a preset sample number threshold, the sample number threshold T may be flexibly set, for example, if T is 100, when the number of samples is greater than the preset sample number threshold, the target domain sample weights respectively corresponding to the labeled target domain sample data are determined through an iterative algorithm, and the target domain sample weights respectively corresponding to the labeled target domain sample data may be determined through an Adaboost algorithm. The Adaboost algorithm is an iterative algorithm, and the core idea is to train different classifiers (weak classifiers) aiming at the same training set, and then to assemble the weak classifiers to form a stronger final classifier (strong classifier). Iterative processing is performed through an Adaboost algorithm, and target domain sample weights corresponding to the target domain sample data with the labels respectively can be determined.
In one embodiment, determining, by an iterative algorithm, a target domain sample weight corresponding to each labeled target domain sample data includes: determining initialization weights respectively corresponding to the target domain sample data with the labels, and taking the initialization weights as current weights; training the labeled target domain sample data according to the current weight, and determining a weight updating coefficient according to the error in the training process; updating the current weight through the weight updating coefficient to obtain an updated weight; and determining the training times, and determining the target domain sample weight corresponding to the target domain sample data with the label according to the updated weight when the training times reach a preset iteration threshold.
In this embodiment, iteration processing is performed by using an Adaboost algorithm to determine target domain sample weights respectively corresponding to the target domain sample data with each label. Specifically, when determining the target domain sample weight corresponding to each labeled target domain sample data, determining the initialization weight corresponding to each labeled target domain sample data, and taking the initialization weight as the current weight. The initialization weight may be preset, for example, the initialization weight is set to be a normalized weight, and the initialization weight is used as the current weight, that is, the weight during current training. Training the labeled target domain sample data according to the current weight, specifically training a classifier, such as an LR classifier, and determining a weight update coefficient according to an error in the training process. Specifically, the output result of the trained LR classifier and the corresponding input label may be obtained, the error of the current training may be determined according to the label and the output result, and the weight update coefficient may be calculated according to the error. And after the weight updating coefficient is obtained, updating the current weight through the weight updating coefficient to obtain an updating weight, determining the training times, and when the training times reach a preset iteration threshold value and indicate that the training times reach requirements, determining the target domain sample weight respectively corresponding to the target domain sample data with the labels according to the updating weight, or taking the updated weight after normalization processing as the target domain sample weight respectively corresponding to the target domain sample data with the labels. In addition, when the training times do not reach the iteration threshold, the target domain sample data with the labels is trained according to the current weight, and the weight updating coefficient is determined according to the error in the training process so as to carry out the next iteration training processing.
In one particular application, the tagged target domain sample data constitutes a tagged data set NtThe data size of the data is the target domain with the label. When the target domain sample weight corresponding to the target domain sample data with the label is determined, the weight is initialized, and each sample of the target domain is set to be equal in weight, namelyNormalized weightAs whenThe top weight. Training an LR classifier according to the current weight and the current weight, classifying the target domain samples, and setting the output result of the classifier as ht(xi) The label is c (x)i) Calculating the error in the target domainDetermining a weight update coefficient βt=εt/(1-εt) Updating the current weight according to the weight update coefficient to obtain an updated weightAnd judging the training times, if the training times are smaller than a preset iteration threshold value N, returning to execute LR classifier training according to the current weight and the current weight according to the updated weight as the current weight, performing next training iteration, and when the training times reach N, performing normalization processing on the updated weight of the last training to be used as the corresponding target domain sample weight of the target domain sample data with the labels.
In one embodiment, further comprising: and when the number of samples is not greater than the threshold value of the number of samples, determining that the target domain sample data with the labels respectively correspond to the same target domain sample weight.
In this embodiment, when the sample number of the labeled target domain sample data in the target domain sample data does not satisfy the sample number threshold of the training iteration, the target domain sample weight corresponding to each labeled target domain sample data is directly determined. Specifically, when the number of samples is not greater than the sample number threshold, the target domain sample weights respectively corresponding to the target domain sample data with the labels are set to be equal weights, that is, the target domain sample weights respectively corresponding to the target domain sample data with the labels are the same. Such as to be provided withαiTarget domain sample weight corresponding to ith labeled target domain sample data, NtAnd sampling the total data size of the data for the tagged target domain.
In one embodiment, determining the training sample weights corresponding to the training sample data according to the target domain sample weights corresponding to the source domain sample data and the target domain sample data respectively comprises: determining a source domain weight balance factor corresponding to source domain sample data and a target domain weight balance factor corresponding to target domain sample data; obtaining the source domain sample weight of the source domain sample data in the training sample data according to the product of the source domain weight balance factor and the source domain sample weight; obtaining the target domain sample weight of target domain sample data in the training sample data according to the product of the target domain weight balance factor and the target domain sample weight; the training sample weights include source domain sample weights and target domain sample weights.
In this embodiment, balance factors are set for the source domain and the target domain, and further, the source domain sample weight corresponding to each source domain sample data in the training sample data and the target domain sample weight corresponding to each target domain sample data are adjusted.
Specifically, when the training sample weights corresponding to the training sample data are determined, a source domain weight balance factor corresponding to the source domain sample data and a target domain weight balance factor corresponding to the target domain sample data are determined. The balance factor is used for adjusting the overall influence degree of all data in the source domain and all data in the target domain on the model training. The sum of the source domain weight balance factor and the target domain weight balance factor is 1, and the respective values can be set according to requirements, if the values can be set to be equal, the difference between source domain sample data and target domain sample data can also be adjusted. If the difference between the source domain sample data and the target domain sample data is large, reducing the contribution of the source domain sample data to the model, namely reducing a source domain weight balance factor; when the difference between the source domain sample data and the target domain sample data is small, the source domain contribution can be increased, namely, the source domain weight balance factor is increased, so that the label information in the source domain is utilized to a large extent.
And obtaining the source domain sample weight of the source domain sample data in the training sample data according to the product of the source domain weight balance factor and the source domain sample weight, and obtaining the target domain sample weight of the target domain sample data in the training sample data according to the product of the target domain weight balance factor and the target domain sample weight, thereby determining the weights corresponding to the source domain sample data and the target domain sample data in the training sample data respectively. The training sample weights include source domain sample weights and target domain sample weights. Specifically, for source domain sample data in the training sample data, it corresponds to a source domain sample weight; and training target domain sample data in the sample data, wherein the target domain sample data corresponds to the target domain sample weight.
In a specific application, considering that the source domain and the target domain have different label samples possibly contributing to the model and the source domain and the target domain have different importance of each sample, different weights are respectively given to the source domain and the target domain samples, and a balance factor is set to control the influence of the source domain and the target domain data on the model as a whole, so that the purposes of reasonably utilizing the label of the sample in the source domain and the target domain and reducing the probability of occurrence of negative migration are achieved. Wherein, the trained model is a classifier, the classifier uses logistic regression, and then the formula (3) is shown,
wherein the content of the first and second substances,as classifier parameters, αi,βiRespectively representing the weight of the ith sample, λ, in the target domain and the source domaint,λsRespectively a target domain balance factor and a source domain balance factor, for respectively representing the degree of contribution of the target domain and the source domain to the model, and lambdas+λtγ denotes a regularization coefficient, and θ denotes a model coefficient of a logistic regression model.
In one embodiment, a machine learning model training method is provided, which is applied to default probability prediction in a financial wind control scene, and can predict user default probability in scene a, and if the business of scene a is in an online initial stage, the number of labeled samples in scene a is small, and a large number of unlabeled samples exist. However, if another scene B similar to the scene a exists, a large number of labeled samples in the scene B can be collected, training sample data is constructed based on a large number of unlabeled samples in the scene a, a small number of labeled samples in the scene a and a large number of labeled samples in the scene B, the training sample weight of each training sample data is determined, the training sample data is trained according to the training sample weight, and a machine learning model capable of effectively predicting default probability in the scene a is obtained.
Specifically, the source domain sample data carries tags, and the data set formed by the source domain sample data isThe target domain sample data comprises a data set consisting of target domain sample data with labelsData set composed of object domain sample data without labelWherein N issIs the data size, N, of the source domain sample datatData size, N, of sample data for a tagged target domaint,uFor the data size of the target domain sample data without the tag, the data size of the source domain sample data and the target domain sample data without the tag is generally larger, and the data size of the target domain sample data with the tag is smaller.
And performing data standardization processing on all data, namely the source domain sample data and the target domain sample data, by a z-score zero-mean normalization method. When the characteristic dimensions of the source domain sample data and the target domain sample data are high, performing LFDA algorithm on the source domain data set DsAnd a target domain unlabeled dataset Dt,uPerforming dimensionality reduction, performing density ratio estimation on the dimensionality reduced data through a uLSIF algorithm, and calculating the distribution density ratio of two-domain edge distributionNormalizing the obtained distribution density ratio weight to obtain source domain sample weights respectively corresponding to the source domain sample data
Tagged dataset for target domain Dt,lJudgment of NtIf it is greater than a threshold T (e.g., 100), if N istWhen the sample weight is larger than the threshold value T, the Adaboost algorithm is used for determining the target domain sample weight corresponding to each target domain sample data, and specifically, the sample weight of the base classifier trained for the last time by the Adaboost algorithm can be used as the target domain sample weight after normalization processing, namely, the target domain sample weightAs a target domain sample contribution; if N is presenttLess than the threshold T, the samples in the target domain are set to be equal in weight, i.e.Specifically, when the target domain sample weight corresponding to the target domain sample data with the label is determined, the weight is initialized, and each sample of the target domain is set to be equal in weight, namelyNormalized weightAs the current weight. Training an LR classifier according to the current weight and the current weight, classifying the target domain samples, and setting the output result of the classifier as ht(xi) The label is c (x)i) Calculating the error in the target domain Determining a weight update coefficient βt=εt/(1-εt) Updating the current weight according to the weight update coefficient to obtain an updated weightJudging the number of training times, if the number of training times is less than the pre-training numberAnd setting an iteration threshold value N, returning to execute LR classifier training according to the current weight and the current weight by taking the updated weight as the current weight, performing next training iteration, and when the training times reach N, performing normalization processing on the updated weight of the last training to be used as the corresponding target domain sample weight of the target domain sample data with the labels respectively. Determining a target domain balance factor λtAnd source domain balance factor lambdas。
α will be mixedi,βiAnd λt,λsAnd multiplying the two samples respectively, determining the weight of a final training sample, and finally using a source domain and a target domain labeled sample co-training LR classifier for target domain prediction, namely for effective default probability prediction of a scene A.
In one embodiment, as shown in fig. 4, there is provided a machine learning model training method, including:
s402, obtaining source domain sample data and target domain sample data of a machine learning model to be trained;
s404, determining a mean value and a standard deviation of the source domain sample data;
s406, taking the source domain sample data and the target domain sample data as data to be standardized, and determining the data difference between the data to be standardized and the average value;
s408, determining the ratio of the data difference to the standard difference, and taking the ratio as a standardized sample corresponding to the data to be standardized; the standardized samples comprise a source domain standardized sample corresponding to the source domain sample data and a target domain standardized sample corresponding to the target domain sample data;
s410, determining an unlabeled target domain standardized sample from the target domain standardized samples, wherein the unlabeled target domain standardized sample is obtained by carrying out data standardization processing on unlabeled target domain sample data in the target domain sample data;
s412, determining the characteristic dimensions of the source domain sample data and the target domain sample data;
s414, when the characteristic dimension is larger than the preset dimension threshold value, respectively performing dimension reduction on the source domain standardized sample and the unlabeled target domain standardized sample to obtain a source domain standardized sample after dimension reduction and an unlabeled target domain standardized sample after dimension reduction, and taking the unlabeled target domain standardized sample after dimension reduction as a target domain standardized sample after dimension reduction;
s416, determining a dimension reduction distribution density ratio between the dimension reduced target domain standardized sample and the dimension reduced source domain standardized sample through a density ratio estimation algorithm, and taking the dimension reduction distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data;
s418, carrying out normalization processing on the distribution density ratio to obtain source domain sample weights respectively corresponding to the source domain sample data;
s420, extracting the target domain sample data with the label from the target domain sample data;
s422, taking the source domain sample data and the target domain sample data with the label as training sample data;
s424, determining a source domain weight balance factor corresponding to the source domain sample data and a target domain weight balance factor corresponding to the target domain sample data;
s426, obtaining the source domain sample weight of the source domain sample data in the training sample data according to the product of the source domain weight balance factor and the source domain sample weight;
s428, obtaining the target domain sample weight of the target domain sample data in the training sample data according to the product of the target domain weight balance factor and the target domain sample weight; the training sample weight comprises a source domain sample weight and a target domain sample weight;
and S430, training the training sample data according to the training sample weight, and obtaining the machine learning model after training when the training end condition is met.
In addition, the method also comprises the processing of determining the weight of the target domain sample, and specifically comprises the following steps: determining the sample number of the target domain sample data with the label in the target domain sample data; when the number of samples is larger than a preset sample number threshold value, determining initialization weights respectively corresponding to the target domain sample data with the labels, and taking the initialization weights as current weights; training the labeled target domain sample data according to the current weight, and determining a weight updating coefficient according to the error in the training process; updating the current weight through the weight updating coefficient to obtain an updated weight; and determining the training times, and determining the target domain sample weight corresponding to the target domain sample data with the label according to the updated weight when the training times reach a preset iteration threshold. And when the number of samples is not greater than the threshold value of the number of samples, determining that the target domain sample data respectively corresponding to the target domain sample data with the labels have the same weight.
FIG. 4 is a flowchart illustrating a method for training a machine learning model according to one embodiment. It should be understood that, although the steps in the flowchart of fig. 4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
As shown in FIG. 5, in one embodiment, there is provided a machine learning model training apparatus 500, comprising:
a sample data obtaining module 502, configured to obtain source domain sample data and target domain sample data of a machine learning model to be trained;
a density ratio determining module 504, configured to determine a distribution density ratio between the target domain sample data and the source domain sample data;
a source domain sample weight determining module 506, configured to determine, according to the distribution density ratio, source domain sample weights corresponding to the source domain sample data respectively;
a training sample weight determining module 508, configured to obtain training sample data according to the source domain sample data and the target domain sample data, and determine training sample weights corresponding to the training sample data according to target domain sample weights corresponding to the source domain sample weight and the target domain sample weight, respectively;
and the model training module 510 is configured to train training sample data according to the training sample weight, and when a training end condition is met, obtain a trained machine learning model.
In one embodiment, the density ratio determination module 504 includes a normalization processing module, a sample dimension reduction processing module, and a density ratio estimation processing module; wherein: the standardization processing module is used for carrying out data standardization processing on the source domain sample data and the target domain sample data to obtain a source domain standardization sample corresponding to the source domain sample data and a target domain standardization sample corresponding to the target domain sample data; the sample dimension reduction processing module is used for respectively carrying out dimension reduction processing on the source domain standardized sample and the target domain standardized sample when the characteristic dimension of the source domain sample data and the target domain sample data is larger than a preset dimension threshold value to obtain a source domain standardized sample after dimension reduction and a target domain standardized sample after dimension reduction; and the density ratio estimation processing module is used for determining the dimension reduction distribution density ratio between the dimension reduced target domain standardized sample and the dimension reduced source domain standardized sample through a density ratio estimation algorithm, and taking the dimension reduction distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
In one embodiment, the normalization processing module includes a normalization parameter determination module, a data difference determination module, and a ratio determination module; wherein: the standardized parameter determination module is used for determining the mean value and the standard deviation of the source domain sample data; the data difference determining module is used for taking the source domain sample data and the target domain sample data as data to be standardized and determining the data difference between the data to be standardized and the average value; the ratio determining module is used for determining the ratio of the data difference to the standard difference and taking the ratio as a standardized sample corresponding to the data to be standardized; the normalized samples include a source domain normalized sample corresponding to the source domain sample data and a target domain normalized sample corresponding to the target domain sample data.
In one embodiment, the sample dimension reduction processing module comprises a label-free sample extraction module, a characteristic dimension determination module and a dimension reduction processing module; wherein: the label-free sample extraction module is used for determining a label-free target domain standardized sample from the target domain standardized samples, and the label-free target domain standardized sample is obtained by carrying out data standardization processing on the label-free target domain sample data in the target domain sample data; the characteristic dimension determining module is used for determining the characteristic dimensions of the source domain sample data and the target domain sample data; and the dimension reduction processing module is used for respectively carrying out dimension reduction processing on the source domain standardized sample and the unlabeled target domain standardized sample when the characteristic dimension is larger than a preset dimension threshold value to obtain a source domain standardized sample after dimension reduction and an unlabeled target domain standardized sample after dimension reduction, and taking the unlabeled target domain standardized sample after dimension reduction as the target domain standardized sample after dimension reduction.
In one embodiment, the system further comprises a density ratio direct estimation module for determining a low-dimensional distribution density ratio between the unlabeled target domain normalized sample and the source domain normalized sample by a density ratio estimation algorithm when the feature dimension is not greater than the dimension threshold, and using the low-dimensional distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
In an embodiment, the source domain sample weight determining module 506 includes a normalization processing module, configured to perform normalization processing on the distribution density ratio to obtain source domain sample weights corresponding to the source domain sample data respectively.
In one embodiment, the training sample weight determination module 508 includes a label sample extraction module and a training sample determination module; wherein: the tag sample extraction module is used for extracting the target domain sample data with tags from the target domain sample data; and the training sample determining module is used for taking the source domain sample data and the target domain sample data with the label as training sample data.
In one embodiment, the device further comprises a sample number determination module and an iterative algorithm processing module; wherein: the sample number determining module is used for determining the sample number of the target domain sample data with the label in the target domain sample data; and the iterative algorithm processing module is used for determining the target domain sample weight corresponding to each labeled target domain sample data through an iterative algorithm when the number of samples is greater than a preset sample number threshold.
In one embodiment, the iterative algorithm processing module comprises a current weight determination module, an update coefficient determination module, an update weight module and an iteration end module; wherein: the current weight determining module is used for determining the initialization weight corresponding to each target domain sample data with the label and taking the initialization weight as the current weight; the updating coefficient determining module is used for training the labeled target domain sample data according to the current weight and determining a weight updating coefficient according to the error in the training process; the updating weight module is used for updating the current weight through the weight updating coefficient to obtain an updating weight; and the iteration ending module is used for determining the training times, and determining the target domain sample weight corresponding to each labeled target domain sample data according to the updated weight when the training times reach a preset iteration threshold.
In one embodiment, the system further includes an equal weight setting module, configured to determine that, when the number of samples is not greater than the sample number threshold, the weights of the target domain samples respectively corresponding to the labeled target domain sample data are the same.
In one embodiment, the training sample weight determination module 508 includes a balance factor determination module, a source domain balance factor processing module, and a target domain balance factor processing module; wherein: the balance factor determining module is used for determining a source domain weight balance factor corresponding to the source domain sample data and a target domain weight balance factor corresponding to the target domain sample data; the source domain balance factor processing module is used for obtaining the source domain sample weight of the source domain sample data in the training sample data according to the product of the source domain weight balance factor and the source domain sample weight; the target domain balance factor processing module is used for obtaining the target domain sample weight of the target domain sample data in the training sample data according to the product of the target domain weight balance factor and the target domain sample weight; the training sample weights include source domain sample weights and target domain sample weights.
FIG. 6 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may be specifically the server 120 in fig. 1. As shown in fig. 6, the computer device includes a processor, a memory, a network interface connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement a machine learning model training method. The internal memory may also have stored therein a computer program that, when executed by the processor, causes the processor to perform a machine learning model training method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the machine learning model training apparatus provided herein may be implemented in the form of a computer program that is executable on a computer device such as that shown in fig. 6. The memory of the computer device may store various program modules constituting the machine learning model training apparatus, such as the sample data obtaining module 502, the density ratio determining module 504, the source domain sample weight determining module 506, and the training sample weight determining module 508 shown in fig. 5. The program modules constitute computer programs that cause the processors to execute the steps of the machine learning model training methods of the embodiments of the present application described in the present specification.
For example, the computer device shown in fig. 6 may perform the acquisition of the source domain sample data and the target domain sample data of the machine learning model to be trained through the sample data acquisition module 502 in the machine learning model training apparatus shown in fig. 5. The determination of the distribution density ratio between target domain sample data and source domain sample data may be performed by the computer device via the density ratio determination module 504. The computer device may determine, by the source domain sample weight determining module 506, a source domain sample weight corresponding to each source domain sample data according to the distribution density ratio. The computer device may execute, by the training sample weight determination module 508, obtaining training sample data according to the source domain sample data and the target domain sample data, and determine training sample weights corresponding to the training sample data respectively according to the target domain sample weights corresponding to the source domain sample weight and the target domain sample data respectively. The computer device can execute training of training sample data according to the training sample weight through the model training module 510, and when the training end condition is met, a machine learning model which is trained is obtained.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the above-described machine learning model training method. Here, the steps of the machine learning model training method may be steps in the machine learning model training methods of the above embodiments.
In one embodiment, a computer readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to perform the steps of the above-described machine learning model training method. Here, the steps of the machine learning model training method may be steps in the machine learning model training methods of the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (15)
1. A machine learning model training method, comprising:
acquiring source domain sample data and target domain sample data of a machine learning model to be trained;
determining a distribution density ratio between the target domain sample data and the source domain sample data;
determining source domain sample weights respectively corresponding to the source domain sample data according to the distribution density ratio;
obtaining training sample data according to the source domain sample data and the target domain sample data, and determining training sample weights respectively corresponding to the training sample data according to the source domain sample weight and the target domain sample weight respectively corresponding to the target domain sample data;
training the training sample data according to the training sample weight, and obtaining a machine learning model after training when the training end condition is met.
2. The method of claim 1, wherein said determining a distribution density ratio between said target domain sample data and said source domain sample data comprises:
performing data standardization processing on the source domain sample data and the target domain sample data to obtain a source domain standardized sample corresponding to the source domain sample data and a target domain standardized sample corresponding to the target domain sample data;
when the characteristic dimension of the source domain sample data and the characteristic dimension of the target domain sample data are larger than a preset dimension threshold value, respectively performing dimension reduction on the source domain standardized sample and the target domain standardized sample to obtain a source domain standardized sample after dimension reduction and a target domain standardized sample after dimension reduction;
and determining a dimension reduction distribution density ratio between the dimension reduced target domain standardized sample and the dimension reduced source domain standardized sample through a density ratio estimation algorithm, and taking the dimension reduction distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
3. The method according to claim 2, wherein the performing data normalization processing on the source domain sample data and the target domain sample data to obtain a source domain normalized sample corresponding to the source domain sample data and a target domain normalized sample corresponding to the target domain sample data comprises:
determining a mean and a standard deviation of the source domain sample data;
taking the source domain sample data and the target domain sample data as data to be standardized, and determining the data difference between the data to be standardized and the mean value;
determining the ratio of the data difference to the standard difference, and taking the ratio as a standardized sample corresponding to the data to be standardized; the normalized samples include a source domain normalized sample corresponding to the source domain sample data and a target domain normalized sample corresponding to the target domain sample data.
4. The method according to claim 2, wherein when the characteristic dimensions of the source domain sample data and the target domain sample data are greater than a preset dimension threshold, performing dimension reduction on the source domain normalized sample and the target domain normalized sample respectively to obtain a dimension-reduced source domain normalized sample and a dimension-reduced target domain normalized sample comprises:
determining an unlabeled target domain standardized sample from the target domain standardized samples, wherein the unlabeled target domain standardized sample is obtained by performing data standardization processing on unlabeled target domain sample data in the target domain sample data;
determining the characteristic dimensions of the source domain sample data and the target domain sample data;
and when the characteristic dimension is larger than a preset dimension threshold value, respectively performing dimension reduction on the source domain standardized sample and the unlabeled target domain standardized sample to obtain a source domain standardized sample after dimension reduction and an unlabeled target domain standardized sample after dimension reduction, and taking the unlabeled target domain standardized sample after dimension reduction as the target domain standardized sample after dimension reduction.
5. The method of claim 4, further comprising:
when the characteristic dimension is not larger than the dimension threshold value, determining a low-dimensional distribution density ratio between the label-free target domain normalized sample and the source domain normalized sample through a density ratio estimation algorithm, and using the low-dimensional distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
6. The method according to claim 1, wherein the determining the source domain sample weight corresponding to each source domain sample data according to the distribution density ratio comprises:
and carrying out normalization processing on the distribution density ratio to obtain source domain sample weights respectively corresponding to the source domain sample data.
7. The method of claim 1, wherein said deriving training sample data from said source domain sample data and said target domain sample data comprises:
extracting target domain sample data with labels from the target domain sample data;
and taking the source domain sample data and the target domain sample data with the label as training sample data.
8. The method of claim 1, further comprising:
determining the sample number of the target domain sample data with the label in the target domain sample data;
and when the number of the samples is greater than a preset sample number threshold value, determining the target domain sample weight corresponding to the target domain sample data with the labels respectively through an iterative algorithm.
9. The method of claim 8, wherein determining, by an iterative algorithm, respective corresponding target domain sample weights for each tagged target domain sample data comprises:
determining initialization weights respectively corresponding to the target domain sample data with the labels, and taking the initialization weights as current weights;
training the labeled target domain sample data according to the current weight, and determining a weight updating coefficient according to the error in the training process;
updating the current weight through the weight updating coefficient to obtain an updated weight;
and determining the training times, and determining the target domain sample weight corresponding to the target domain sample data with the label according to the updated weight when the training times reach a preset iteration threshold.
10. The method of claim 8, further comprising:
and when the sample number is not greater than the sample number threshold value, determining that the target domain sample data with the labels respectively correspond to the same target domain sample weight.
11. The method according to any one of claims 1 to 10, wherein the determining the training sample weights respectively corresponding to the training sample data according to the source domain sample weights and the target domain sample weights respectively corresponding to the target domain sample data comprises:
determining a source domain weight balance factor corresponding to the source domain sample data and a target domain weight balance factor corresponding to the target domain sample data;
obtaining the source domain sample weight of the source domain sample data in the training sample data according to the product of the source domain weight balance factor and the source domain sample weight;
obtaining the target domain sample weight of the target domain sample data in the training sample data according to the product of the target domain weight balance factor and the target domain sample weight;
the training sample weights include the source domain sample weights and the target domain sample weights.
12. A machine learning model training apparatus, the apparatus comprising:
the sample data acquisition module is used for acquiring source domain sample data and target domain sample data of the machine learning model to be trained;
a density ratio determination module for determining a distribution density ratio between the target domain sample data and the source domain sample data;
a source domain sample weight determining module, configured to determine, according to the distribution density ratio, a source domain sample weight corresponding to each source domain sample data;
a training sample weight determining module, configured to obtain training sample data according to the source domain sample data and the target domain sample data, and determine training sample weights corresponding to the training sample data according to target domain sample weights corresponding to the source domain sample data and the target domain sample data, respectively;
and the model training module is used for training the training sample data according to the training sample weight and obtaining a trained machine learning model when the training end condition is met.
13. The apparatus of claim 12, wherein the density ratio determination module comprises:
the standardization processing module is used for carrying out data standardization processing on the source domain sample data and the target domain sample data to obtain a source domain standardization sample corresponding to the source domain sample data and a target domain standardization sample corresponding to the target domain sample data;
the sample dimension reduction processing module is used for respectively carrying out dimension reduction processing on the source domain standardized sample and the target domain standardized sample when the characteristic dimension of the source domain sample data and the target domain sample data is larger than a preset dimension threshold value to obtain a source domain standardized sample after dimension reduction and a target domain standardized sample after dimension reduction;
and the density ratio estimation processing module is used for determining the dimension reduction distribution density ratio between the dimension reduced target domain standardized sample and the dimension reduced source domain standardized sample through a density ratio estimation algorithm, and taking the dimension reduction distribution density ratio as the distribution density ratio between the target domain sample data and the source domain sample data.
14. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 11.
15. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911107807.4A CN110852446A (en) | 2019-11-13 | 2019-11-13 | Machine learning model training method, device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911107807.4A CN110852446A (en) | 2019-11-13 | 2019-11-13 | Machine learning model training method, device and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110852446A true CN110852446A (en) | 2020-02-28 |
Family
ID=69601554
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911107807.4A Pending CN110852446A (en) | 2019-11-13 | 2019-11-13 | Machine learning model training method, device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110852446A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111652327A (en) * | 2020-07-16 | 2020-09-11 | 北京思图场景数据科技服务有限公司 | Model iteration method, system and computer equipment |
CN112070238A (en) * | 2020-11-10 | 2020-12-11 | 鹏城实验室 | Accurate machine learning asynchronous prediction method and system and storage medium |
CN112149689A (en) * | 2020-09-28 | 2020-12-29 | 上海交通大学 | Unsupervised domain adaptation method and system based on target domain self-supervised learning |
CN112192318A (en) * | 2020-09-28 | 2021-01-08 | 北京天泽智云科技有限公司 | Machining tool state monitoring method and system |
CN112634048A (en) * | 2020-12-30 | 2021-04-09 | 第四范式(北京)技术有限公司 | Anti-money laundering model training method and device |
CN113222073A (en) * | 2021-06-09 | 2021-08-06 | 支付宝(杭州)信息技术有限公司 | Method and device for training transfer learning model and recommendation model |
CN114048927A (en) * | 2022-01-11 | 2022-02-15 | 北京京东振世信息技术有限公司 | Demand amount prediction method, demand amount prediction device, electronic device, and storage medium |
CN114121204A (en) * | 2021-12-09 | 2022-03-01 | 上海森亿医疗科技有限公司 | Patient record matching method based on patient master index, storage medium and equipment |
CN114491342A (en) * | 2022-01-26 | 2022-05-13 | 阿里巴巴(中国)有限公司 | Training method of personalized model, information display method and equipment |
CN114863200A (en) * | 2022-03-21 | 2022-08-05 | 北京航空航天大学 | Gaze estimation method, device, and storage medium |
CN117096070A (en) * | 2023-10-19 | 2023-11-21 | 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) | Semiconductor processing technology abnormality detection method based on field self-adaption |
-
2019
- 2019-11-13 CN CN201911107807.4A patent/CN110852446A/en active Pending
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111652327A (en) * | 2020-07-16 | 2020-09-11 | 北京思图场景数据科技服务有限公司 | Model iteration method, system and computer equipment |
CN112192318B (en) * | 2020-09-28 | 2022-07-19 | 北京天泽智云科技有限公司 | Machining tool state monitoring method and system |
CN112149689B (en) * | 2020-09-28 | 2022-12-09 | 上海交通大学 | Unsupervised domain adaptation method and system based on target domain self-supervised learning |
CN112149689A (en) * | 2020-09-28 | 2020-12-29 | 上海交通大学 | Unsupervised domain adaptation method and system based on target domain self-supervised learning |
CN112192318A (en) * | 2020-09-28 | 2021-01-08 | 北京天泽智云科技有限公司 | Machining tool state monitoring method and system |
CN112070238B (en) * | 2020-11-10 | 2021-02-23 | 鹏城实验室 | Accurate machine learning asynchronous prediction method and system and storage medium |
CN112070238A (en) * | 2020-11-10 | 2020-12-11 | 鹏城实验室 | Accurate machine learning asynchronous prediction method and system and storage medium |
CN112634048A (en) * | 2020-12-30 | 2021-04-09 | 第四范式(北京)技术有限公司 | Anti-money laundering model training method and device |
CN113222073A (en) * | 2021-06-09 | 2021-08-06 | 支付宝(杭州)信息技术有限公司 | Method and device for training transfer learning model and recommendation model |
CN113222073B (en) * | 2021-06-09 | 2023-04-07 | 支付宝(杭州)信息技术有限公司 | Method and device for training advertisement recommendation model |
CN114121204A (en) * | 2021-12-09 | 2022-03-01 | 上海森亿医疗科技有限公司 | Patient record matching method based on patient master index, storage medium and equipment |
CN114048927A (en) * | 2022-01-11 | 2022-02-15 | 北京京东振世信息技术有限公司 | Demand amount prediction method, demand amount prediction device, electronic device, and storage medium |
CN114491342A (en) * | 2022-01-26 | 2022-05-13 | 阿里巴巴(中国)有限公司 | Training method of personalized model, information display method and equipment |
CN114491342B (en) * | 2022-01-26 | 2023-09-22 | 阿里巴巴(中国)有限公司 | Training method of personalized model, information display method and equipment |
CN114863200A (en) * | 2022-03-21 | 2022-08-05 | 北京航空航天大学 | Gaze estimation method, device, and storage medium |
CN117096070A (en) * | 2023-10-19 | 2023-11-21 | 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) | Semiconductor processing technology abnormality detection method based on field self-adaption |
CN117096070B (en) * | 2023-10-19 | 2024-01-05 | 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) | Semiconductor processing technology abnormality detection method based on field self-adaption |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110852446A (en) | Machine learning model training method, device and computer readable storage medium | |
US20240144093A1 (en) | System and method for relational time series learning with the aid of a digital computer | |
CN105913025B (en) | A kind of deep learning face identification method based on multi-feature fusion | |
US9400918B2 (en) | Compact face representation | |
US10339177B2 (en) | Method and a system for verifying facial data | |
CN105354595B (en) | A kind of robust visual pattern classification method and system | |
CN105335756B (en) | A kind of image classification method and image classification system based on Robust Learning model | |
CN111860674A (en) | Sample class identification method and device, computer equipment and storage medium | |
CN111127364B (en) | Image data enhancement strategy selection method and face recognition image data enhancement method | |
CN109271958B (en) | Face age identification method and device | |
US20220253856A1 (en) | System and method for machine learning based detection of fraud | |
CN108898181B (en) | Image classification model processing method and device and storage medium | |
US11574147B2 (en) | Machine learning method, machine learning apparatus, and computer-readable recording medium | |
CN109063743B (en) | Construction method of medical data classification model based on semi-supervised multitask learning | |
CN114419672A (en) | Cross-scene continuous learning pedestrian re-identification method and device based on consistency learning | |
Ding et al. | Pactran: Pac-bayesian metrics for estimating the transferability of pretrained models to classification tasks | |
CN111178533A (en) | Method and device for realizing automatic semi-supervised machine learning | |
CN118035448A (en) | Method, device and medium for classifying paper fields in citation network based on pseudo tag depolarization | |
CN113762005A (en) | Method, device, equipment and medium for training feature selection model and classifying objects | |
Cuevas et al. | Otsu and Kapur segmentation based on harmony search optimization | |
Jena et al. | Elitist TLBO for identification and verification of plant diseases | |
CN113642636B (en) | Feature measurement loss classification method based on sample Gaussian uncertainty modeling | |
Chen et al. | Pruning deep feature networks using channel importance propagation | |
Sawant et al. | Discriminative aging subspace learning for age estimation | |
JP5970579B2 (en) | Apparatus, method and program for mixed model determination |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40021598 Country of ref document: HK |
|
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |