Method for searching optimal hyper-parameter combination of machine learning model
By dynamically adjusting the amount of training data and weighting coefficients, the time-consuming problem of hyperparameter combination search in machine learning models is solved, achieving faster search and more efficient model optimization.
Patent Information
- Application Number
- CN202410392750.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-04-01
- Filing Date
- 2024-04-02
- Publication Date
- 2024-10-15
AI Technical Summary
In the hyperparameter optimization process of machine learning models, as the amount of training data increases, the time to search for the optimal hyperparameter combination increases significantly, and complex hyperparameter combinations require a long time to evaluate their performance, which is time-consuming and labor-intensive.
By dynamically adjusting the amount of training data, only a part of the training data is used to measure the performance of the hyperparameter combination, and the weighting coefficient is used to gradually increase the amount of training data to accelerate the search for hyperparameter combinations, ensuring the accuracy and efficiency of performance evaluation.
The execution time of the training phase is reduced, allowing a faster search for optimal hyperparameter combinations or increasing the number of combinations to be tested, ensuring the quality and performance of the optimal model.
Smart Images

Figure CN118780389A_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims the benefit of French Patent Application No. 2303291 filed on April 3, 2023, which is incorporated herein by reference. Technical Field
[0003] An embodiment relates to a method for searching for an optimal hyperparameter combination for a machine learning model. Background Art
[0004] Machine learning is a branch of artificial intelligence that enables computing systems to learn from data without being explicitly programmed to perform a given task.
[0005] Machine learning enables machines to acquire knowledge and skills from data sets in order to perform predictions, classifications, or other types of processing operations on new data.
[0006] A machine learning model is a mathematical representation of a system or process that enables a machine to learn from data.
[0007] The model is created using a machine learning algorithm that learns from a set of training data to produce a predicted output for a given input.
[0008] The choice of model depends on the type of problem to be solved and the characteristics of the available data. There are different types of machine learning models. For example, linear models, decision trees, and artificial neural networks are known.
[0009] Machine learning uses hyperparameters that are defined for training a model. Hyperparameters are parameters that are defined before a model is trained.
[0010] Hyperparameters can include, for example, the learning rate (a factor that determines the size of the intervals between updates to the model weights during training), the number of iterations (the number of times the model runs through the dataset during training), and the model structure (e.g., the number of layers in the neural network and the number of neurons in each layer).
[0011] Hyperparameters have a significant impact on model performance. Therefore, it is appropriate to search, i.e., optimize, hyperparameters that will improve or even optimize model results.
[0012] Hyperparameter optimization is the process of evaluating multiple hyperparameter combinations on a validation data set.
[0013] There are different methods for searching for hyperparameter combinations. These methods include, for example, gated search, random search, and Bayesian search.
[0014] Hyperparameter combinations are evaluated by executing a phase of training the machine learning model and then a testing phase.
[0015] The training phase is suitable for training the machine learning model on the training data set. The testing phase is suitable for calculating the performance score associated with the tested hyperparameter combination from the test data set.
[0016] The training data set and the test data set are provided by the user. These data represent the target application for the machine learning model.
[0017] The amount of training data has an impact on the duration of the training phase. The more training data there is, the longer the training phase will be. As a result, searching for the optimal hyperparameter combination may take a relatively long time when the amount of training data is large.
[0018] Furthermore, some of the hyperparameter combinations searched may be complex. These complex hyperparameter combinations imply a longer training phase.
[0019] On the other hand, some complex hyperparameter combinations have low performance. However, even if the combination has low performance, the training phase must be performed to determine the performance of these complex hyperparameter combinations.
[0020] Therefore, evaluating some complex hyperparameter combinations is time-consuming if their computational performance proves to be insufficient.
[0021] Therefore, there is a need to provide a solution for reducing the time spent searching for the optimal hyperparameter combination, especially when the amount of training data provided by the user is large. Summary of the invention
[0022] Implementation modes and embodiments relate to machine learning, and in certain embodiments to optimization of hyperparameters of machine learning models.
[0023] According to one aspect, a computer-implemented method can be used to search for an optimal hyperparameter combination so that an automatic learning model can be defined. The method includes multiple hyperparameter combination tests, each hyperparameter combination test including a training phase and a testing phase. The training phase is suitable for training a machine learning model based on training data, and the testing phase is suitable for calculating a performance score associated with the tested hyperparameter combination based on the test data. The optimal hyperparameter combination corresponds to the hyperparameter combination that has obtained the optimal performance score of the tested hyperparameter combination. The method also includes defining a weighting coefficient for adjusting the amount of training data used in the training phase. The weighting coefficient is dynamically adapted during different tests of the hyperparameter combination.
[0024] In this approach, the training phase of testing hyperparameter combinations is performed using training data whose volume is dynamically adjusted.
[0025] The amount of training data used in the training phase is dynamically adjusted to use only a reduced amount of training data for some hyperparameter combination tests, thereby speeding up the method for searching for the optimal hyperparameter combination.
[0026] In fact, it is not necessary to use all of the training data to train a machine learning model to measure an approximation of the performance of a hyperparameter combination.
[0027] Specifically, a portion of the training data is often sufficient to measure an approximation of the performance of a hyperparameter combination. For example, a portion corresponding to 10% of the training data is sufficient to obtain an approximation of the performance of a hyperparameter combination.
[0028] Using only a portion of the training data enables the training phase to be performed faster. The training phase of testing hyperparameter combinations is the most time-consuming step of the search method.
[0029] As a result, reducing the execution time of the training phase also enables the hyperparameter combination search method to be executed more quickly for a given number of hyperparameter combinations to be tested, or the number of hyperparameter combinations to be tested can be increased for a given execution period of the hyperparameter combination search method.
[0030] Evaluating the performance of a hyperparameter combination using all test data provided by the user ensures that all tested hyperparameter combinations are evaluated in the same way.
[0031] Once the optimal hyperparameter combination is found, the optimal model can be trained with the training data set to obtain the best performance from the machine learning model. Thus, the quality of the optimal model is guaranteed.
[0032] Advantageously, the weighting coefficients are initialized to initial weighting coefficients.
[0033] Preferably, the initial weighting coefficient is less than or equal to 1.
[0034] Advantageously, the weighting coefficients are updated for each test of a hyperparameter combination.
[0035] In one advantageous mode of implementation, updating the weighting coefficients to be used for a given test of a hyperparameter combination comprises calculating new weighting coefficients from old weighting coefficients used during a test of the hyperparameter combination directly preceding the given test of the hyperparameter combination.
[0036] Preferably, the new weighting coefficient is calculated by the formula k*α, where α is the old weighting coefficient and k is a coefficient greater than 1, for example between 1 and 2.
[0037] The calculation of such new weighting coefficients can gradually increase the amount of training data considered during the training phase. This makes it possible to favor relatively small weighting coefficients while also retaining some higher coefficients. Specifically, such an update of the weighting coefficients makes it possible to increase the amount of training data exponentially.
[0038] Alternatively, the new weighting coefficient may be calculated by adding a given value to the old weighting coefficient. For example, a value of 1% may be added to the old weighting coefficient to obtain the new weighting coefficient.
[0039] In an advantageous mode of realization, the method further comprises defining dynamically defined optimal weighting coefficients corresponding to the weighting coefficients used in the training phase for testing the hyperparameter combination that has obtained the best performance score among the hyperparameter combinations already tested.
[0040] Preferably, updating the weighting coefficient includes comparing the new weighting coefficient with the value 100% and with the value w*A, where A is the optimally defined weighting coefficient and w is a coefficient greater than 1, for example between 2 and 8, in particular equal to 4. If the calculated new weighting coefficient is less than or equal to the value 100% or less than the value w*A, the weighting coefficient is updated to the new weighting coefficient value, otherwise it is updated to the initial weighting coefficient value.
[0041] This updating of the weighting coefficients prevents the weighting coefficients from being too high at the beginning of the search for the optimal hyperparameter combination. This updating of the weighting coefficients also allows testing of weighting coefficients higher than the optimal weighting coefficient, because the new weighting coefficient cannot be greater than w*A. This updating of the weighting coefficients allows the weighting coefficients to be gradually increased.
[0042] In an advantageous embodiment, the method further comprises training the machine learning model defined by the optimal hyperparameter combination using all of the training data.
[0043] Alternatively or in combination, the method further comprises, for the hyperparameter combination that enables each machine learning model defined by the hyperparameter combination to obtain a better performance score among the hyperparameter combinations that have been tested, training the model with all of the data each time a better performance score is obtained.
[0044] According to another aspect, there is provided a computer program product comprising instructions which, when the program is executed by a computer, cause the computer program product to implement the method as described above.
[0045] According to another aspect, a computing system is provided, comprising: a memory in which the computer program as described above is stored; and a processing unit configured to implement the computer program. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Other advantages and features of the present invention will become apparent upon reviewing the detailed description of embodiments, which are in no way limiting, and the accompanying drawings, in which:
[0047] Figure 1A computing system SYS configured to implement a method according to an embodiment is shown; and
[0048] Figure 2 An embodiment method is shown. DETAILED DESCRIPTION
[0049] Figure 1 is shown configured to achieve the following combination Figure 2 A computing system SYS for the method for searching for an optimal hyperparameter combination.
[0050] The computing system SYS comprises a processing unit UT and a memory MEM.
[0051] The processing unit UT may be implemented with one or more processors. The memory MEM may be a non-volatile memory.
[0052] The memory MEM is configured to store a computer program PRG. The computer program PRG comprises instructions which, when executed by the processing unit UT, cause the processing unit UT to implement the method described below.
[0053] The computing system SYS may be, for example, a server or a personal computer.
[0054] Figure 2 A method for searching for an optimal hyperparameter combination of an automatic learning model is shown. This method can be implemented by a computing system SYS as described above.
[0055] The machine learning model is selected according to the application defined by the user. As an example, the model can be a linear model, a decision tree, or an artificial neural network.
[0056] It is important to note that these models are not exhaustive and there are many other machine learning models for solving different types of problems related to user-defined applications.
[0057] A machine learning model is associated with a hyperparameter combination. In order to obtain a machine learning model with good performance, it is reasonable to search for the optimal hyperparameter combination for the machine learning model.
[0058] Specifically, each hyperparameter combination searched is tested to measure the performance of that hyperparameter combination.
[0059] The optimal hyperparameter combination corresponds to the hyperparameter combination that obtains the best performance score among the searched set of hyperparameter combinations.
[0060] More specifically, the method comprises an initialization step 20. In this initialization step, a first hyperparameter combination is randomly generated.
[0061] In this initialization step 20, the optimal score is initialized to a predetermined value, such as zero.
[0062] As will be described later, during the method for searching for the optimal hyperparameter combination, once the performance score of the hyperparameter combination test is higher than the previously defined optimal score, the optimal score is updated. The optimal score is then updated by the performance score.
[0063] The method then comprises an evaluation step 21. This evaluation step 21 is performed for each hyperparameter combination searched, as described below. In this evaluation step 21, the performance of the hyperparameter combination to be tested is evaluated.
[0064] For example, the performance of a hyperparameter combination can be evaluated using cross-validation methods known to those skilled in the art.
[0065] Cross validation can be selected from "Leave p out cross-validation", "Leave one out cross-validation", "Holdout cross-validation", "Repeated random subsampling validation", "k-foldcross-validation", "Stratified k-fold cross-validation", "Time Series cross-validation" and "Nested cross-validation" types.
[0066] More specifically, evaluating the performance of a hyperparameter combination includes a machine learning model training phase and a machine learning model testing phase.
[0067] The machine learning model training phase uses training data TRND, which is provided by the user.
[0068] More specifically, the amount of training data TRND used in the training phase depends on a weighting coefficient α that is less than or equal to 100%.
[0069] The weighting coefficient α enables selection of a portion of the training data provided by the user. The ratio of the size of the portion of the training data to the size of all the training data corresponds to the weighting coefficient α.
[0070] The training data in this section can be selected randomly.
[0071] The weighting coefficient α is initialized to the initial weighting coefficient α0 input by the user. Preferably, the initial weighting coefficient α0 is close to 0%. For example, the initial weighting coefficient α0 can be initialized to 1%.
[0072] Thus, the amount of training data used to evaluate the first hyperparameter combination is relatively small.
[0073] The weighting coefficient α is then varied during the method for searching for the optimal hyperparameter combination until it approaches 100% at the end of the search for the optimal hyperparameter combination.
[0074] A minimum amount of training data may also be imposed to be used in the training phase. Specifically, when the training model is a classification model, a minimum number of samples representing the class, such as 50 samples, may be provided for each defined class.
[0075] The testing phase of the machine learning model uses the test data set TSTD provided by the user to evaluate the performance of the hyperparameter combination.
[0076] The amount of test data used in the evaluation of the different hyperparameter combinations searched is always the same.
[0077] Preferably, the testing phase of each evaluation step uses all test data TSTD provided by the user to evaluate the performance of the hyperparameter combination. This ensures that all tested hyperparameter combinations are evaluated in the same way.
[0078] The evaluation step makes it possible to calculate a performance score associated with a hyperparameter combination. The calculated performance score, the tested hyperparameter combination and the weighting coefficient α form the data set DAT output from the evaluation step 21 .
[0079] The calculated performance scores, the tested hyperparameter combinations and the used weighting coefficients α are stored during a step 22 in a portion DATB of a memory MEM of the computing system SYS.
[0080] The method then comprises a step 23 of searching for new hyperparameter combinations. In this step, new hyperparameter combinations are searched for.
[0081] New hyperparameter combinations are searched using search algorithms well known to those skilled in the art.
[0082] For example, the search algorithm may be selected from gated search, random search, or Bayesian search.
[0083] The search for new hyperparameter combinations makes it possible to obtain new hyperparameter combinations HPCMB, which will then be tested by repeating the method from the evaluation step 21.
[0084] The method further comprises a step of calculating a new weighting coefficient 24. If the value of this new weighting coefficient satisfies the conditions defined in the verification step 25 described below, this new weighting coefficient will be used for the next iteration of the evaluation step 21.
[0085] Specifically, a new weighting coefficient α is calculated from the old weighting coefficient α. For example, the new weighting coefficient α corresponds to a value k*α, where α is the old weighting coefficient and k is a user-defined coefficient greater than 1, such as between 1 and 2.
[0086] This calculation of new weighting coefficients makes it possible to gradually increase the amount of training data considered during the training phase. This makes it possible to favor relatively small weighting coefficients while also retaining some higher coefficients.
[0087] Alternatively, the new weighting coefficient may be calculated by adding a given value to the old weighting coefficient. For example, a value of 1% may be added to the old weighting coefficient to obtain the new weighting coefficient.
[0088] The method then comprises a verification step 25. In this step 25, the new weighting coefficient is compared with two thresholds. In particular, the new weighting coefficient α is compared with 100% and with a value w*A, where A corresponds to the optimal weighting coefficient and w is a user-defined coefficient greater than 1. The coefficient w is, for example, between 2 and 8, and in particular equal to 4.
[0089] The optimal weighting coefficient A corresponds to the weighting coefficient α used to evaluate the hyperparameter combination that gives the final optimal score among the hyperparameter combinations that have been tested.
[0090] If the new weighting factor α is greater than 100% or the value w*A, the new weighting factor is modified in step 26 to be equal to the initial weighting factor.
[0091] If the new weighting factor α is less than or equal to 100% or the value w*A, the new weighting factor is retained.
[0092] The new weighting factor α is then used for the next iteration of the evaluation step 21 .
[0093] After each evaluation step 21, the method further comprises a performance score comparison step 27. In this step 27, the performance score calculated in the evaluation step 21 is compared with the optimal performance score.
[0094] If the performance score calculated in the evaluation step 21 is higher than the optimal score, the method comprises a step of updating the optimal score 28. In this step 28, the optimal score is updated by the performance score calculated during the evaluation step.
[0095] If the calculated performance score is greater than the optimal score, the method further comprises a step 29 of updating the optimal weighting coefficient A. In this step 29, the optimal weighting coefficient A is updated by a weighting coefficient α used to evaluate the hyperparameter combination that has obtained a performance score greater than the optimal score.
[0096] The optimal weighting coefficient A is initialized to the value of the initial weighting coefficient α0.
[0097] As before, for each new hyperparameter combination searched, the method is repeated from evaluation step 21 to evaluate the new hyperparameter combination.
[0098] However, the training phase of each evaluation step 21 is performed using training data, the amount of which depends on a weighting coefficient α which increases at each iteration of the evaluation step until it reaches 100% or the value w*A.
[0099] This makes it possible to increase the amount of training data considered during the training phase of the evaluation step during different iterations of the evaluation step 21 until the weighting factor reaches 100% or the value w*A.
[0100] In particular, this method makes it possible to gradually increase the amount of training data considered during the training phase. In addition, this method uses a dynamic upper limit fixed by the value w*A. In this way, the exponential increase of the weighting coefficient does not reach 100% at each iteration, especially at the beginning of the process. More specifically, during the process, the ceiling w*A increases overall. However, the value of A may decrease locally. In this case, the ceiling is also reduced locally. Therefore, the increase of the ceiling of w*A is not exponential, but is related to the weighting coefficient, which makes it possible to obtain a new optimal performance score.
[0101] In this approach, the training phase of the hyperparameter combination evaluation step is performed using a dynamically adjusted amount of training data.
[0102] The amount of training data used for the training phase is dynamically adjusted to use only a reduced amount of training data for some tests of hyperparameter combinations, thereby speeding up the method for searching for optimal hyperparameter combinations.
[0103] In fact, it is not necessary to train a machine learning model with all the training data in order to measure an approximation of the performance of a hyperparameter combination.
[0104] Specifically, a portion of the training data is often sufficient to measure an approximation of the performance of a hyperparameter combination. For example, a portion corresponding to 10% of the training data is sufficient to obtain an approximation of the performance of a hyperparameter combination.
[0105] Using only a portion of the training data allows the training phase of the evaluation step to be performed more quickly. The training phase of the hyperparameter combination evaluation step corresponds to the step of the search method that takes the longest time to complete.
[0106] As a result, reducing the execution time of the training phase also makes it possible to execute the hyperparameter combination search method more quickly for a given number of hyperparameter combinations to be tested, or to increase the number of hyperparameter combinations to be tested for a given execution period of the hyperparameter combination search method.
[0107] Once the optimal hyperparameter combination is found, the optimal model can be trained with all the training data to get the best performance from the machine learning model. Therefore, the quality of the optimal model is guaranteed.
[0108] Alternatively, or in combination, each time a new best score is obtained, the model can also be trained using the entire training data. This training can be performed in parallel with the iterations of steps 21 to 29. Such training makes it possible to ensure quality by training each model with all the training data. In addition, the user can stop the iterations of steps 21 to 29 as soon as the user believes that the trained model is sufficiently effective.
Claims
1. A computer-implemented method for searching for an optimal hyperparameter combination for defining a machine learning model, the method comprising: performing a plurality of hyperparameter combination tests, each hyperparameter combination test comprising a training phase and a testing phase, wherein the training phase is suitable for training the machine learning model from training data, and the testing phase is suitable for calculating a performance score associated with the tested hyperparameter combination from the test data, the optimal hyperparameter combination corresponding to the hyperparameter combination that has obtained the optimal performance score among the tested hyperparameter combinations; and A weighting factor for adjusting the amount of training data used for the training phase is defined, the weighting factor being dynamically adapted during testing of different combinations of the hyperparameters. The method according to claim 1 , wherein the weighting coefficients are initialized to initial weighting coefficients. The method according to claim 2 , wherein the initial weighting coefficient is less than or equal to 1%.
4. The method of claim 1, wherein the weighting coefficients are updated for each hyperparameter combination tested.
5. A method according to claim 4, wherein updating the weighting coefficients to be used for a given test of the hyperparameter combination includes calculating new weighting coefficients from old weighting coefficients that were used during a test of the hyperparameter combination directly prior to the given test of the hyperparameter combination. 6 . The method according to claim 5 , wherein the new weighting coefficient is calculated by a formula k*α, wherein α is the old weighting coefficient and k is a coefficient greater than 1. 7 .
7. The method according to claim 1 also includes defining a dynamically defined optimal weighting coefficient, which corresponds to the weighting coefficient used in the training phase of the test of the hyperparameter combination that has obtained the optimal performance score among the hyperparameter combinations that have been tested.
8. The method according to claim 7, wherein updating the weighting coefficient comprises comparing the new weighting coefficient with a value of 100% and with a value w*A, wherein A is the defined optimal weighting coefficient and w is a coefficient greater than 1, and when the calculated new weighting coefficient is less than or equal to a value of 100% or less than or equal to a value of w*A, the weighting coefficient is updated to the value of the new weighting coefficient, otherwise it is updated to the value of the initial weighting coefficient.
9. The method according to claim 1 also includes training a machine learning model defined by the optimal hyperparameter combination using all of the training data.
10. The method according to claim 1 also includes, for the hyperparameter combination that enables each machine learning model defined by the hyperparameter combination to obtain a better performance score among the hyperparameter combinations that have been tested, training the model with all of the data each time a better performance score is obtained.
11. A non-transitory memory storing a computer program, the computer program comprising instructions, when the program is executed by a computer, causing the computer to implement a method comprising: performing a plurality of hyperparameter combination tests, each hyperparameter combination test comprising a training phase and a testing phase, wherein the training phase is adapted to train a machine learning model from training data, and the testing phase is adapted to calculate a performance score associated with the tested hyperparameter combination from the testing data; as well as A weighting coefficient for adjusting the amount of training data used for the training phase is defined, and the weighting coefficient is dynamically adapted during testing of different hyperparameter combinations to determine an optimal hyperparameter combination corresponding to the hyperparameter combination that has obtained the best performance score among the tested hyperparameter combinations.
12. A computing system comprising: The memory according to claim 11; as well as A processing unit is coupled to the memory and is configured to execute the computer program.
13. The computing system of claim 12, wherein the weighting coefficients are initialized to initial weighting coefficients. The computing system of claim 13 , wherein the initial weighting coefficient is less than or equal to 1%.
15. The computing system of claim 12, wherein the weighting coefficients are updated for each hyperparameter combination tested.
16. A computing system according to claim 15, wherein updating the weighting coefficients to be used for a given test of the hyperparameter combination includes calculating new weighting coefficients from old weighting coefficients that were used during a test of the hyperparameter combination that directly preceded the given test of the hyperparameter combination. 17 . The calculation system of claim 16 , wherein the new weighting coefficient is calculated by a formula k*α, where α is the old weighting coefficient and k is a coefficient greater than 1.
18. A computer-implemented method for searching for an optimal hyperparameter combination for defining an automated learning model, the method comprising: Initialize weighting coefficients; receiving training data; Receive test data; evaluating the performance of a hyperparameter combination, the evaluating being performed in a training phase using a portion of the training data based on the weighting coefficients and in a testing phase using the test data; calculating a performance score associated with the hyperparameter combination; calculating a new weighting factor greater than the initial weighting factor; Repeating the evaluation for a new hyperparameter combination, the repeated evaluation being performed using a portion of the training data based on the new weighting coefficients and the test data; calculating a new performance score associated with the hyperparameter combination; as well as The performance score is compared to the new performance score.
19. A method according to claim 18, wherein the steps of calculating new weighting coefficients, evaluating new hyperparameter combinations and calculating new performance scores are repeated until an optimal hyperparameter combination is obtained, the optimal hyperparameter combination corresponding to the hyperparameter combination that has obtained the best performance score among the hyperparameter combinations evaluated.
20. The method of claim 18, wherein the initial weighting factor is less than or equal to 1%.
Citation Information
Cited By
Defect detection method and device and hyper-parameter optimization method and device
CN119810017A
Hyper-parameter tuning method and device for automatic driving closed-loop simulation, equipment and medium
CN120871662A
Driving intention prediction method, training method and judgment method based on single-pedal operation
CN121210984A
