
Learning rate cosine annealing formula: learning_rate = learning_rate_initial * 0.5 * (1 + cos(pi * epoch / total_epochs))
Image: Jordan K. Terry, CC BY-SA 4.0, via Wikimedia Commons
Learning rate cosine annealing formula: learning_rate = learning_rate_initial * 0.5 * (1 + cos(pi * epoch / total_epochs))
Learning rate cosine annealing is a technique used to adjust the learning rate during training. It starts with an initial learning rate and gradually decreases it following a cosine curve. This approach helps in achieving a balance between fast convergence and fine-tuning of the model parameters.
The formula for learning rate cosine annealing is: learning_rate = learning_rate_initial * 0.5 * (1 + cos(pi * epoch / total_epochs)). In this formula, learning_rate_initial is the starting learning rate, epoch represents the current training iteration, and total_epochs is the total number of training iterations. The cosine function ensures a smooth transition of the learning rate from its initial value to a final value of 0.5 * learning_rate_initial.
Cosine annealing helps in preventing the learning rate from becoming too small too quickly, which can lead to slow convergence or getting stuck in local minima. By gradually decreasing the learning rate, the model can fine-tune its parameters more effectively, leading to better performance and generalization on unseen data.
Example
Suppose the initial learning rate is 0.1, and we have a total of 100 epochs. At epoch 50, the learning rate would be calculated as follows: learning_rate = 0.1 * 0.5 * (1 + cos(pi * 50 / 100)) = 0.1 * 0.5 * (1 + cos(pi * 0.5)) = 0.1 * 0.5 * (1 + 0) = 0.05.
Remember this
Learning rate cosine annealing is crucial for optimizing the training process of machine learning models, ensuring efficient convergence and improved model performance.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
cosine annealing does: lr = lr_min + 0.5(lr_max - lr_min)(1 + cos(πt/T))
Ever wondered how a computer decides what's more important when sorting through tons of data?
Cosine similarity
Cosine similarity formula: cos(θ) = (A · B) / (||A|| ||B||)
AdaGrad does: divides learning rate by sqrt of sum of squared gradients
How do we avoid overshooting in learning?
PageRank
PageRank formula: PR(A) = (1-d) + d Σ(PR(C)/L(C))
Gradient descent
Gradient descent weight update equation: w := w - α * ∇J(w)
Precision and recall
Precision = Relevant retrieved instances / All retrieved instances
Swipe through 100 ML concepts daily
Open Pocket Polymath