METHOD FOR FINDING AN OPTIMAL COMBINATION OF HYPERPARAMETERS FOR A MACHINE LEARNING MODEL
The method optimizes hyperparameter search by dynamically stopping underperforming cross-validation tests, enhancing efficiency and reducing computational costs without compromising model performance.
Patent Information
- Application Number
- FR2023002973
- Authority / Receiving Office
- FR · FR
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-04
AI Technical Summary
Existing hyperparameter optimization methods for machine learning models are computationally expensive and time-consuming due to extensive cross-validation, especially when dealing with large datasets.
A method that dynamically stops cross-validation tests for hyperparameter combinations that perform worse than the best score, optimizing the search process by prioritizing tests with the worst performance scores and updating the best score accordingly, thereby reducing unnecessary computations.
This approach accelerates the search for optimal hyperparameters, significantly reducing the duration and energy consumption while maintaining model quality.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Title of the invention: METHOD FOR SEARCHING FOR AN OPTIMAL COMBINATION OF HYPERPARAMETERS FOR A MACHINE LEARNING MODEL
[0001] Implementations and embodiments relate to machine learning, including optimization of hyperparameters of a machine learning model. Machine learning is a branch of artificial intelligence that allows a computer system to learn from data, without having been explicitly programmed to perform a given task.
[0003] Machine learning allows a machine to acquire knowledge and skills from a set of data, in order to perform predictions, classifications or other types of processing on new data.
[0004] A machine learning model is a mathematical representation of a system or process that allows a machine to learn from data. The model is created using a machine learning algorithm that learns from a training data set to produce a predicted output for a given input.
[0005] 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. Examples include linear models, decision trees, and artificial neural networks.
[0006] Machine learning uses hyperparameters defined for training a model. Hyperparameters are parameters defined before model training begins.
[0007] Hyperparameters may for example include a learning rate (factor determining the size of the steps for updating the model weights during training), a number of iterations (number of times the model runs through the entire data set during training), a structure of the model (number of layers for an artificial neural network and the number of neurons per layer for example).
[0008] Hyperparameters can have a significant impact on model performance. It is therefore appropriate to search for, i.e. optimize, hyperparameters that can improve or even optimize the model's results.
[0009] Hyperparameter optimization is a method in which multiple combinations of hyperparameters are evaluated on a validation data set.
[0010] Different methods of hyperparameter search exist. These methods include grid search, random search and Bayesian search for example.
[0011] Hyperparameters can be tested by performing cross-validation. Cross-validation is a technique used to evaluate the performance of hyperparameters associated with a machine learning model.
[0012] Cross-validation involves multiple tests for the same combination of hyperparameters of a model from the same validation data set. In particular, the data set is divided into multiple data subsets. For each test, at least one data subset is used to train the model and at least one other subset is used to evaluate the model.
[0013] For each test, the performance of the model is evaluated and a performance measure is calculated (e.g., accuracy or mean square error). The performance measures obtained for each test performed for the same hyperparameter combination are then averaged to obtain an overall performance measure of the model. The hyperparameter combination with the best overall performance is then selected as the optimal hyperparameter combination.
[0014] Cross-validation helps avoid biases associated with using a single dataset for training and evaluating the model. Cross-validation also helps provide a more accurate estimate of model performance on unknown data.
[0015] However, cross-validation can be computationally time-consuming, especially if the number of validation data subsets is large or the validation data set is large. Therefore, hyperparameter optimization can be relatively slow and computationally expensive.
[0016] There is therefore a need to propose a solution allowing to find more quickly an optimal combination of hyperparameters for a machine learning model.
[0017] According to one aspect, there is provided a computer-implemented method for finding an optimal combination of hyperparameters for defining a machine learning model, the method comprising several hyperparameter combination tests, each hyperparameter combination test comprising cross-validation from a validation data set, the cross-validation defining several performance tests on at least one subset of validation data, each performance test comprising: - a calculation of a performance score, - a comparison of the calculated performance score to a better score, the test of the hyperparameter combination being stopped if the calculated performance score is lower than the best score, cross-validation also including an update of the best score when all the performance scores calculated for this cross-validation are higher than the best score, the updated best score then corresponding to the lowest performance score among said set of performance scores calculated for this cross-validation, the method further comprising a definition of an optimal combination of hyperparameters for said learning model, this optimal combination of hyperparameters corresponding to the optimal combination of hyperparameters having made it possible to define the last best score once all the hyperparameter combination tests have been carried out.
[0018] Such a search method makes it possible to stop testing a combination of hyperparameters as soon as a cross-validation test obtains a score lower than the best defined score. This makes it possible to avoid carrying out other cross-validation tests for a combination of hyperparameters that will not be retained.
[0019] Such a method therefore makes it possible to search more quickly for an optimal combination of hyperparameters. Such a method therefore makes it possible to reduce the duration and energy consumption of a search for an optimal combination of hyperparameters while preserving the quality of the defined model.
[0020] Preferably, the learning model is selected from a linear model, a decision tree or an artificial neural network. It is important to note that these models are not exhaustive and that there are many other machine learning models used to solve different types of problems to be solved relating to the user-defined application.
[0021] Advantageously, each combination of hyperparameters is searched by performing a grid search, a random search or even a Bayesian search.
[0022] In an advantageous embodiment, the performance tests defined by the cross-validation are carried out in a given order. The method further comprises defining an order of the performance tests at each update of the best score, the defined order then corresponding to the ascending order of the scores of the performance tests of the cross-validation having made it possible to update the best score.
[0023] Such a definition of the order of the performance tests makes it possible to accelerate the search for the optimal combination of hyperparameters. Indeed, generally, the performance tests obtaining the lowest performance scores are generally the same between the different hyperparameter combination tests. Thus, in By starting a cross-validation with the benchmarks with the lowest performance scores, it is possible to stop a hyperparameter combination test more quickly when the performance score associated with a benchmark is lower than the best score.
[0024] According to another aspect, there is provided a computer program comprising instructions which, when the program is executed by a computer, cause the latter to implement a method as described above.
[0025] According to another aspect, there is provided a computer system comprising: - a memory in which is stored a computer program as described above, and - a processing unit configured to implement the computer program.
[0026] Other advantages and characteristics of the invention will appear on examining the detailed description of embodiments, which are in no way limiting, and the appended drawings in which:
[0027] [Fig.l]
[0028] [Fig.2] illustrate embodiments and implementations of the invention.
[0029] [Fig.l] illustrates a computer system SYS configured to implement a method of searching for an optimal combination of hyperparameters as described below in relation to [Fig.2].
[0030] The computer system SYS comprises a processing unit UT and a memory MEM. The memory MEM is configured to store a computer program PRG. This computer program PRG comprises instructions which, when executed by the processing unit UT, cause the latter to implement the method as described below.
[0031] [Fig.2] illustrates a method for searching for an optimal combination of hyperparameters for a machine learning model. Such a method can be implemented by a computer system SYS as described previously.
[0032] The machine learning model is chosen according to a user-defined application. The model can be a linear model, a decision tree or an artificial neural network for example. It is important to note that these models are not exhaustive and that there are many other machine learning models used to solve different types of problems to be solved relating to the user-defined application.
[0033] The machine learning model is associated with a combination of hyperparameters. In order to obtain a machine learning model with good performance, it is necessary to search for an optimal combination of hyperparameters for this machine learning model.
[0034] In particular, the desired hyperparameter combinations are tested by performing cross-validations. The cross-validation performed for a test of a hyperparameter combination makes it possible to measure the performance of this hyperparameter combination.
[0035] The optimal combination of hyperparameters corresponds to the combination of hyperparameters obtaining a best performance score among a set of desired hyperparameter combinations. A performance score is a score calculated from cross-validation tests carried out during a test of the same combination of hyperparameters. The best performance score corresponds to the worst score obtained for a cross-validation test associated with the optimal combination of hyperparameters.
[0036] Cross-validations can for example be chosen from validations of the type “Leave p out cross-validation”, “Leave one out cross-validation”, “Holdout cross-validation”, “Repeated random subsampling validation”, “k-fold cross-validation”, “Stratified k-fold cross-validation”, “Time Series cross-validation”, “Nested cross-validation”. It is important to note that these examples of cross-validations are not exhaustive and that any other type of cross-validation can be implemented within the framework of this method.
[0037] More particularly, the method comprises a step 20 of obtaining a set of validation data. In this step 20 of obtaining, a set of validation data is provided to the computer system. This validation data makes it possible to test the performance of different combinations of hyperparameters of a machine learning model. This validation data is provided by the user.
[0038] The method also comprises a step 21 of preparing a search for an optimal combination of hyperparameters. In this preparation step 21, the validation data set is divided into several subsets of data. The number of cross-validation tests to be carried out for a test of a combination of hyperparameters is also defined during this preparation step 21. In particular, the number of cross-validation tests is generally equal to the number of subsets defined.
[0039] The method then comprises an initialization step 22. In this initialization step 22, the best score is initialized to a predefined value, for example 0. As described below, the best score is then updated as soon as the scores obtained for all the cross-validation tests of a test of a combination of hyperparameters are higher than the old best score defined. The best score will then be updated by the lowest score among these different scores higher than the old best score.
[0040] The method also then comprises a step 23 of searching for a com hyperparameter combination. The hyperparameter combination can be searched using methods well known to those skilled in the art. For example, a hyperparameter combination can be searched by performing a grid search, a random search, or a Bayesian search.
[0041] The method then comprises a cross-validation to test the hyperparameter combination obtained in step 23. The cross-validation defines several cross-validation tests, corresponding to performance tests. Each performance test makes it possible to train the model from at least one subset of validation data and to evaluate the model from at least one other validation subset. The subsets used to train and to evaluate the model are different between each performance test.
[0042] In particular, the method comprises a first cross-validation test 24. In this first cross-validation test, at least one subset of validation data is used to train the model and at least one other validation subset is used to evaluate the model. This first cross-validation test makes it possible to calculate a performance score associated with this cross-validation test.
[0043] The method then comprises a first step 25 of evaluating the score obtained for this first cross-validation test 24 carried out. In this first evaluation step 25, the cross-validation score calculated during the first test 24 is compared to the best score.
[0044] If at the first evaluation step 25 the cross-validation score is lower than the best score, then the test of the combination of hyperparameters is abandoned.
[0045] The first evaluation step 25 makes it possible to perform only the first cross-validation test associated with a combination of hyperparameters when the score of this cross-validation is lower than the best defined score. Thus, this first evaluation step 25 makes it possible to stop the test of a combination of hyperparameters from the first cross-validation test 24 if the score of this cross-validation is lower than the best defined score. This makes it possible to avoid performing other cross-validation tests for a combination of hyperparameters which will not be retained.
[0046] In this case, the method then comprises a verification step 29. In this verification step 29, the number of hyperparameter combination tests performed is compared to a maximum number of hyperparameter combination tests defined by the user.
[0047] If in step 29, the number of hyperparameter combination tests already performed is less than the maximum number of hyperparameter combination tests, then the method is repeated from step 23 to test a new hyperparameter combination.
[0048] If at the first step 25 the performance score of the first test 24 is higher than the best score, then the method comprises a step 26 which makes it possible to determine whether the cross-validation test carried out is the last one defined for cross-validation.
[0049] If the cross-validation test carried out is not the last for this cross-validation, the method comprises another cross-validation test 27. This test 27 makes it possible to calculate a new performance score.
[0050] Then, the method comprises a step 28 of evaluating the performance score calculated for the cross-validation test 27.
[0051] If the performance score of the cross-validation test is lower than the best score, then the method is repeated from step 23 to test a new combination of hyperparameters, if the number of hyperparameter combination tests already performed is lower than the maximum number of hyperparameter combination tests (step 29). Thus, this second step 28 makes it possible to stop the test of a combination of hyperparameters as soon as a cross-validation test obtains a performance score lower than the best score defined. This makes it possible to avoid performing other cross-validation tests for a combination of hyperparameters which will not be retained.
[0052] If the performance score of the cross-validation test is higher than the best score, then the method is repeated from step 26 to perform a new cross-validation test if the cross-validation test performed is not the last one defined for this cross-validation.
[0053] If in step 26, the cross-validation test performed is the last one defined for this cross-validation, then the method comprises an update step 30. In this step 30, the best score is updated with the value of the worst performance score of the tests of this cross-validation.
[0054] Next, the method comprises a step 31 of updating the order of the cross-validation tests. In this step 31, the order of the cross-validation tests is defined for the next hyperparameter tests. In particular, the order of the cross-validation tests is defined according to the score of each cross-validation during the previous hyperparameter test. The order of the cross-validation tests corresponds to the ascending order of these scores. Such a definition of the order of the cross-validation tests makes it possible to accelerate the search for the optimal combination of hyperparameters. Indeed, generally, the cross-validation tests obtaining the lowest performance scores are generally the same between the different hyperparameter combination tests.Thus, by starting a cross-validation with the tests with the lowest performance scores, it is possible to more quickly stop a hyperparameter combination test when the performance score associated with a cross-validation test is lower than the best score.
[0055] Then, the method also comprises said verification step 29. As indicated previously, in this verification step 29, the number of com tests The performed hyperparameter combination is compared to the maximum number of hyperparameter combination tests defined by the user.
[0056] If in step 29, the number of hyperparameter combination tests already performed is less than the maximum number of hyperparameter combination tests, then the method is then repeated from step 23 so as to test a new hyperparameter combination.
[0057] If in step 29, the number of hyperparameter combination tests already performed corresponds to the maximum number of hyperparameter combination tests then the method comprises a step 32 of defining an optimal combination of hyperparameters. In particular, the optimal combination of hyperparameters corresponds to the combination of hyperparameters for which the cross-validation made it possible to define the last best score.
[0058] Such a search method makes it possible to stop testing a combination of hyperparameters as soon as a cross-validation test obtains a score lower than the best defined score. This makes it possible to avoid carrying out other cross-validation tests for a combination of hyperparameters which will not be retained.
[0059] Such a method therefore makes it possible to search more quickly for an optimal combination of hyperparameters. Such a method therefore makes it possible to reduce the duration and energy consumption of a search for an optimal combination of hyperparameters while preserving the quality of the defined model.
Claims
Claims
1. A computer-implemented method for finding an optimal combination of hyperparameters for defining a machine learning model, the method comprising a plurality of hyperparameter combination tests, each hyperparameter combination test comprising cross-validation from a validation data set, the cross-validation defining a plurality of performance tests on at least one subset of validation data, each performance test comprising: - a calculation (24, 27) of a performance score, - a comparison (25, 28) of the calculated performance score with a best score, the test of the hyperparameter combination being stopped if the calculated performance score is lower than the best score, the cross-validation also comprising an update (30) of the best score when all of the performance scores calculated for this cross-validation are higher than the best score,the updated best score then corresponding to the least good performance score among said set of performance scores calculated for this cross-validation, the method further comprising a definition (32) of an optimal combination of hyperparameters for said learning model, this optimal combination of hyperparameters corresponding to the optimal combination of hyperparameters having made it possible to define the last best score once all the hyperparameter combination tests have been carried out.,
2. The method of claim 1, wherein the learning model is selected from a linear model, a decision tree, or an artificial neural network.
3. A method according to any one of claims 1 or 2, wherein each combination of hyperparameters is searched by performing a grid search, a random search or a Bayesian search.
4. Method according to one of claims 1 to 3, in which the performance tests defined by the cross-validation are carried out in a given order, the method further comprising a definition of an order of the performance tests (31) at each update of the best score, the defined order then corresponding to the increasing order of the scores of the tests cross-validation performance that allowed the best score to be updated.
5. A computer program comprising instructions which, when the program is executed by a computer, cause the latter to implement a method according to one of claims 1 to 4.
6. Computer system comprising: - a memory (MEM) in which a computer program (PRG) according to claim 5 is stored, and - a processing unit (UT) configured to implement the computer program (PRG).
