Training model method, information processing method, device and electronic equipment
By replacing the sum of squares loss function term of the semidefinite programming objective function with the L1 loss function term in the machine learning algorithm and adding a regularization term, the problem of the semidefinite programming objective function being sensitive to noise samples is solved, and the robustness and accuracy of the model are improved.
Patent Information
- Application Number
- CN201910350187.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-28
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2039-04-28
AI Technical Summary
The existing semidefinite programming objective function is sensitive to noise samples, which leads to poor robustness of the machine learning model and affects the accuracy of the prediction results.
The sum-of-squares loss function term in the semidefinite programming objective function of the machine learning algorithm is replaced with the L1 loss function term, and a regularization term is added when necessary to construct a new objective function to enhance robustness.
The robustness of the machine learning model is improved, making the final model more accurate and stable, and better able to handle training sets containing noisy samples.
Smart Images

Figure CN111860850B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning technology, and more specifically, to a method for training a machine learning model, an information processing method, a device for training a machine learning model, an information processing device, an electronic device, and a readable storage medium. Background Art
[0002] Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning algorithms automatically analyze data to identify patterns and use these patterns to make predictions about unknown data.
[0003] Semi-definite programming (SDP) studies optimization problems with convex objective functions under semidefinite constraints. In other words, SDP is used to solve optimization problems with convex objective functions and semidefinite constraints. Many machine learning algorithms can be formulated as semidefinite programming problems, such as embedding and clustering algorithms, sparse principal component analysis, maximum variance unfolding, parameter-free kernel learning algorithms, and distance metric learning algorithms.
[0004] In applications such as image or text similarity comparison, a matching machine learning model can be used to predict the similarity between input image or text pairs. In natural language processing applications, a matching machine learning model can be used to perform semantic analysis, named entity recognition, and part-of-speech identification on the input text. The machine learning models used in these applications can be trained using the semidefinite programming objective function of the corresponding machine learning algorithm.
[0005] Most machine learning algorithms that use semidefinite programming as their objective function typically assume that all training examples in the training set have perfect side information (i.e., features). However, in real applications, training examples can come from sources such as implicit user feedback or article citations, and therefore may contain erroneous noise.
[0006] Existing semidefinite programming objective functions typically include a sum-of-squares loss function term, which is very sensitive to noise and outliers in noisy samples, making the semidefinite programming objective function less robust. Therefore, if a machine learning algorithm that uses a semidefinite programming objective function is used with a training set containing noisy samples, the performance of the resulting machine learning model will inevitably be reduced, leading to inaccurate predictions from the machine learning model.
[0007] Therefore, it is very valuable to propose a solution for training machine learning models to improve the robustness of machine learning models. Summary of the Invention
[0008] An object of the present invention is to provide a new technical solution for training machine learning models.
[0009] According to a first aspect of the present invention, there is provided a method for training a machine learning model, comprising:
[0010] Obtain a training sample set;
[0011] The sum-of-squares loss function term in the semidefinite programming objective function of the pre-selected machine learning algorithm is replaced with the L1 loss function term to obtain a new objective function;
[0012] According to the machine learning algorithm and the new objective function, machine learning training is completed based on the training sample set to obtain a final machine learning model.
[0013] Optionally, the method further includes:
[0014] Further adding a regularization term to the new objective function to obtain a final objective function, wherein the regularization term includes the sum of squares of model parameters of the pre-selected machine learning algorithm;
[0015] According to the machine learning algorithm and the final objective function, machine learning training is completed based on the training sample set to obtain a final machine learning model.
[0016] Optionally, the step of completing machine learning training based on the training sample set according to the machine learning algorithm and the final objective function to obtain a machine learning model includes:
[0017] Construct a surrogate function for the final objective function;
[0018] Solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process;
[0019] According to the incremental changes corresponding to each round of iteration, the model parameters of the machine learning model are updated, the machine learning training is completed, and the final machine learning model is obtained.
[0020] Optionally, the step of constructing a substitute function for the final objective function includes:
[0021] According to the final objective function and preset rules, a convex upper bound function of the final objective function is constructed with the change increment of the model parameter as a variable, as the replacement function.
[0022] Optionally, the preset rules include:
[0023] Substituting any change increment into the substitution function and the final objective function so that the result of the substitution function is greater than or equal to the result of the final objective function; and / or,
[0024] The result of the final objective function shows a downward trend as the number of iterations increases.
[0025] Optionally, the step of solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process includes:
[0026] Set the initial model parameter values of the machine learning model;
[0027] The substitution function is solved according to the set initial model parameter values and the training sample set to obtain the change increment corresponding to each round of iterative process.
[0028] Optionally, the step of solving the substitution function according to the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iterative process includes:
[0029] The surrogate function is solved by the alternating direction multiplier method or the accelerated proximal gradient algorithm.
[0030] Optionally, the step of solving the substitution function according to the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iterative process includes:
[0031] In each round of iteration, the model parameters before the current round of iteration and the training sample set are substituted into the substitution function, and the value of the change increment when the result of the substitution function takes the minimum value is obtained as the change increment corresponding to the current round of iteration.
[0032] Optionally, the step of updating the model parameters of the machine learning model according to the change increment corresponding to each round of iterative process, completing the machine learning training, and obtaining the final machine learning model includes:
[0033] Updating the model parameters of the machine learning model according to the incremental changes corresponding to each round of iteration;
[0034] When the preset convergence conditions are met, the machine learning training is completed and the final machine learning model is obtained.
[0035] Optionally, the convergence condition includes:
[0036] The number of iterations of machine learning training reaches a preset threshold;
[0037] and / or,
[0038] The training result value of the updated model parameter is less than a preset result threshold, wherein the training result value is determined based on the result obtained by substituting the updated model parameter into the final objective function.
[0039] Optionally, the final objective function is expressed as:
[0040]
[0041]
[0042] The substitution function is expressed as:
[0043]
[0044]
[0045]
[0046]
[0047]
[0048] in, is the change increment corresponding to the kth round of iteration, k is an integer greater than zero; A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, Q τ and t τ are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, I is the unit matrix, X k is the model parameter before the kth round of iteration, X k+1 is the model parameter obtained in the kth round of iteration, and λ is the preset weight factor.
[0049] Optionally, the obtaining of a training sample set includes: obtaining a labeled text sample data set;
[0050] The final machine learning model is used to perform natural language processing.
[0051] Optionally, obtaining the training sample set includes: obtaining a set of labeled text sample pairs, wherein the labels are information indicating whether the text sample pairs are similar;
[0052] The final machine learning model is used to predict the similarity between texts;
[0053] or,
[0054] The acquiring of the training sample set comprises: acquiring a set of labeled image sample pairs, wherein the labels are information indicating whether the image sample pairs are similar;
[0055] The final machine learning model is used to predict similarities between images.
[0056] Optionally, the method further includes:
[0057] Provides a setting entry for setting application scenarios of machine learning models;
[0058] Obtain the application scenario input through the setting entry;
[0059] The step of obtaining a training sample set includes: obtaining a corresponding training sample set according to the input application scenario.
[0060] Optionally, after obtaining the final machine learning model, the method further includes:
[0061] Determining application scenarios for which the final machine learning model is applicable;
[0062] Searching for application projects that match the application scenario;
[0063] The final machine learning model is input into the application project.
[0064] According to a second aspect of the present invention, there is provided an information processing method, comprising:
[0065] Obtain information about samples to be processed;
[0066] Obtaining a machine learning model for processing the sample information to be processed, wherein the machine learning model is the final machine learning model obtained according to the first aspect of the present invention;
[0067] The machine learning model is used to process the sample information to be processed.
[0068] Optionally, the obtaining of sample information to be processed includes: obtaining sample data to be processed by natural language processing;
[0069] The step of processing the sample information to be processed using the machine learning model includes: performing natural language processing on the sample data using the machine learning model.
[0070] Optionally, the obtaining of sample information to be processed includes: obtaining text sample pairs or image sample pairs to be compared for similarity;
[0071] The step of processing the sample information to be processed by using the machine learning model includes: using the machine learning model to predict the similarity between the text sample pairs or image sample pairs.
[0072] According to a third aspect of the present invention, there is provided an apparatus for training a machine learning model, comprising:
[0073] A training sample acquisition module is used to obtain a training sample set;
[0074] An objective function determination module is used to replace the sum-of-squares loss function term in the semidefinite programming objective function of a pre-selected machine learning algorithm with the L1 loss function term to obtain a new objective function;
[0075] The machine learning training module is used to complete the machine learning training based on the training sample set according to the machine learning algorithm and the new objective function to obtain the final machine learning model.
[0076] According to a fourth aspect of the present invention, there is provided an information processing apparatus, comprising:
[0077] A sample acquisition module to be processed is used to obtain information of samples to be processed;
[0078] a model acquisition module, configured to acquire a machine learning model for processing the sample information to be processed, wherein the machine learning model is the final machine learning model obtained according to the third aspect of the present invention;
[0079] An information processing module is used to process the sample information to be processed using the machine learning model.
[0080] According to a fifth aspect of the present invention, there is provided an electronic device, comprising:
[0081] The apparatus for training a machine learning model as described in the third aspect of the present invention; or
[0082] The information processing device according to the fourth aspect of the present invention; or
[0083] A processor and a memory, wherein the memory is used to store instructions, and the instructions are used to control the processor to execute the method described in the first aspect or the second aspect of the present invention.
[0084] According to a sixth aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to the first aspect or the second aspect of the present invention.
[0085] In an embodiment of the present invention, a new objective function is obtained by replacing the sum-of-squares loss function term in the semidefinite programming objective function of a pre-selected machine learning algorithm with an L1 loss function term, and machine learning training is completed according to the new objective function. Since the new objective function has stronger stability, the machine learning training performed according to the new objective function can have stronger robustness, and thus the final machine learning model obtained can be made more accurate.
[0086] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
[0088] Figure 1 is a block diagram showing an example of a hardware configuration of an electronic device that can be used to implement an embodiment of the present invention;
[0089] Figure 2 A flowchart showing a method for training a machine learning model according to an embodiment of the present invention is shown;
[0090] Figure 3 A flowchart illustrating an example of a method for training a machine learning model according to an embodiment of the present invention is shown;
[0091] Figure 4 A flowchart showing an information processing method according to an embodiment of the present invention is shown;
[0092] Figure 5 A block diagram of an apparatus for training a machine learning model according to an embodiment of the present invention is shown;
[0093] Figure 6 A block diagram showing an information processing apparatus according to an embodiment of the present invention;
[0094] Figure 7 A block diagram showing an example of an electronic device according to an embodiment of the present invention;
[0095] Figure 8 A schematic diagram of the changing curves of the square sum loss function term and the L1 loss function term is shown. DETAILED DESCRIPTION
[0096] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention.
[0097] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0098] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0099] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0100] It should be noted that like reference numerals and letters refer to like items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0101] Hereinafter, various embodiments and examples according to embodiments of the present invention will be described with reference to the accompanying drawings.
[0102] <Hardware Configuration>
[0103] Figure 1 is a block diagram showing a hardware configuration of an electronic device 1000 that can implement an embodiment of the present invention.
[0104] The electronic device 1000 may be a portable computer, a desktop computer, a mobile phone, a tablet computer, etc. Figure 1 As shown, electronic device 1000 may include a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, and the like. Processor 1100 may be a central processing unit (CPU), a microprocessor (MCU), or the like. Memory 1200 may include, for example, ROM (read-only memory), RAM (random access memory), or a non-volatile memory such as a hard disk. Interface device 1300 may include, for example, a USB interface or a headphone jack. Communication device 1400 may be capable of wired or wireless communication, specifically, Wi-Fi, Bluetooth, 2G / 3G / 4G / 5G communication, or the like. Display device 1500 may be, for example, an LCD display or a touchscreen display. Input device 1600 may include, for example, a touchscreen, a keyboard, or somatosensory input. Users may input and output voice information through speaker 1700 and microphone 1800.
[0105] Figure 1The electronic device shown is merely illustrative and does not in any way limit the present invention, its application or use. In the embodiment of the present invention, the memory 1200 of the electronic device 1000 is used to store instructions, which are used to control the processor 1100 to operate to perform any of the methods for training a machine learning model provided in the embodiment of the present invention. It should be understood by those skilled in the art that although Figure 1 While multiple devices are shown for electronic device 1000, the present invention may only relate to some of these devices. For example, electronic device 1000 may only relate to processor 1100 and storage device 1200. A skilled artisan can design instructions based on the disclosed scheme. How instructions control processor operations is well known in the art and will not be described in detail here.
[0106] <Method Example for Training Machine Learning Model>
[0107] In the overall concept of this embodiment, a scheme for training a machine learning model is provided, in which a new objective function is obtained by replacing the sum-of-squares loss function term in the semidefinite programming objective function of a pre-selected machine learning algorithm with an L1 loss function term, and machine learning training is completed according to the new objective function. Since the new objective function has stronger stability, the machine learning training performed according to the new objective function can have stronger robustness, thereby making the final machine learning model obtained more accurate.
[0108] In this embodiment, a method for training a machine learning model is provided. The method for training a machine learning model can be implemented by an electronic device. The electronic device can be Figure 1 The electronic device 1000 is shown.
[0109] according to Figure 2 As shown, the method for training a machine learning model in this embodiment may include the following steps S1000 to S3000:
[0110] Step S1000: Obtain a training sample set.
[0111] The training sample set in this embodiment may include multiple training samples, and each training sample includes its own features and corresponding annotations.
[0112] Specifically, each training sample can be generated by extracting features from the collected training data according to the processing process related to feature generation defined in the model training scheme, and then combining the features with the real results corresponding to the training data (as annotations, i.e., labels).
[0113] Step S2000: Replace the sum-of-squares loss function term in the semidefinite programming objective function of the pre-selected machine learning algorithm with the L1 loss function term to obtain a new objective function.
[0114] Semidefinite programming (SDP) studies optimization problems with convex objective functions under semidefinite constraints. Most learning algorithms that use SDP as an objective function assume that all examples in the training set have perfect side information (i.e., features). However, in real applications, training examples come from sources such as implicit user feedback and citations between articles, and these examples may contain erroneous noise. Training a machine learning algorithm with a training set containing noisy examples will inevitably reduce the performance of the resulting machine learning model, leading to inaccurate predictions.
[0115] Therefore, in this embodiment, the sum-of-squares loss function term in the semidefinite programming objective function of the selected machine learning algorithm is replaced with the L1 loss function term to obtain a new objective function. This can make the new objective function less sensitive to sample noise in the training sample set and improve the robustness of the new objective function.
[0116] Specifically, the semidefinite programming objective function of existing machine learning algorithms is usually expressed as:
[0117]
[0118] Among them, A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, and Q τ and t τ are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, X k+1 is the model parameter obtained in the kth round of iteration, k is an integer greater than 0; tr(X k+1 T AX k+1 ) can be a matrix X k+1 T AX k+1 traces.
[0119] The sum of squares loss function term in the semidefinite programming objective function Replaced with L1 loss function term The new objective function can be expressed as:
[0120]
[0121] Step S3000: According to the machine learning algorithm and the new objective function, the machine learning training is completed based on the training sample set to obtain the final machine learning model.
[0122] In an embodiment of the present invention, a new objective function is obtained by replacing the sum-of-squares loss function term in the semidefinite programming objective function of a preselected machine learning algorithm with an L1 loss function term, and machine learning training is completed according to the new objective function.
[0123] For the square sum loss function term, the result y=(tr(X k+1 T Q τ X k+1 )-t τ ) 2 With tr(X k+1 T Q τ X k+1 )-t τ The relationship curve between Figure 8 As shown in f1 in. For the L1 loss function term, the result y=|tr(X k+1 T Q τ X k+1 )-t τ |with tr(X k+1 T Q τ X k+1 )-t τ The relationship curve between Figure 8 As shown in f2 in . Figure 8 It can be seen that the linear growth rate of the L1 loss function makes it insensitive to noise, while the quadratic growth rate of the sum of squares loss function term significantly amplifies the negative effect of noise. Therefore, the L1 loss function is more robust than the sum of squares loss function term, which makes the new objective function more robust.
[0124] Since the new objective function is more robust, the machine learning training performed according to the new objective function can be more robust, and the final machine learning model obtained can be more accurate.
[0125] In one embodiment of the present invention, step S3000 may further include the following steps S3100 to S3200:
[0126] Step S3100: further add a regularization term to the new objective function to obtain the final objective function.
[0127] The regularization term may include the sum of squares of model parameters of a pre-selected machine learning algorithm.
[0128] For example, the added regularization term can be expressed as Among them, λ is a preset weight factor greater than 0. Specifically, it is equivalent to the weight factor for adjusting the fitting accuracy and generalization ability of the machine learning model.
[0129] Then, the final objective function can be expressed as:
[0130]
[0131] Among them, A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, and Q τ and t τ are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, X k+1 is the model parameter obtained in the kth round of iteration, k is an integer greater than 0; tr(X k+1 T AX k+1 ) can be a matrix X k+1 T AX k+1 , λ is a preset weight factor greater than 0.
[0132] In this embodiment, by adding a regularization term to the new objective function, the final machine learning model can be further prevented from overfitting.
[0133] The following three examples illustrate how to obtain the final objective function in a machine learning algorithm.
[0134] Example 1
[0135] In this embodiment, the machine learning algorithm is a non-parametric kernel learning algorithm (NPKL).
[0136] In the nonparametric kernel learning algorithm, given n patterns, let M be the required linked set containing pairs that should belong to the same class, and C be the unlinked set containing pairs that should not belong to the same class. This is expressed as Γ = M ∪ C. The nonparametric kernel learning algorithm constructs a kernel matrix using side information (i.e., features) and uses the following semidefinite programming objective function to learn the kernel matrix:
[0137]
[0138] Where Z is the target kernel matrix, L is the Laplacian matrix of the training data, and M and C are encoded as Let Q τ =I(:,i)(I(:,j)) T , then tr(Q τ Z)Z ij . Therefore, if (i,j)∈M then tτ =1, if (i,j)∈C then t τ =0. Can measure Z ij and t τ , tr(ZL) encourages smoothness of the data manifold by aligning Z with L.
[0139] The side information (i.e., features) in this example are links between "can" and "cannot." These links are typically provided by users and may contain errors and noise. Therefore, the sum-of-squares loss function term in the semidefinite programming objective function of the nonparametric kernel learning algorithm can be replaced with the L1 loss function term and a regularization term can be added. The final objective function can be expressed as:
[0140]
[0141] The algorithm in Example 1 (non-parametric kernel learning algorithm, NPKL) can be applied to the following application scenarios:
[0142] a) Application scenarios of image similarity comparison, such as image clustering, image classification, or image recommendation;
[0143] (b) Application scenarios of text pair similarity comparison, such as text information recommendation or text information classification.
[0144] Example 2
[0145] In this embodiment, the machine learning algorithm is a maximum variance unfolding (MVU) algorithm.
[0146] The maximum variance unfolding algorithm is an effective method for dimensionality reduction. It produces a low-dimensional representation of the data by simultaneously maximizing the variance of its embedding and preserving the local distances of the original data. The maximum variance unfolding algorithm can be viewed as a nonlinear generalization of principal component analysis. The colored maximum variance unfolding algorithm (CMVU) is a "colored" variant of the maximum variance unfolding algorithm that is influenced by class label information and is formulated as a semidefinite programming objective function as follows:
[0147]
[0148] Among them, E ij =I(:,i)-I(:,j),Q τ =E ij E ij T , d τ =d ijrepresents the Euclidean distance between the i-th and j-th objects in the original space, N represents the set of neighbor pairs whose distances will be preserved in the embedding, T is the kernel matrix of the labels, The data and labels are concentrated in the feature space, and λ controls the trade-off between maximizing dependency and preserving distance.
[0149] In this example, the side information (i.e., feature) is the local distance d from the original data. τ However, during the data collection process, outliers or corrupted samples can be introduced into the feature space. Therefore, the sum of squares loss function term in the semidefinite programming objective function of the color maximum difference extension algorithm can be replaced with the L1 loss function term, and a regularization term is further added. The final objective function can be expressed as:
[0150]
[0151] The algorithm in this embodiment 2 (maximum difference extension algorithm, MVU) can be applied to the following application scenarios:
[0152] a) Application scenarios of image similarity comparison, such as image clustering, image classification, or image recommendation;
[0153] (b) Application scenarios of text pair similarity comparison, such as text information recommendation or text information classification.
[0154] Example 3
[0155] In this embodiment, the machine learning algorithm is a sparse principal component analysis algorithm.
[0156] For a given covariance Σ (the size of the matrix Σ is the same as the size of the matrix Z), the sparse principal component analysis algorithm tries to find a sparse vector x that maximizes x T Σx, that is, the sparse principal component of Σ. The semidefinite programming objective function of the sparse principal component analysis algorithm can be expressed as:
[0157]
[0158] In this example, Z=X in the semidefinite programming objective function of the sparse principal component analysis algorithm can be k+ 1X k+1 T Decomposition, and further adding a regularization term, the final objective function can be expressed as:
[0159]
[0160] The algorithm in Example 3 (sparse principal component analysis algorithm) can be applied to the following application scenarios:
[0161] (c) Application scenarios of natural language processing, such as text semantic analysis, named entity recognition, or part-of-speech recognition.
[0162] Step S3200: According to the machine learning algorithm and the final objective function, the machine learning training is completed based on the training sample set to obtain the final machine learning model.
[0163] Since the final objective function is neither convex nor smooth, there is currently no algorithm that can solve the objective function to complete machine learning training. Therefore, in an embodiment of the present invention, according to the machine learning algorithm and the final objective function, the machine learning training is completed based on the training sample set, and the step of obtaining the final machine learning model can further include the following steps S3210 to S3230:
[0164] Step S3210: construct a substitute function for the final objective function.
[0165] In one embodiment, a convex upper bound function of the final objective function may be constructed as a replacement function based on the final objective function and preset rules, with the change increment of the model parameter as a variable.
[0166] The increment of the model parameters in the corresponding round of iterations Constructing a substitute function for the variable and constructing a convex upper bound function of the final objective function as the substitute function can facilitate solving the substitute function.
[0167] In this embodiment, the preset rules may include:
[0168] Substituting any change increment into the surrogate function and the final objective function so that the result of the surrogate function is greater than or equal to the result of the final objective function; and / or,
[0169] The result of the final objective function shows a downward trend as the number of iterations increases.
[0170] In an embodiment where the preset rule includes substituting any change increment into the substitute function and the final objective function so that the result of the substitute function is greater than or equal to the result of the final objective function, the change increment is Substituting the substitution function and the final objective function, the result of the substitution function is The final objective function result is That is to say Then, for any increment of change
[0171] In the embodiment where the preset rule includes making the result of the final objective function show a downward trend as the number of iterations increases, the change increment can be Substituting the substitution function and the final objective function, the result of the substitution function is The final objective function result is That is to say In the case of , the result of the substitution function The result of the final objective function The increment of change when the difference between the two values takes the minimum value The value of is 0, that is And in the changing increment When it is 0, the result of the replacement function is Equal to the result of the final objective function Right now In this way, it can be ensured that when optimizing the substitute function, the result of the final objective function shows a downward trend as the number of iterations increases, which is equivalent to ensuring that the final objective function converges.
[0172] In one example, let For any increment of change (where the matrix The size of the matrix X k 、X k+1 The upper bound of the final objective function based on the above formula (1) can be shown as formula (2):
[0173]
[0174] Due to the item Only when Q τ ∈S + It is convex only when S + is a cone of positive semidefinite (PSD) matrices, but this is not guaranteed. Therefore, the upper bound constructed in this embodiment is not convex.
[0175] Assume (γ i ,v i ) is the eigenpair of the symmetric matrix M, which can be expressed as + and M _ They represent the positive eigenvalue and negative eigenvalue of the symmetric matrix M respectively. Therefore, M = M + +M _ To solve this problem, we can use the following formula (3):
[0176]
[0177] Combining formula (2) and formula (3), the obtained substitution function can be expressed as:
[0178]
[0179]
[0180]
[0181]
[0182]
[0183] in, is the change increment corresponding to the kth round of iteration, k is an integer greater than 0, A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, Q τ and t τ are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, I is the unit matrix, X k is the model parameter before the kth round of iteration, X k+1 is the model parameter obtained in the kth round of iteration, and λ is the preset weight factor.
[0184] Step S3220: Solve the substitution function based on the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration.
[0185] In one embodiment, the step of solving the substitution function may further include steps S3221 to S3222 as follows:
[0186] Step S3221, setting the initial model parameter values of the machine learning model.
[0187] The initial model parameter value of the machine learning model can be set according to the application scenario or specific needs. For example, the set initial model parameter value can be X1.
[0188] In step S3222, the substitution function is solved according to the initial model parameter values and the training sample set to obtain the change increment corresponding to each round of iteration process.
[0189] The change increment corresponding to the k-th round of iteration obtained in step S3222 can be
[0190] Step S3230: Update the model parameters of the machine learning model according to the incremental changes corresponding to each round of iteration, complete the machine learning training, and obtain the final machine learning model.
[0191] In one embodiment, step S3230 may further include steps S3231 to S3232 as follows:
[0192] Step S3231: Update the model parameters of the machine learning model according to the incremental changes corresponding to each round of iteration.
[0193] Specifically, the model parameters can be updated through the following formula:
[0194]
[0195] in, is the change increment corresponding to the k-th iteration process, X k is the model parameter before the kth round of iteration, X k+1 is the model parameter obtained in the kth round of iteration, where k is an integer greater than 0.
[0196] For the first (k=1) round of iteration, the substitution function can be solved based on the initial model parameter value X1 and the training sample set to obtain the change increment corresponding to the first round of iteration. Then, the model parameters obtained in the first round of iteration can be
[0197] For the kth (k>1) round of iteration, the model parameter X obtained from the (k-1) round of iteration can be k , and the training sample set to solve the substitution function and obtain the change increment corresponding to the k-th round of iteration process Then, the model parameters obtained in the k-th round of iteration can be
[0198] Step S3232: When the preset convergence conditions are met, the machine learning training is completed to obtain the final machine learning model.
[0199] In one embodiment, the convergence conditions may include:
[0200] The number of iterations of machine learning training reaches a preset threshold;
[0201] and / or,
[0202] The training result value of the updated model parameter is less than a preset result threshold, wherein the training result value is determined according to the result obtained by substituting the updated model parameter into the final objective function.
[0203] In embodiments where the convergence condition includes the number of iterations of executing machine learning training reaching a preset threshold, the threshold can be set based on the application scenario or specific needs. For example, the threshold can be set to 100. Then, when the number of iterations of executing machine learning training reaches 100, the machine learning training is completed and the final machine learning model is obtained.
[0204] In the embodiment where the convergence condition includes the training result value of the updated model parameters being less than a preset result threshold, the result threshold can be set according to the application scenario or specific requirements. For example, the result threshold can be set to a, then the model parameters obtained in each round of iteration are substituted into the final objective function. If the model parameters obtained in the k-1th iteration are Substituting into the final objective function, the training result value is If the model parameter X obtained in the kth iteration is greater than a, the kth iteration process will continue. k+1 Substituting into the final objective function, the training result value is Less than or equal to a, then the machine learning training can be completed, and the model parameters X obtained according to the k-th iteration process k+1 Get the final machine learning model.
[0205] In one embodiment, the method for solving the substitution function in step S3222 may further include:
[0206] In each round of iteration, the model parameters and training sample set before the current round of iteration are substituted into the substitution function, and the value of the change increment when the result of the substitution function takes the minimum value is obtained as the change increment corresponding to the current round of iteration.
[0207] In this embodiment, the model parameters can be updated by the following formula (4):
[0208]
[0209] in, is the change increment corresponding to the k-th iteration process, for The increment of change when the result takes the minimum value The value of X k is the model parameter before the kth round of iteration, X k+1 is the model parameter obtained in the kth round of iteration, where k is an integer greater than 0.
[0210] Specifically, the alternative function can be solved by the alternating direction multiplier method or the accelerated proximal gradient algorithm to obtain The increment of change when the result takes the minimum value Value
[0211] In an embodiment where the substitution function is solved by the alternating direction multiplier method, the substitution function can be Rephrased as:
[0212]
[0213] The change increment can be easily checked by solving the augmented Lagrangian of Equation (5) using the alternating direction multiplier method.
[0214] In an embodiment where the surrogate function is solved by an accelerated proximal gradient algorithm, ||x||1=inf z x T z:||z|| ∞ ≤1, the substitution function can be derived from the following formula (6) Dual form
[0215]
[0216] Formula (6) can be given by the following formula (7):
[0217]
[0218] Since the dual problem is a smooth and convex optimization problem with simple box constraints, it can be solved by accelerating the proximal gradient algorithm and recovering
[0219] In this embodiment, by constructing a substitute function for the final objective function and solving the substitute function to obtain the incremental change of the model parameters corresponding to each round of iteration, the model parameters of the machine learning model are updated according to the incremental change corresponding to each round of iteration to complete the machine learning training. In this way, it can be ensured that the final objective function can converge to the critical point.
[0220] In a specific embodiment of the present invention, the training sample set obtained in step S1000 may include: a dataset of annotated text samples, where the annotations may include semantics, named entity names, or part-of-speech information; and a dataset of features of the text sample data, i.e., the text sample data set includes the features of each text sample data and the corresponding annotations. The resulting machine learning model can then be used for natural language processing.
[0221] In this embodiment, natural language processing specifically includes but is not limited to: text semantic analysis, named entity recognition, part-of-speech recognition, etc.
[0222] In another specific embodiment of the present invention, the training sample set obtained in step S1000 may include: a set of labeled text sample pairs, wherein the labels are information indicating whether the text sample pairs are similar; and the text sample pair set may be a collection of features of the text sample pairs, i.e., the text sample pair set includes the features of each text sample pair and the corresponding labels. The resulting machine learning model can then be used to predict the similarity between the text sample pairs.
[0223] In another specific embodiment of the present invention, the training sample set obtained in step S1000 may include: a set of labeled image sample pairs, wherein the labels are information indicating whether the image sample pairs are similar; and the image sample pair set may be a collection of features of the image sample pairs, i.e., the image sample pair set includes the features of each image sample pair and the corresponding labels. The resulting machine learning model can then be used to determine the similarity between the image sample pairs.
[0224] Based on the above embodiment, before executing step S1000, the method may further include steps S1100 to S1200 as follows:
[0225] Step S1100, providing a setting entry for setting the application scenario of the machine learning model.
[0226] Users can determine the specific application scenarios for the machine learning model based on their needs and enter the application scenarios through the settings portal. Examples of these application scenarios include (a) image clustering, image classification, or image recommendation, where similarity comparisons are performed on image pairs; (b) text recommendation or classification, where similarity comparisons are performed on text pairs; and (c) natural language processing, such as text semantic analysis, named entity recognition, or part-of-speech recognition.
[0227] Step S1200: Acquire the application scenario input through the setting entry.
[0228] Then, step S1000 may be further performed as follows: obtaining a corresponding training sample set according to the input application scenario.
[0229] Specifically, training data may be pre-stored in the electronic device that implements the embodiment of the present invention. The training data may be acquired within a preset historical period or input by the user. The training data may be, for example, text data, image data, etc. Based on the input application scenario, the electronic device determines the type of feature to be extracted in the application scenario, extracts corresponding features and annotations from the training data based on the feature type, and obtains a corresponding training sample set. Machine learning training based on the training sample set that matches the application scenario can make the final machine learning model applicable to the input application scenario.
[0230] In this embodiment, if the application scenario obtained through step S1200 is an application scenario of similarity comparison of image pairs, or an application scenario of similarity comparison of text pairs, the machine learning algorithm pre-selected in step S2000 can be the non-parametric kernel learning algorithm in the aforementioned embodiment 1, or the maximum difference extension algorithm in the aforementioned embodiment 2, and the corresponding final objective function is obtained through the method in the aforementioned embodiment 1 or embodiment 2, and machine learning training is performed to obtain the final machine learning model suitable for the application scenario of similarity comparison of image pairs or the application scenario of similarity comparison of text pairs.
[0231] If the application scenario obtained through step S1200 is an application scenario for natural language processing, the machine learning algorithm pre-selected in step S2000 can be a sparse principal component analysis algorithm such as the one in the aforementioned embodiment 3, and the corresponding final objective function can be obtained by the method in the aforementioned embodiment 3, and machine learning training can be performed to obtain a final machine learning model suitable for the application scenario of natural language processing.
[0232] After obtaining the final machine learning model through the above embodiment, the method may further include steps S1300 to S1500 as shown below:
[0233] Step S1300: Determine the application scenario to which the final machine learning model is applicable.
[0234] Step S1400: searching for application projects that match the application scenario.
[0235] Step S1500: input the final machine learning model into the application project.
[0236] In this embodiment, the final machine learning model is input into an application project that matches the application scenario to which it is applicable, so that the final machine learning model is used in the corresponding application project to process sample information in the application project.
[0237] Specifically, the application project that matches the application scenario applicable to the final machine learning model can be a natural language processing project, and the input information in the natural language processing project can be text. Then, the final machine learning model is input into the natural language processing project, and the final machine learning model can be used to perform natural language processing on the text in the natural language processing project.
[0238] The application project that matches the application scenario applicable to the final machine learning model can also be a similarity comparison project. The input information in the similarity comparison project can be a text pair or an image pair. Then, the final machine learning model is input into the similarity comparison project, and the final machine learning model can be used to predict the similarity between the text pairs or image pairs in the similarity comparison project.
[0239] <Example>
[0240] The following will be combined Figure 3 The method for training a machine learning model provided in this embodiment is further explained.
[0241] Step S3001, providing a setting entry for setting the application scenario of the machine learning model.
[0242] Step S3002: Acquire the application scenario input through the setting entry.
[0243] For example, the application scenario of user input may be similarity comparison of image pairs.
[0244] Step S3003: Acquire a training sample set that matches the application scenario.
[0245] In the application scenario of image pair similarity comparison, the feature type that needs to be extracted can be, for example, the Histogram of Oriented Gradient (HOG) feature. Based on this feature type, the Histogram of Oriented Gradient features and corresponding annotations of each image sample pair can be extracted from pre-acquired training data (e.g., multiple image sample pairs) to obtain a training sample set.
[0246] Step S3004: Replace the sum-of-squares loss function term in the semidefinite programming objective function of the pre-selected machine learning algorithm with the L1 loss function term to obtain a new objective function.
[0247] Specifically, the semidefinite programming objective function of existing machine learning algorithms is usually expressed as:
[0248]
[0249] The sum of squares loss function term in the semidefinite programming objective function Replaced with L1 loss function term The new objective function can be expressed as:
[0250]
[0251] Among them, A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, and Q τ is the directional gradient histogram feature of the τth image sample pair, t τ The label corresponding to the τth image sample pair, m is the number of image sample pairs contained in the training sample set, X k+1 is the model parameter obtained in the kth round of iteration, k is an integer greater than 0; tr(X k+1 T AX k+1 ) can be a matrix X k+1 T AX k+1 traces.
[0252] Step S3005: further add a regularization term to the new objective function to obtain the final objective function.
[0253] The final objective function can be expressed as:
[0254]
[0255] Among them, A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, and Q τ is the directional gradient histogram feature of the τth image sample pair, t τ The label corresponding to the τth image sample pair, m is the number of image sample pairs contained in the training sample set, X k+1 is the model parameter obtained in the kth round of iteration, k is an integer greater than 0; tr(X k+1 T AX k+1 ) can be a matrix X k+1 T AX k+1 , λ is the preset weight factor.
[0256] Step S3006: construct a substitute function for the final objective function.
[0257]
[0258]
[0259]
[0260]
[0261]
[0262] in, is the change increment corresponding to the kth round of iteration, k is an integer greater than 0, A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, Q τ is the directional gradient histogram feature of the τth image sample pair, t τ The label corresponding to the τth image sample pair, m is the number of image sample pairs contained in the training sample set, I is the unit matrix, X k is the model parameter before the kth round of iteration, X k+1 is the model parameter obtained in the kth round of iteration, and λ is the preset weight factor.
[0263] Step S3007: solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process.
[0264] In each round of iteration, the model parameters and training sample set before the current round of iteration are substituted into the substitution function, and the value of the change increment when the result of the substitution function takes the minimum value is obtained as the change increment corresponding to the current round of iteration.
[0265] Specifically, the substitution function may be solved by an alternating direction multiplier method or an accelerated proximal gradient algorithm.
[0266] Step S3008: Update the model parameters of the machine learning model according to the change increment corresponding to each round of iterative process.
[0267] In this embodiment, the model parameters can be updated using the following formula:
[0268]
[0269] in, is the change increment corresponding to the k-th iteration process, for The increment of change when the result takes the minimum value The value of X k is the model parameter before the kth iteration process, X k+1 is the model parameter obtained in the kth round of iteration, where k is an integer greater than 0.
[0270] Step S3009: When the preset convergence conditions are met, the machine learning training is completed to obtain the final machine learning model.
[0271] Convergence conditions can include:
[0272] The number of iterations of machine learning training reaches a preset threshold;
[0273] and / or,
[0274] The training result value of the updated model parameter is less than a preset result threshold, wherein the training result value is determined according to the result obtained by substituting the updated model parameter into the final objective function.
[0275] Step S3010: Determine the application scenario to which the final machine learning model is applicable.
[0276] The application scenario to which the final machine learning model is applicable may be the application scenario obtained in step S3002 and input through the provided setting entry, that is, the similarity comparison scenario of image pairs.
[0277] Step S3011: Search for application projects that match the application scenario.
[0278] Step S3012: input the final machine learning model into the application project to use the final machine learning model to perform predictive processing on the data input into the application project.
[0279] By inputting the final machine learning model into an application project for image similarity comparison, the final machine learning model can be used to predict and process the similarities between the image pairs input into the application project.
[0280] <Information Processing Method Example>
[0281] The present invention also provides an information processing method, which may include: Figure 3 Steps S4100 to S4300 are shown:
[0282] Step S4100: Obtain sample information to be processed.
[0283] Step S4200: Obtain a machine learning model for processing the sample information to be processed.
[0284] Among them, the machine learning model is the final machine learning model obtained through the above embodiment.
[0285] Step S4300: Use the machine learning model to process the sample information to be processed.
[0286] In one embodiment, the sample information to be processed may include sample data to be subjected to natural language processing. Then, processing the sample information to be processed using the machine learning model may further include: using the machine learning model to perform semantic analysis, named entity recognition, or part-of-speech recognition and other natural language processing on the sample data to be subjected to natural language processing.
[0287] In another embodiment, the sample information to be processed may include pairs of text samples or image samples to be compared for similarity. Processing the sample information using the machine learning model may further include predicting the similarity between the pairs of text samples or image samples using the machine learning model. Clustering, classification, or recommendation may then be performed on the text samples or image samples to be processed based on the predicted similarity.
[0288] <Embodiment of a device for training a machine learning model>
[0289] In this embodiment, a device 5000 for training a machine learning model is provided, such as Figure 5 As shown, it includes a training sample acquisition module 5100, an objective function determination module 5200, and a machine learning training module 5300. The training sample acquisition module 5100 is used to obtain a training sample set; the objective function determination module 5200 is used to replace the sum of squares loss function term in the semidefinite programming objective function of a pre-selected machine learning algorithm with an L1 loss function term to obtain a new objective function; the machine learning training module 5300 is used to complete machine learning training based on the training sample set according to the machine learning algorithm and the new objective function to obtain a final machine learning model.
[0290] In one embodiment, the machine learning training module 5300 may further include:
[0291] A module for further adding a regularization term to the new objective function to obtain a final objective function, wherein the regularization term includes the sum of squares of model parameters of a pre-selected machine learning algorithm;
[0292] A module used to complete machine learning training based on the training sample set according to the machine learning algorithm and the final objective function to obtain the final machine learning model.
[0293] In one embodiment, according to the machine learning algorithm and the final objective function, completing machine learning training based on the training sample set to obtain a machine learning model may include:
[0294] Construct a surrogate function for the final objective function;
[0295] Solve the substitution function based on the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration;
[0296] According to the incremental changes corresponding to each round of iteration, the model parameters of the machine learning model are updated, the machine learning training is completed, and the final machine learning model is obtained.
[0297] In one embodiment, constructing a surrogate function for the final objective function may include:
[0298] According to the final objective function and the preset rules, the convex upper bound function of the final objective function is constructed as a replacement function with the change increment of the model parameters as the variable.
[0299] In one embodiment, the preset rules may include:
[0300] Substituting any change increment into the surrogate function and the final objective function so that the result of the surrogate function is greater than or equal to the result of the final objective function; and / or,
[0301] The result of the final objective function shows a downward trend as the number of iterations increases.
[0302] In one embodiment, solving the substitution function based on the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration may include:
[0303] Set the initial model parameter values of the machine learning model;
[0304] The substitution function is solved according to the set initial model parameter values and the training sample set to obtain the change increment corresponding to each round of iterative process.
[0305] In one embodiment, solving the substitution function based on the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iteration may include:
[0306] The surrogate function is solved by the alternating direction multiplier method or the accelerated proximal gradient algorithm.
[0307] In one embodiment, solving the substitution function based on the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iteration may include:
[0308] In each round of iteration, the model parameters and training sample set before the current round of iteration are substituted into the substitution function, and the value of the change increment when the result of the substitution function takes the minimum value is obtained as the change increment corresponding to the current round of iteration.
[0309] In one embodiment, updating the model parameters of the machine learning model according to the incremental change corresponding to each round of iteration to complete the machine learning training and obtain the final machine learning model may include:
[0310] Update the model parameters of the machine learning model according to the incremental changes corresponding to each round of iteration;
[0311] When the preset convergence conditions are met, the machine learning training is completed and the final machine learning model is obtained.
[0312] In one embodiment, the convergence conditions may include:
[0313] The number of iterations of machine learning training reaches a preset threshold;
[0314] and / or,
[0315] The training result value of the updated model parameter is less than a preset result threshold, wherein the training result value is determined according to the result obtained by substituting the updated model parameter into the final objective function.
[0316] In one embodiment, the final objective function can be expressed as:
[0317]
[0318]
[0319] The substitution function can be expressed as:
[0320]
[0321]
[0322]
[0323]
[0324]
[0325] in, is the change increment corresponding to the kth round of iteration, k is an integer greater than zero; A is a symmetric matrix, γ is the hyperparameter of the machine learning algorithm, Q τ and t τ are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, I is the unit matrix, X k is the model parameter before the kth iteration process, X k+1 is the model parameter obtained in the kth round of iteration, and λ is the preset weight factor.
[0326] In one embodiment, obtaining a training sample set includes: obtaining a labeled text sample data set;
[0327] The final machine learning model is used for natural language processing.
[0328] In one embodiment, obtaining a training sample set includes: obtaining a set of labeled text sample pairs, wherein the labels are information indicating whether the text sample pairs are similar;
[0329] The final machine learning model is used to predict similarities between texts;
[0330] or,
[0331] Acquiring a training sample set includes: acquiring a set of labeled image sample pairs, wherein the labels are information indicating whether the image sample pairs are similar;
[0332] The final machine learning model is used to predict similarities between images.
[0333] In one embodiment, the apparatus 5000 may further include:
[0334] A module for providing a setting entry for setting application scenarios of machine learning models;
[0335] A module for obtaining application scenarios input through setting entry;
[0336] The training sample acquisition module 5100 may also be used to acquire a corresponding training sample set according to an input application scenario.
[0337] In one embodiment, the apparatus 5000 may further include:
[0338] A module for determining the application scenarios for which the final machine learning model is applicable;
[0339] A module for finding application projects that match the application scenario;
[0340] A module for inputting the final machine learning model into an application project.
[0341] Those skilled in the art should understand that the apparatus 5000 for training a machine learning model can be implemented in various ways. For example, the apparatus 5000 for training a machine learning model can be implemented by configuring a processor with instructions. For example, instructions can be stored in a ROM, and when the device is started, the instructions are read from the ROM into a programmable device to implement the apparatus 5000 for training a machine learning model. For example, the apparatus 5000 for training a machine learning model can be solidified into a dedicated device (such as an ASIC). The apparatus 5000 for training a machine learning model can be divided into independent units, or they can be combined together for implementation. The apparatus 5000 for training a machine learning model can be implemented by one of the various implementations described above, or can be implemented by a combination of two or more of the various implementations described above.
[0342] In this embodiment, the device 5000 for training a machine learning model can have multiple implementation forms. For example, the device 5000 for training a machine learning model can be a functional module running in any software product or application that provides network access services, or it can be an embedded peripheral, plug-in, patch, etc. of these software products or applications, or it can be these software products or applications themselves.
[0343] <Information Processing Device Embodiment>
[0344] In this embodiment, an information processing device 6000 is provided. Figure 6 As shown, it includes a sample acquisition module 6100 for processing, a model acquisition module 6200, and an information processing module 6300. The sample acquisition module 6100 for processing is used to obtain sample information to be processed; the model acquisition module 6200 is used to obtain a machine learning model for processing the sample information to be processed, wherein the machine learning model is the final machine learning model obtained through the aforementioned embodiments; and the information processing module 6300 is used to process the sample information to be processed using the machine learning model.
[0345] In one embodiment, the sample information to be processed includes sample data to be subjected to natural language processing; the information processing module 6300 can be used to perform natural language processing on the sample data using a machine learning model.
[0346] In another embodiment, the sample information to be processed includes text sample pairs or image sample pairs to be compared for similarity; the information processing module 6300 can be used to: use a machine learning model to predict the similarity between text sample pairs or image sample pairs.
[0347] Those skilled in the art will appreciate that the information processing device 6000 can be implemented in various ways. For example, the information processing device 6000 can be implemented by configuring a processor with instructions. For example, instructions can be stored in a ROM, and when the device is started, the instructions are read from the ROM into a programmable device to implement the information processing device 6000. For example, the information processing device 6000 can be embedded in a dedicated device (such as an ASIC). The information processing device 6000 can be divided into independent units, or they can be combined together for implementation. The information processing device 6000 can be implemented by one of the various implementations described above, or by a combination of two or more of the various implementations described above.
[0348] In this embodiment, the information processing device 6000 can have multiple implementation forms. For example, the information processing device 6000 can be a functional module running in any software product or application that provides network access services, or it can be a peripheral embedded component, plug-in, patch, etc. of these software products or applications, or it can be these software products or applications themselves.
[0349] <Electronic equipment>
[0350] In this embodiment, an electronic device 7000 is also provided. The electronic device 7000 may be Figure 1 The electronic device 1000 is shown.
[0351] On the one hand, the electronic device 7000 may include the aforementioned device 5000 for training a machine learning model, for implementing the method for training a machine learning model of any embodiment of the present invention; or may include the aforementioned information processing device 6000, for implementing the information processing method of any embodiment of the present invention.
[0352] On the other hand, Figure 7 As shown, the electronic device 7000 may also include a processor 7100 and a memory 7200, wherein the memory 7200 is used to store executable instructions; the processor 7100 is used to control the operation of the electronic device 7000 to execute the method for training a machine learning model or the sound information processing method according to any embodiment of the present invention.
[0353] In this embodiment, the electronic device 7000 can be a mobile phone, a tablet computer, a PDA, a desktop computer, a laptop computer, a workstation, a game console, or other device.
[0354] <Computer-readable storage medium>
[0355] In this embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the method for training a machine learning model or the sound information processing method as in any embodiment of the present invention.
[0356] The present invention may be a device, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.
[0357] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
[0358] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0359] The computer program instructions for performing the operation of the present invention can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. The computer readable program instructions can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), is personalized by utilizing the state information of the computer readable program instructions, and the electronic circuit can execute the computer readable program instructions, thereby realizing various aspects of the present invention.
[0360] Various aspects of the present invention are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0361] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0362] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0363] The flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment or part of an instruction, and the module, program segment or part of the instruction contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, implementation by software, and implementation by a combination of software and hardware are all equivalent.
[0364] While various embodiments of the present invention have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of the present invention is defined by the appended claims.
Claims
1. A method for training a machine learning model, characterized in that include: Obtain a training sample set; The training sample set is a text sample data set or an image sample data set; The sum-of-squares loss function term in the semidefinite programming objective function of the pre-selected machine learning algorithm is replaced with the L1 loss function term to obtain a new objective function; According to the machine learning algorithm and the new objective function, completing machine learning training based on the training sample set to obtain a final machine learning model; The method further comprises: Further adding a regularization term to the new objective function to obtain a final objective function, wherein the regularization term includes the sum of squares of model parameters of the pre-selected machine learning algorithm; According to the machine learning algorithm and the final objective function, completing machine learning training based on the training sample set to obtain a final machine learning model; The final machine learning model is used to perform natural language processing or image processing.
2. The method according to claim 1, characterized in that The step of completing machine learning training based on the training sample set according to the machine learning algorithm and the final objective function to obtain a machine learning model includes: Construct a surrogate function for the final objective function; Solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process; According to the incremental changes corresponding to each round of iteration, the model parameters of the machine learning model are updated, the machine learning training is completed, and the final machine learning model is obtained.
3. The method according to claim 2, characterized in that The step of constructing a substitute function for the final objective function comprises: According to the final objective function and preset rules, a convex upper bound function of the final objective function is constructed with the change increment of the model parameter as a variable, as the replacement function.
4. The method according to claim 3, characterized in that The preset rules include: Substituting any change increment into the substitution function and the final objective function so that the result of the substitution function is greater than or equal to the result of the final objective function; and / or, The result of the final objective function shows a downward trend as the number of iterations increases.
5. The method according to claim 2, characterized in that The step of solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process includes: Set the initial model parameter values of the machine learning model; The substitution function is solved according to the set initial model parameter values and the training sample set to obtain the change increment corresponding to each round of iterative process.
6. The method according to claim 5, characterized in that The step of solving the substitution function according to the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iterative process includes: The surrogate function is solved by the alternating direction multiplier method or the accelerated proximal gradient algorithm.
7. The method according to claim 5, characterized in that The step of solving the substitution function according to the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iterative process includes: In each round of iteration, the model parameters before the current round of iteration and the training sample set are substituted into the substitution function, and the value of the change increment when the result of the substitution function takes the minimum value is obtained as the change increment corresponding to the current round of iteration.
8. The method according to claim 2, characterized in that The steps of updating the model parameters of the machine learning model according to the change increment corresponding to each round of iterative process, completing the machine learning training, and obtaining the final machine learning model include: Updating the model parameters of the machine learning model according to the incremental changes corresponding to each round of iteration; When the preset convergence conditions are met, the machine learning training is completed and the final machine learning model is obtained.
9. The method according to claim 8, characterized in that The convergence conditions include: The number of iterations of machine learning training reaches a preset threshold; and / or, The training result value of the updated model parameter is less than a preset result threshold, wherein the training result value is determined based on the result obtained by substituting the updated model parameter into the final objective function.
10. The method according to claim 4, characterized in that The final objective function is expressed as: The substitution function is expressed as: in, is the change increment corresponding to the k-th iteration process, where k is an integer greater than zero; is a symmetric matrix, is the hyperparameter of the machine learning algorithm, and are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, is the identity matrix, is the model parameter before the kth round of iteration, is the model parameter obtained in the k-th round of iteration, is the preset weight factor.
11. The method according to any one of claims 1 to 10, characterized in that The obtaining of the training sample set includes: obtaining a labeled text sample data set; The final machine learning model is used to perform natural language processing.
12. The method according to any one of claims 1 to 10, characterized in that The acquiring of the training sample set comprises: acquiring a set of labeled text sample pairs, wherein the labels are information indicating whether the text sample pairs are similar; The final machine learning model is used to predict the similarity between texts; or, The acquiring of the training sample set comprises: acquiring a set of labeled image sample pairs, wherein the labels are information indicating whether the image sample pairs are similar; The final machine learning model is used to predict similarities between images.
13. The method according to any one of claims 1 to 10, characterized in that The method further comprises: Provides a setting entry for setting application scenarios of machine learning models; Obtain the application scenario input through the setting entry; The step of obtaining a training sample set includes: obtaining a corresponding training sample set according to the input application scenario.
14. The method according to any one of claims 1 to 10, characterized in that After obtaining the final machine learning model, the method further includes: Determining application scenarios for which the final machine learning model is applicable; Searching for application projects that match the application scenario; The final machine learning model is input into the application project.
15. An information processing method, characterized in that: include: Obtain information about samples to be processed; Obtaining a machine learning model for processing the sample information to be processed, wherein the machine learning model is the final machine learning model obtained according to any one of claims 1 to 14; The machine learning model is used to process the sample information to be processed.
16. The method according to claim 15, characterized in that The obtaining of sample information to be processed includes: obtaining sample data to be processed by natural language processing; The step of processing the sample information to be processed using the machine learning model includes: performing natural language processing on the sample data using the machine learning model.
17. The method according to claim 15, characterized in that The obtaining of sample information to be processed includes: obtaining a text sample pair or an image sample pair to be compared for similarity; The step of processing the sample information to be processed by using the machine learning model includes: using the machine learning model to predict the similarity between the text sample pairs or image sample pairs.
18. A device for training a machine learning model, characterized in that include: A training sample acquisition module is used to obtain a training sample set; The training sample set is a text sample data set or an image sample data set; An objective function determination module is used to replace the sum-of-squares loss function term in the semidefinite programming objective function of a pre-selected machine learning algorithm with the L1 loss function term to obtain a new objective function; A machine learning training module, configured to complete machine learning training based on the training sample set according to the machine learning algorithm and the new objective function to obtain a final machine learning model; The machine learning training module is also used to: Further adding a regularization term to the new objective function to obtain a final objective function, wherein the regularization term includes the sum of squares of model parameters of the pre-selected machine learning algorithm; According to the machine learning algorithm and the final objective function, completing machine learning training based on the training sample set to obtain a final machine learning model; The final machine learning model is used to perform natural language processing or image processing.
19. The device according to claim 18, characterized in that The method of completing machine learning training based on the training sample set according to the machine learning algorithm and the final objective function to obtain a machine learning model includes: Construct a surrogate function for the final objective function; Solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process; According to the incremental changes corresponding to each round of iteration, the model parameters of the machine learning model are updated, the machine learning training is completed, and the final machine learning model is obtained.
20. The device according to claim 19, characterized in that The alternative function for constructing the final objective function includes: According to the final objective function and preset rules, a convex upper bound function of the final objective function is constructed with the change increment of the model parameter as a variable, as the replacement function.
21. The device according to claim 20, characterized in that The preset rules include: Substituting any change increment into the substitution function and the final objective function so that the result of the substitution function is greater than or equal to the result of the final objective function; and / or, The result of the final objective function shows a downward trend as the number of iterations increases.
22. The device according to claim 19, characterized in that Solving the substitution function according to the training sample set to obtain the change increment of the model parameters corresponding to each round of iteration process includes: Set the initial model parameter values of the machine learning model; The substitution function is solved according to the set initial model parameter values and the training sample set to obtain the change increment corresponding to each round of iterative process.
23. The device according to claim 22, characterized in that Solving the substitution function based on the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iterative process includes: The surrogate function is solved by the alternating direction multiplier method or the accelerated proximal gradient algorithm.
24. The device according to claim 22, characterized in that Solving the substitution function based on the set initial values of the model parameters and the training sample set to obtain the change increment corresponding to each round of iterative process includes: In each round of iteration, the model parameters before the current round of iteration and the training sample set are substituted into the substitution function, and the value of the change increment when the result of the substitution function takes the minimum value is obtained as the change increment corresponding to the current round of iteration.
25. The device according to claim 19, characterized in that The updating of the model parameters of the machine learning model according to the change increment corresponding to each round of iterative process, completing the machine learning training, and obtaining the final machine learning model includes: Updating the model parameters of the machine learning model according to the incremental changes corresponding to each round of iteration; When the preset convergence conditions are met, the machine learning training is completed and the final machine learning model is obtained.
26. The device according to claim 25, characterized in that The convergence conditions include: The number of iterations of machine learning training reaches a preset threshold; and / or, The training result value of the updated model parameter is less than a preset result threshold, wherein the training result value is determined based on the result obtained by substituting the updated model parameter into the final objective function.
27. The device according to claim 21, characterized in that The final objective function is expressed as: The substitution function is expressed as: in, is the change increment corresponding to the k-th iteration process, where k is an integer greater than zero; is a symmetric matrix, is the hyperparameter of the machine learning algorithm, and are the corresponding features and labels of the τth sample in the training sample set, m is the number of samples contained in the training sample set, is the identity matrix, is the model parameter before the kth round of iteration, is the model parameter obtained in the k-th round of iteration, is the preset weight factor.
28. The device according to any one of claims 18 to 27, characterized in that The training sample acquisition module is further used to: obtain a labeled text sample data set; The final machine learning model is used to perform natural language processing.
29. The device according to any one of claims 18 to 27, characterized in that The training sample acquisition module is further configured to: acquire a set of labeled text sample pairs, wherein the labels are information indicating whether the text sample pairs are similar; The final machine learning model is used to predict the similarity between texts; or, The training sample acquisition module is further configured to: acquire a set of labeled image sample pairs, wherein the labels are information indicating whether the image sample pairs are similar; The final machine learning model is used to predict similarities between images.
30. The device according to any one of claims 18 to 27, characterized in that The device further comprises: A module for providing a setting entry for setting application scenarios of machine learning models; A module for obtaining an application scenario input through the setting entry; The training sample acquisition module is further configured to: acquire a corresponding training sample set according to the input application scenario.
31. The device according to any one of claims 18 to 27, characterized in that The device further comprises: A module for determining the application scenario to which the final machine learning model is applicable; A module for searching for application projects that match the application scenario; A module for inputting the final machine learning model into the application project.
32. An information processing device, characterized in that include: A sample acquisition module to be processed is used to obtain information of samples to be processed; a model acquisition module, configured to acquire a machine learning model for processing the sample information to be processed, wherein the machine learning model is a final machine learning model obtained as described in any one of claims 18 to 31; An information processing module is used to process the sample information to be processed using the machine learning model.
33. The device according to claim 32, characterized in that The to-be-processed sample acquisition module is further used to: acquire sample data to be processed by natural language processing; The information processing module is also used to: use the machine learning model to perform natural language processing on the sample data.
34. The device according to claim 32, characterized in that The to-be-processed sample acquisition module is further configured to: acquire a text sample pair or an image sample pair to be compared for similarity; The information processing module is further used to: use the machine learning model to predict the similarity between the text sample pairs or image sample pairs.
35. An electronic device, characterized in that: include An apparatus for training a machine learning model as claimed in any one of claims 18 to 31; or The information processing device according to any one of claims 32 to 34; or A processor and a memory, wherein the memory is used to store instructions, and the instructions are used to control the processor to execute the method according to any one of claims 1 to 17.
36. A computer-readable storage medium, characterized in that A computer program is stored thereon, which implements the method according to any one of claims 1 to 17 when executed by a processor.
Citation Information
Patent Citations
Chemical process fault classification method based on nuclear learning
CN107544447A
Training method and device for depth learning model
CN109034365A