Model migration method, device, apparatus and computer storage medium
By using a model transfer method, the model is iteratively updated using global and local regularization terms to generate a target model, which solves the model adaptability problem caused by operator data updates, and enables rapid identification of new tags while saving resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LIAONING MOBILE COMM
- Filing Date
- 2021-04-29
- Publication Date
- 2026-04-14
AI Technical Summary
The rapid updates of operator data make it difficult to directly apply models from the previous cycle to the new cycle, and remodeling is time-consuming and resource-intensive.
By performing model transfer on the base model, a first function is generated, and a second function is constructed by combining global and local regularization terms. The function is iteratively updated until a threshold is reached, the hyperplane set is solved, the first model is generated, and the target model is trained based on the sample dataset.
New category labels can be identified without rebuilding the model, saving time, manpower, and computing resources.
Smart Images

Figure CN115271768B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data segmentation technology, and in particular relates to a model transfer method, apparatus, device and computer storage medium. Background Technology
[0002] In an environment where big data technology is becoming increasingly mature, artificial intelligence is becoming more widespread, and market competition is becoming increasingly fierce, making full use of data mining and machine learning technologies to create a refined and intelligent marketing model has become the core for operators to improve their market competitiveness.
[0003] Against this backdrop, combining the characteristics of marketing products and the features of the selected channels, and utilizing big data resources to establish a target user segmentation model for marketing campaigns, is a crucial guarantee for marketing effectiveness. As a product of data mining, the model plays a vital role in areas such as target user segmentation, potential user identification, and user behavior prediction.
[0004] However, due to the characteristics of operator data such as high noise, many missing data, and rapid updates, the data distribution of different periods will be different after the data is updated. This will make it difficult to directly apply the model of the previous period to the data of the new period. Remodeling is not only time-consuming, but also consumes a lot of computing and human resources. Summary of the Invention
[0005] This application provides a model migration method, apparatus, device, and computer storage medium that enables the obtained target model to identify one or more newly added category labels without rebuilding the model, saving time, manpower, and computing resources.
[0006] In a first aspect, embodiments of this application provide a model transfer method, the method comprising:
[0007] Perform model transfer on the base model to generate the first function;
[0008] Construct the second function based on the first function, the global regular expression, and the local regular expression;
[0009] Update the second function to the first function, and return the second function constructed based on the first function, global regular expression, and local regular expression until the number of updates reaches the first threshold, and obtain the third function.
[0010] Find the hyperplane set corresponding to the minimization of the third function;
[0011] Generate the first model based on the hyperplane set;
[0012] The first model is trained based on the sample dataset until the training stopping condition is met, and the target model is obtained. The sample dataset includes multiple sample data.
[0013] The global regularization term represents the overall difference between the transferred model and the base model, while the local regularization term represents the local difference between the transferred model and the base model. The first threshold is the number of labels in the data to be classified that are more numerous than the labels in the sample data.
[0014] In one alternative implementation, the expression for the second function is:
[0015]
[0016] Where N is the number of hyperplanes corresponding to the second function, n is the number of labels in the sample data, and W n Let W′ be the nth hyperplane corresponding to the transferred model. n Let w be the nth hyperplane corresponding to the base model, F be the norm, and w be the hyperplane. n+1 The hyperplane set corresponding to the second function is the additional hyperplane set compared to the hyperplane set corresponding to the basis model, where β is the coefficient matrix, β = [β1, β2, ..., β]. n ] T Let i be the sample data index, i∈{1,2,…,m}, and m be the number of sample data. i Let be the slack variable for the i-th sample data.
[0017] In one alternative implementation, the expression for the third function is:
[0018]
[0019] Where N is the number of hyperplanes corresponding to the second function, N+p is the number of hyperplanes corresponding to the third function, n is the number of labels in the sample data, t∈{1,2,…,n}, W n Let W′ be the nth hyperplane corresponding to the transferred model. n-t Let w be the n-th hyperplane corresponding to the base model, F be the norm, and w be the hyperplane. n+p+1 Let β be the hyperplane set corresponding to the third function that is additional to the hyperplane set corresponding to the second function in the previous update, and let β be the coefficient matrix, β = [β1, β2, ..., β]. n ] T Let i be the sample data index, i∈{1,2,…,m}, and m be the number of sample data. i Let C be the slack variable for the i-th sample data, and C be a constant.
[0020] In one alternative implementation, a first model is generated based on the hyperplane, specifically including:
[0021] Substituting the hyperplane set into formula f i =W T x iIn +b, the function formula y of the first model is obtained after transformation. i =argmax j f i (j),
[0022] Among them, f i Let W be the transfer model function for the i-th data to be classified, W be the hyperplane set, T denote the transpose, and x be the hyperplane set. i Let be the i-th data point to be classified, b be the intercept, and y be the distance between the i-th and b-th data points. i Let be the label of the i-th data to be classified, and j be the data to be classified.
[0023] In one alternative implementation, a first model is trained based on a sample dataset until a training stopping condition is met to obtain the target model, specifically including:
[0024] Obtain the sample dataset, which includes multiple sample data and their corresponding target labels;
[0025] For each sample data, perform the following steps:
[0026] Input the sample data into the first model to obtain the predicted label corresponding to the sample data;
[0027] Based on the predicted label and the target label, determine the loss function value of the first model;
[0028] If the loss function value does not meet the training stopping condition, adjust the parameters of the first model and return to input the sample data into the first model to obtain the predicted label corresponding to the sample data, until the loss function value meets the training stopping condition, and obtain the target model.
[0029] In an alternative implementation, after training a first model based on a sample dataset until a training stopping condition is met to obtain the target model, the method further includes:
[0030] The data to be classified is input into the target model to obtain the labels of the data to be classified.
[0031] Secondly, embodiments of this application provide a model transfer apparatus, the apparatus comprising:
[0032] The migration module is used to perform model migration on the base model and generate the first function.
[0033] A building module is used to construct a second function based on the first function, global regular expressions, and local regular expressions;
[0034] The update module is used to update the second function to the first function, and returns the second function constructed based on the first function, global regular expressions, and local regular expressions, until the number of updates reaches the first threshold, and the third function is obtained.
[0035] The computation module is used to solve for the hyperplane set corresponding to the minimization of the third function;
[0036] The generation module is used to generate the first model based on the hyperplane set;
[0037] The training module is used to train the first model based on the sample dataset until the training stopping condition is met to obtain the target model. The sample dataset includes multiple sample data.
[0038] The global regularization term represents the overall difference between the transferred model and the base model, while the local regularization term represents the local difference between the transferred model and the base model. The first threshold is the number of labels in the data to be classified that are more numerous than the labels in the sample data.
[0039] In one alternative embodiment, the device further includes:
[0040] The input module is used to input the data to be classified into the target model and obtain the labels of the data to be classified.
[0041] Thirdly, embodiments of this application provide a computing device, the device including: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the model transfer method provided in the first aspect and any optional implementation of the first aspect.
[0042] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement a model transfer method provided in the first aspect and any optional implementation thereof.
[0043] The technical solutions provided by the embodiments of this application bring at least the following beneficial effects:
[0044] In this embodiment, a first function is generated by performing model transfer on the base model, so that as many model parameters as possible from the previous cycle are transferred to the new cycle. Based on the first function, global regularization term, and local regularization term, the first function is improved to construct a second function, reducing model complexity and avoiding overfitting. Then, the second function is updated to the first function. The process continues until the number of updates reaches a first threshold, resulting in a third function. The hyperplane corresponding to the minimization of the third function is solved. Based on this hyperplane, a first model is generated. The first model is then trained on the sample dataset until the training stopping condition is met, resulting in the target model. In this way, the target model can identify one or more newly added category labels without rebuilding the model, saving time, manpower, and computing resources. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a flowchart illustrating a model transfer method according to an exemplary embodiment;
[0047] Figure 2 This is a flowchart illustrating a method for using a target model according to an exemplary embodiment;
[0048] Figure 3 This is a schematic diagram of the structure of a model transfer device according to an exemplary embodiment;
[0049] Figure 4 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0050] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0051] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0052] Figure 1 The diagram shows a flowchart of a model transfer method provided in one embodiment of this application.
[0053] like Figure 1As shown, the execution entity of this model transfer method can be a model transfer device, and it can specifically include the following steps:
[0054] S110, Perform model transfer on the base model to generate the first function;
[0055] S120, construct the second function based on the first function, the global regularization term, and the local regularization term;
[0056] S130, update the second function to the first function, and return the second function constructed based on the first function, global regularization terms and local regularization terms, until the number of updates reaches the first threshold, and obtain the third function;
[0057] S140, Solve for the hyperplane set corresponding to the minimization of the third function;
[0058] S150, based on the hyperplane set, generates the first model;
[0059] S160: Train the first model based on the sample dataset until the training stopping condition is met, and obtain the target model.
[0060] Therefore, by performing model transfer on the base model, a first function is generated, allowing as many model parameters from the previous cycle as possible to be transferred to the new cycle. Based on the first function, global regularization, and local regularization, the first function is improved to construct a second function, reducing model complexity and avoiding overfitting. Then, the second function is updated to the first function. The process continues until the number of updates reaches a first threshold, resulting in a third function. The hyperplane corresponding to the minimization of the third function is solved. Based on this hyperplane, a first model is generated. This first model is then trained on the sample dataset until the training stopping condition is met, resulting in the target model. In this way, the target model can identify one or more newly added category labels without rebuilding the model, saving time, manpower, and computing resources.
[0061] The above steps are explained in detail below:
[0062] Regarding S110, in this embodiment, the base model can be a least squares support vector machine, or other models, which are not limited here. The first function can be a model transfer framework obtained by transferring the base model, which can be used to transfer the parameters of the base model to the target model as completely as possible.
[0063] Regarding S120, the global regularization term represents the overall difference between the transferred model and the base model. This global regularization term makes the hyperplane set of the target model similar to that of the base model, ensuring that the target model's ability to recognize the original labels is not significantly different from that of the base model. The local regularization term represents the local difference between the transferred model and the base model. This local regularization term enables the target model to accurately identify new labels that the base model cannot recognize. The second function is a model transfer framework that adds global and local regularization terms to the first function, i.e., an improved transfer framework.
[0064] Based on this, in one alternative implementation, the expression for the second function can be:
[0065]
[0066]
[0067] Where N can be the number of hyperplanes corresponding to the second function, n can be the number of labels in the sample data, and W n W′ can be the nth hyperplane corresponding to the transferred model. n It can be the nth hyperplane corresponding to the base model, F can be the norm, and w n+1 The hyperplane set corresponding to the second function can be the additional hyperplane set in the hyperplane set corresponding to the basis model, where β can be the coefficient matrix, β = [β1, β2, ..., β]. n ] T ξ can be the sample data number, i∈{1,2,…,m}, m can be the number of sample data, ξ i It can be a slack variable for the i-th sample data.
[0068] Here, to avoid optimization problems caused by too many parameter coefficients, each weight can be simplified to 1 / 2. Of course, it can also be simplified to other values between 0 and 1, without limitation.
[0069] Regarding S130, based on the ideas of incremental learning and iteration, S120 is executed iteratively, that is, the second function is updated to the first function, and the second function is constructed based on the first function, the global regularization term, and the local regularization term. This process continues until the number of updates reaches the first threshold, resulting in the third function. Here, the first threshold can be the number of labels in the data to be classified that are more numerous than the labels in the sample data. The third function can be the model transfer framework obtained by iteratively adding global and local regularization terms to the base model. The global regularization term is used to achieve overall transfer, which can reduce the cumulative effect of differences between the target model and the base model during iteration and reduce the model shift caused by the increase of new labels. The local regularization term allows for local modifications to the model, avoiding the problem of only minimizing the global regularization term in model transfer while ignoring the unique features of the data to be classified.
[0070] Based on this, in one alternative implementation, the expression for the third function can be:
[0071]
[0072] Where N can be the number of hyperplanes corresponding to the second function, N+p can be the number of hyperplanes corresponding to the third function, n can be the number of labels in the sample data, t∈{1,2,…,n}, W n W′ can be the nth hyperplane corresponding to the transferred model. n-t Let F be the n-th hyperplane corresponding to the base model, and let w be the norm. n+p+1 β can be the hyperplane set corresponding to the third function that is additional to the hyperplane set corresponding to the second function during the previous update, and β can be the coefficient matrix, β = [β1, β2, ..., β]. n ] T ξ can be the sample data number, i∈{1,2,…,m}, m can be the number of sample data, ξ i C can be a slack variable for the i-th sample data, and C can be a constant.
[0073] Here, to avoid optimization problems caused by too many parameter coefficients, each weight can be simplified to 1 / 2. Of course, it can also be simplified to other values between 0 and 1, without limitation.
[0074] Regarding S140, the hyperplane set can include the hyperplanes corresponding to the labels of the data to be classified. Minimizing it can simplify the hyperplane vectors, reduce model complexity, and reduce overfitting.
[0075] In a specific example, the formula for minimizing the third function can be:
[0076]
[0077] The constraints for solving the formula for minimizing the third function can be:
[0078]
[0079] Where N can be the number of hyperplanes corresponding to the second function, N+p can be the number of hyperplanes corresponding to the third function, n can be the number of labels in the sample data, t∈{1,2,…,n}, W n W′ can be the nth hyperplane corresponding to the transferred model. n-t Let F be the n-th hyperplane corresponding to the base model, and let w be the norm. n+p+1 β can be the hyperplane set corresponding to the third function that is additional to the hyperplane set corresponding to the second function in the previous update, and β can be the coefficient matrix, β = [β1,β2,…,β]. n ] T ξ can be the sample data number, i∈{1,2,…,m}, m can be the number of sample data, ξ i y can be a slack variable for the i-th sample data, and C can be a constant. i Let x be the label of the i-th data to be classified, W be the hyperplane set, T be the transpose, and x be the label of the i-th data to be classified. i This can be the i-th data to be classified. It can be a kernel function vector, b can be the intercept, ξ i It can be a slack variable for the i-th sample data.
[0080] Solving the above formula, we get:
[0081]
[0082]
[0083]
[0084] Where, α in α can be the Lagrange multiplier corresponding to the nth label of the i-th sample data. i(n+p+1) α can be the Lagrange multiplier corresponding to the (n+p+1)th label of the i-th sample data. i(n+1) b can be the Lagrange multiplier corresponding to the (n+1)th label of the i-th sample data. n b can be the intercept corresponding to the nth label. n+1 Y can be the intercept corresponding to the (n+1)th label. in This can be the label matrix corresponding to the data to be classified. The meanings of other parameters are the same as those in the previous text and will not be repeated here.
[0085] Based on the above formula, the hyperplane set W can be obtained, which can be W = [W1, W2, ..., w N+1 ,…,w n+p ],w n+p+1 It can be used to assist in classifying data.
[0086] Regarding S150, the first model can be a model generated based on the hyperplane set obtained above, and this first model can be used to predict the label of the data to be classified.
[0087] Based on this, in one optional implementation, S150 may specifically include:
[0088] Substituting the hyperplane set into formula f i =W T x i In +b, the function formula y of the first model is obtained after transformation. i =argmax j f i (j),
[0089] Among them, f i Let W be the transfer model function for the i-th data to be classified, W be the hyperplane set, T denote the transpose, and x be the hyperplane set. i Let be the i-th data point to be classified, b be the intercept, and y be the data point to be classified. i Let j be the label of the i-th data to be classified, and j be the data to be classified.
[0090] Here, the obtained hyperplane set W can be substituted into the formula f. i =W T x i In +b, the formula is then transformed to obtain the function formula y for the first model. i =argmax j f i (j) The function formula of this first model can be used to predict the label of the data to be classified. Suppose we have m sample data points (m >> n) in n categories that need to be classified, then the label is y. i ∈Y in ={1,2,…,n}, i∈ {1,2,…,m}.
[0091] Regarding S160, the sample dataset may include multiple sample data points that can be used to train the first model. For example, the sample dataset could be X = [x1, x2, ... x...]. m ]∈R m×d Where m is the number of sample data and d is the dimension of each sample data. The first model needs to be trained to obtain the target model, which can be used to determine the labels of the data to be classified.
[0092] Based on this, in one optional implementation, S160 may specifically include:
[0093] Obtain the sample dataset;
[0094] For each sample data, perform the following steps:
[0095] Input the sample data into the first model to obtain the predicted label corresponding to the sample data;
[0096] Based on the predicted label and the target label, determine the loss function value of the first model;
[0097] If the loss function value does not meet the training stopping condition, adjust the parameters of the first model and return to input the sample data into the first model to obtain the predicted label corresponding to the sample data, until the loss function value meets the training stopping condition, and obtain the target model.
[0098] Here, the sample dataset can include multiple sample data and their corresponding target labels. The first model is iteratively trained using classification and regression detection algorithms until the training stopping condition is met. The sample dataset can include data whose labels were previously determined through the base model. If some data to be classified was already acquired when the model was started, this sample dataset can also include that portion of data. The predicted label can be the label obtained after inputting the sample data into the first model during training, and the target label can be the accurate label of the sample data. For example, the sample data can be user data, and the target label can be the advertising channel corresponding to that user, such as channel A, channel B, and channel C.
[0099] It should be noted that, in order to improve the accuracy of the target model, the target model can be continuously trained with new sample data in practical applications to continuously update the target model and improve its accuracy.
[0100] In addition, in an alternative implementation, after S160, the method may further include:
[0101] The data to be classified is input into the target model to obtain the labels of the data to be classified.
[0102] Here, the data to be classified can be data for which labels need to be determined, and the target model can be used to determine the labels of the data to be classified. By inputting the data to be classified into the target model, the labels of the data to be classified can be obtained.
[0103] Furthermore, in practical applications, not all data to be classified will experience label changes, but all can still be deployed according to the target model. This is because when the labels of the data to be classified remain unchanged, the formula is:
[0104]
[0105] The second item
[0106]
[0107] If it does not exist, the model transfer framework corresponding to the target model becomes a normal model transfer framework, and the model offset problem caused by the increase of the number of transfers is solved. For the specific meaning of the parameters, please refer to the previous text, and will not be repeated here.
[0108] To better describe the entire scheme, based on the above embodiments, a specific example is given as shown in Figure 2. The method of using the target model obtained through this model transfer method may include S210-S250, which will be explained in detail below.
[0109] S210, Obtain the dataset to be classified, i = 0.
[0110] In a specific example, the dataset to be classified can be the target user dataset X = [x1, x2, ... x i ]∈R i ×d , where i is the number of target user data and d is the dimension of each target user data.
[0111] S220, i = i + 1, input the i-th data to be classified.
[0112] In a specific example, the data of the i-th target user x i Input into the target model.
[0113] S230, obtain the label of the i-th data to be classified, and add it to the classification result matrix.
[0114] In a specific example, the data of the i-th target user x i Substitute y i =argmax j f i In (j), the label y corresponding to the i-th target user data is calculated. i and the target user data and its corresponding tag y i Add it to the classification result matrix.
[0115] S240, Has all the data to be classified been determined?
[0116] In a specific example, determine whether all target user data has a corresponding label. If yes, execute S250; otherwise, return to execute S220 and input the next target user data.
[0117] S250 outputs the final classification result matrix.
[0118] In a specific example, if the labels for all target user data have been determined, the final classification result matrix is output.
[0119] Based on the same inventive concept, this application also provides a model transfer device. The following is in conjunction with... Figure 3 The model transfer apparatus provided in the embodiments of this application will be described in detail.
[0120] Figure 3 This is a structural block diagram of a model transfer device according to an exemplary embodiment.
[0121] like Figure 3 As shown, the model transfer device 3 may include:
[0122] The migration module 301 is used to perform model migration on the base model and generate the first function.
[0123] Module 302 is used to construct a second function based on the first function, global regular expressions, and local regular expressions.
[0124] Update module 303 is used to update the second function to the first function, and return the second function constructed based on the first function, global regular expression and local regular expression, until the number of updates reaches the first threshold, and the third function is obtained.
[0125] Calculation module 304 is used to solve for the hyperplane set corresponding to the minimization of the third function;
[0126] Generation module 305 is used to generate the first model based on the hyperplane set;
[0127] Training module 306 is used to train the first model based on the sample dataset until the training stopping condition is met to obtain the target model. The sample dataset includes multiple sample data.
[0128] The global regularization term can represent the overall difference between the transferred model and the base model, while the local regularization term can represent the local difference between the transferred model and the base model. The first threshold can be the number of labels in the data to be classified that are more numerous than the labels in the sample data.
[0129] In one embodiment, the expression for the second function can be:
[0130]
[0131] Where N can be the number of hyperplanes corresponding to the second function, n can be the number of labels in the sample data, and W n W′ can be the nth hyperplane corresponding to the transferred model. nIt can be the nth hyperplane corresponding to the base model, F can be the norm, and w n+1 The hyperplane set corresponding to the second function can be the additional hyperplane set in the hyperplane set corresponding to the basis model, where β can be the coefficient matrix, β = [β1, β2, ..., β]. n ] T ξ can be the sample data number, i∈{1,2,…,m}, m can be the number of sample data, ξ i It can be a slack variable for the i-th sample data.
[0132] In one embodiment, the expression for the third function is:
[0133]
[0134] Where N can be the number of hyperplanes corresponding to the second function, N+p can be the number of hyperplanes corresponding to the third function, n can be the number of labels in the sample data, t∈{1,2,…,n}, W n W′ can be the nth hyperplane corresponding to the transferred model. n-t Let F be the n-th hyperplane corresponding to the base model, and let w be the norm. n+p+1 β can be the hyperplane set corresponding to the third function that is additional to the hyperplane set corresponding to the second function in the previous update, and β can be the coefficient matrix, β = [β1,β2,…,β]. n ] T ξ can be the sample data number, i∈{1,2,…,m}, m can be the number of sample data, ξ i C can be a slack variable for the i-th sample data, and C can be a constant.
[0135] In one embodiment, the generation module 305 may specifically include:
[0136] The generation submodule is used to substitute the hyperplane set into formula f. i =W T x i In +b, the function formula y of the first model is obtained after transformation. i =argmax j f i (j),
[0137] Among them, f i Let W be the transfer model function for the i-th data to be classified, W be the hyperplane set, T be the transpose, and x be the hyperplane. i Let be the i-th data point to be classified, b be the intercept, and y be the data point to be classified. i Let j be the label of the i-th data to be classified, and j be the data to be classified.
[0138] In one embodiment, training module 306 may specifically include:
[0139] The acquisition submodule is used to obtain the sample dataset and the target labels corresponding to the sample data;
[0140] The input submodule is used to input sample data into the first model and obtain the predicted label corresponding to the sample data.
[0141] The determination submodule is used to determine the loss function value of the first model based on the predicted label and the target label;
[0142] The adjustment submodule is used to adjust the parameters of the first model when the loss function value does not meet the training stopping condition, and then return to input the sample data into the first model to obtain the predicted label corresponding to the sample data, until the loss function value meets the training stopping condition, and the target model is obtained.
[0143] In one embodiment, the device may further include:
[0144] The input module 307 is used to input the data to be classified into the target model to obtain the labels of the data to be classified.
[0145] Figure 4 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment.
[0146] like Figure 4 As shown, the electronic device 4 is a structural diagram of an exemplary hardware architecture of an electronic device capable of implementing the model transfer method and model transfer apparatus according to the embodiments of this application. This electronic device may refer to the electronic device in the embodiments of this application.
[0147] The electronic device 4 may include a processor 401 and a memory 402 storing computer program instructions.
[0148] Specifically, the processor 401 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0149] Memory 402 may include a large-capacity storage for information or instructions. For example, and not limitingly, memory 402 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where suitable, memory 402 may include removable or non-removable (or fixed) media. Where suitable, memory 402 may be internal or external to the integrated gateway device. In a particular embodiment, memory 402 is a non-volatile solid-state memory. In a particular embodiment, memory 402 includes read-only memory (ROM). Where suitable, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0150] The processor 401 reads and executes computer program instructions stored in the memory 402 to achieve... Figure 1 or Figure 2 The methods in the illustrated embodiments achieve the corresponding technical effects, and for the sake of brevity, they will not be described in detail here.
[0151] In one embodiment, the electronic device 4 may further include a transceiver 403 and a bus 404. Wherein, as... Figure 4 As shown, the processor 401, memory 402 and transceiver 403 are connected via bus 404 and communicate with each other.
[0152] Bus 404 includes hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Controller Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 404 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0153] This application also provides a computer storage medium storing computer-executable instructions for implementing the model transfer method described in this application.
[0154] In some possible implementations, various aspects of the methods provided in this application may also be implemented as a program product comprising program code that, when run on a computer device, causes the computer device to perform the steps of the methods according to the various exemplary embodiments of this application described above, for example, the computer device may perform the model migration method described in the embodiments of this application.
[0155] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0156] This application is described with reference to flowchart illustrations and / or block diagrams of the methods, apparatus, and computer program products according to this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable information processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable information processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0157] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable information processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0158] These computer program instructions may also be loaded onto a computer or other programmable information processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0159] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A model transfer method, characterized in that, The method includes: The base model is transferred to generate a first function. The base model is a model trained based on user data and user behavior categories, which can accurately identify the user behavior categories corresponding to the user data in the sample data. Construct a second function based on the first function, the global regular expression, and the local regular expression; Update the second function to the first function, and return the second function constructed based on the first function, global regular expression, and local regular expression until the number of updates reaches the first threshold to obtain the third function; Find the hyperplane set corresponding to the minimization of the third function; Based on the hyperplane set, a first model is generated; The first model is trained based on the sample dataset until the training stopping condition is met to obtain the target model. The sample dataset includes multiple sample data, each of which includes user data and a target label. The target label is the user behavior category corresponding to the user. The global regularization term represents the overall difference between the transferred model and the base model, ensuring that the target model's ability to identify user behavior categories in the sample data is similar to that of the base model. The local regularization term represents the local difference between the transferred model and the base model, enabling the target model to accurately identify new user behavior categories that the base model cannot identify. The first threshold is the number of labels in the data to be classified that are more numerous than the labels in the sample data.
2. The method according to claim 1, characterized in that, The expression for the second function is: Where N is the number of hyperplanes corresponding to the second function, n is the number of labels in the sample data, and W n Let W′ be the nth hyperplane corresponding to the transferred model. n Let F be the nth hyperplane corresponding to the base model, and let w be the norm. n+1 Let β be the hyperplane set corresponding to the second function that is additional to the hyperplane set corresponding to the base model, and let β be the coefficient matrix, β = [β1, β2, ..., β]. n ] T ξ is the number of the sample data, i∈{1,2,…,m}, m is the number of the sample data, ξ i Let be the slack variable for the i-th sample data.
3. The method according to claim 1, characterized in that, The expression for the third function is: Where N is the number of hyperplanes corresponding to the second function, N+p is the number of hyperplanes corresponding to the third function, n is the number of labels in the sample data, t∈{1,2,…,n}, W n Let W′ be the nth hyperplane corresponding to the transferred model. n-t Let F be the nth hyperplane corresponding to the base model, and let w be the norm. n+p+1 The hyperplane set corresponding to the third function is the additional hyperplanes compared to the hyperplane set corresponding to the second function in the previous update, where β is the coefficient matrix, β = [β1, β2, ..., β]. n ] T ξ is the number of the sample data, i∈{1,2,…,m}, m is the number of the sample data, ξ i Let C be the slack variable for the i-th sample data, and C be a constant.
4. The method according to claim 1, characterized in that, The generation of the first model based on the hyperplane specifically includes: Substituting the hyperplane set into formula f i =W T x i In +b, the function formula y of the first model is obtained after transformation. i =argmax j f i (j), Among them, f i Let W be the transfer model function for the i-th data to be classified, W be the hyperplane set, T denote the transpose, and x be the hyperplane set. i Let be the i-th data to be classified, b be the intercept, and y be the distance between the i-th and b-th data points. i Let j be the label of the i-th data to be classified, and j be the data to be classified.
5. The method according to claim 1, characterized in that, The step of training the first model based on the sample dataset until the training stopping condition is met to obtain the target model specifically includes: Obtain the sample dataset, which includes multiple sample data and target labels corresponding to the sample data; For each of the sample data, perform the following steps: The sample data is input into the first model to obtain the predicted label corresponding to the sample data; The loss function value of the first model is determined based on the predicted label and the target label; If the loss function value does not meet the training stopping condition, adjust the parameters of the first model and return to the previous step of inputting the sample data into the first model to obtain the predicted label corresponding to the sample data, until the loss function value meets the training stopping condition, and obtain the target model.
6. The method according to claim 1, characterized in that, After training the first model based on the sample dataset until the training stopping condition is met and the target model is obtained, the method further includes: The data to be classified is input into the target model to obtain the label of the data to be classified.
7. A model transfer device, characterized in that, The device includes: The transfer module is used to transfer the model to the base model and generate the first function. The base model is a model trained based on user data and user behavior categories, which can accurately identify the user behavior categories corresponding to the user data in the sample data. A construction module is used to construct a second function based on the first function, global regular expressions, and local regular expressions; The update module is used to update the second function to the first function, and return the result of constructing the second function based on the first function, global regular expression, and local regular expression until the number of updates reaches a first threshold to obtain the third function; The computation module is used to solve for the hyperplane set corresponding to the minimization of the third function; A generation module is used to generate a first model based on the hyperplane set; The training module is used to train the first model based on the sample dataset until the training stopping condition is met to obtain the target model. The sample dataset includes multiple sample data, each of which includes user data and a target label, wherein the target label is the user behavior category corresponding to the user. The global regularization term represents the overall difference between the transferred model and the base model, ensuring that the target model's ability to identify user behavior categories in the sample data is similar to that of the base model. The local regularization term represents the local difference between the transferred model and the base model, enabling the target model to accurately identify new user behavior categories that the base model cannot identify. The first threshold is the number of labels in the data to be classified that are more numerous than the labels in the sample data.
8. The apparatus according to claim 7, characterized in that, The device further includes: The input module is used to input the data to be classified into the target model to obtain the label of the data to be classified.
9. A computing device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the model transfer method as described in any one of claims 1-6.
10. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, implement the model transfer method as described in any one of claims 1-6.
Citation Information
Patent Citations
Least square multi-classification method and device based on transfer learning and storage medium
CN110929803A
Transfer learning method and electronic equipment
CN111898708A