Carrot Makes Hyperparameter Tuning Easy
Carrot makes hyperparameter tuning very easy by default. It performs automatic tuning for you with every training run, but you can also manually find how you want to tune your models. In the output, we see that we only have one hyperparameter to tune em try defines the number of variables that are randomly sampled as candidates at each split. Carrot automatically tried three different values and includes the performance of each with the output. The best model is chosen with the metric accuracy, which in this case was 4m try equals six different algorithms have different hyperparameters.
To know which hyperparameters you can tune with these different methods in carrot, if you know the model abbreviation, you can use the model lookup function. However, the easiest way is to use the online documentation of carrot. Clicking on the link on the slide will take you to the page where you will find an overview of the different algorithms you can set as method in the trade function. This table includes the name of the model, the string you need to put into the train function, whether it can be used for classification or regression, and what the original package of the implementation is. Most importantly, you will find which hyperparameters can be tuned.
Instead of discussing the mathematics behind hyperparameters, I will focus on how to perform high parameter tuning. Carrot provides a simple and intuitive way to tune hyperparameters without requiring extensive knowledge of machine learning or statistics.
Building Models with Hyperparameter Tuning
Let's change things up a bit and build a support vector machine with polynomial kernel similar to the random forest model from before. This time, I am using the SVM poly method and calculating the training time when we examined the model object again. We see that this time, carrot performed a more complex hyperparameter tuning if we have more than one hyperparameter to tune. Train automatically creates a grid of tuning parameters by default, trying all possible combinations of three hyperparameters in our model: degree being one, two, or three; scale being 0.01, 0.1, or 1; and C being 0.25, 0.5, or 1.
The output shows the performance for every possible combination of hyperparameters, which is too long to fit on this page and I am only showing the best model with degree of 1, scale of 0.1, and C equal to 1. We can also set the option tune lengths to specify the number of different values to try for each hyperparameter, such as five. Now, carrot tries all possible combinations of five parameters: degree being 1, 2, 3, 4, or 5; scale being 1 to the power of minus 3, 1 to the power of minus 2, 1 to the power of minus 1, 1, and 10; and C being 0.25, 0.5, 1, 2, or 4.
The best model now has degree, scale, and C equal to 1. We can also manually try out different hyperparameters using the option in grid 2, which we can feed a grid of hyperparameters defined with the expanded grade function if we use that function. We need to define all hyperparameters before we can train the model.
Using Carrot for Hyperparameter Tuning
To use carrot for hyperparameter tuning, you can start by defining the number of variables that are randomly sampled as candidates at each split using the em try method. This allows you to automatically perform a grid search over different combinations of hyperparameters.
You can also use the online documentation of carrot to find out which hyperparameters can be tuned and how to set up the option tune lengths. Additionally, you can manually try out different hyperparameters by feeding a grid of hyperparameters defined with the expanded grade function if you want more control over the tuning process.
By following these steps and using the features provided by carrot, you can easily perform high-quality hyperparameter tuning without requiring extensive knowledge of machine learning or statistics.
"WEBVTTKind: captionsLanguage: encarrot makes hyper parameter tuning very easy by default it performs automatic tuning for you with every training run but you can also manually find how you want to tune your models here you see the random forest model with the RF method from before in the output we see that we only have one hyper parameter to tune em try defines the number of variables that are randomly sampled as candidates at each split carrot automatically tried three different my values and includes the performance of each with the output the best model is chosen with the metric accuracy which in this case was 4m try equals six different algorithms have different hyper parameters you might be wondering how you would know which high parameters you can tune with these different methods in carrot if you know the model abbreviation you can use the model lookup function but the easiest way is to use the online documentation of carrot click this link on the slide to go to the page there you will find an overview of the different algorithms you can set as method in the trade function this table includes the name of the model the string you need to put into the train function whether it can be used for classification or regression and what the original are package of the implementation is but most importantly you will find which hyper parameters can be tuned here I will not discuss the mathematics behind hyper parameters instead I will focus on how to perform the high parameter tuning let's change things up a bit and build a support vector machine with polynomial kernel similar to the random forest model from before this time I am using the SVM poly method and I am again calculating the training time when we examined the model object again we see that this time carrot performed a more complex hyper parameter tuning if we have more than one hyper parameter to tune train automatically creates a grid of tuning parameters by default carrot tries all possible combinations of three hyper parameters in our model degree being one two or three scale being 0.01 Oh point O 1 or 0.1 and C being 0.25 0.5 or 1 because the output shows the performance for every possible combination of Hiva parameters the output is too long to fit on this night and I am only showing the best model with degree of 1 scale of 0.1 and C equal to 1 we can also set the option tune lengths to specify the number of different values to try for each hyper parameter for example 5 now carat tries all possible combinations of 5 5 parameters degree B 1 2 3 4 or 5 scale being 1 to the power of minus 3 1 to the power of minus 2 1 to the power of minus 1 1 and 10 and C being 0.25 0.5 1 2 or 4 the best model now has degree scale and C of 1 of course you could also manually try out different hyper parameters this we can do with the option to in grid 2 which we can feed a grid of hyper parameters this grade is defined with the expanded grade function if we use that function we need to define all height parameters let's see what happens if we set the degree to 4 and keep scale and see it 1 and 3 train the model this time we only train with 1 combination of 1/2 parameters so our output gives the performance for these hyper parameters only now's your turn to apply simple height parametercarrot makes hyper parameter tuning very easy by default it performs automatic tuning for you with every training run but you can also manually find how you want to tune your models here you see the random forest model with the RF method from before in the output we see that we only have one hyper parameter to tune em try defines the number of variables that are randomly sampled as candidates at each split carrot automatically tried three different my values and includes the performance of each with the output the best model is chosen with the metric accuracy which in this case was 4m try equals six different algorithms have different hyper parameters you might be wondering how you would know which high parameters you can tune with these different methods in carrot if you know the model abbreviation you can use the model lookup function but the easiest way is to use the online documentation of carrot click this link on the slide to go to the page there you will find an overview of the different algorithms you can set as method in the trade function this table includes the name of the model the string you need to put into the train function whether it can be used for classification or regression and what the original are package of the implementation is but most importantly you will find which hyper parameters can be tuned here I will not discuss the mathematics behind hyper parameters instead I will focus on how to perform the high parameter tuning let's change things up a bit and build a support vector machine with polynomial kernel similar to the random forest model from before this time I am using the SVM poly method and I am again calculating the training time when we examined the model object again we see that this time carrot performed a more complex hyper parameter tuning if we have more than one hyper parameter to tune train automatically creates a grid of tuning parameters by default carrot tries all possible combinations of three hyper parameters in our model degree being one two or three scale being 0.01 Oh point O 1 or 0.1 and C being 0.25 0.5 or 1 because the output shows the performance for every possible combination of Hiva parameters the output is too long to fit on this night and I am only showing the best model with degree of 1 scale of 0.1 and C equal to 1 we can also set the option tune lengths to specify the number of different values to try for each hyper parameter for example 5 now carat tries all possible combinations of 5 5 parameters degree B 1 2 3 4 or 5 scale being 1 to the power of minus 3 1 to the power of minus 2 1 to the power of minus 1 1 and 10 and C being 0.25 0.5 1 2 or 4 the best model now has degree scale and C of 1 of course you could also manually try out different hyper parameters this we can do with the option to in grid 2 which we can feed a grid of hyper parameters this grade is defined with the expanded grade function if we use that function we need to define all height parameters let's see what happens if we set the degree to 4 and keep scale and see it 1 and 3 train the model this time we only train with 1 combination of 1/2 parameters so our output gives the performance for these hyper parameters only now's your turn to apply simple height parameter\n"