Introduction to Hyperparameters
Learn the difference between parameters and hyperparameters with examples.
Introduction to hyperparameters
An ML model has two types of parameters: hyperparameters and trainable parameters after training the model.
Parameters are values that are learned by the ML model during training. Examples of parameters include the coefficients in a linear regression model or the decision tree split points in a decision tree. During the training process, these parameters are adjusted iteratively until the ML model’s performance is optimized and the error between predicted output and actual output is minimal.
Hyperparameters are different parameter values that are set before starting the training process for an ML model. The main function of the hyperparameters is to control the learning process. They have a significant effect on the performance of ML models.
Examples of hyperparameters
Some examples of hyperparameters in ML algorithms include:
Regularization strength: This controls the amount of regularization applied to the ML model, which helps prevent overfitting.
Number of trees in a random forest: A larger number of trees can lead to better ML model performance. It can also increase the risk of overfitting due to the depth of the trees.
Number of layers and units in a neural network: These control the complexity of the model and can impact the ability of the model to fit the data.
Learning rate: This controls the step size at which the optimizer can make updates to the model parameters during training. A smaller learning rate might lead to more accurate models, but it will take a longer time to train.
Loss: This is the function that is used in the boosting process for the histogram-based gradient boosting classification tree.
The number of clusters: This includes the number of clusters to form, as well as the number of centroids required to generate k-means clustering.
Minimum samples: This includes the number of samples (or total weight) in a neighborhood for a point to be considered as a core point for DBSCAN clustering. The value of the minimum samples can either increase or decrease the ML model performance.
These are just a few examples of hyperparameters. The particular hyperparameters that are used during training will vary according to the type of model that is being used.
Hyperparameters for the random forest algorithm
Random forest is an ensemble learning algorithm that combines multiple decision trees to form a forest of trees. The random forest has different hyperparameter values used during the training process, as illustrated in the image below. It’s recommended to use the random forest algorithm from the scikit-learn Python library.
Get hands-on with 1400+ tech skills courses.