How does lr_find get the best lr?

(Hanman) #1

In Lesson 1, I see Jeremy calling lr_find upon creating a model.

learn = create_cnn(data, models.resnet50, metrics=error_rate)

How does lr_find() find the best lr rate ? Does it run like one epoch on the entire dataset for all the different lr rates and plot the loss against the lr rate Or just run one min-batch ? If only one mini-batch , how can we be sure that it will generalise well for the whole dataset ? If for the whole dataset, is it some greedy search.

This is what I got from the docs.Does this mean it will run 100 iterations at max ?

lr_find ( learn : Learner , start_lr : Floats = 1e-07 , end_lr : Floats = 10 , num_it : int = 100 , stop_div : bool = True , wd : float = None )
Explore lr from start_lr to end_lr over num_it iterations in learn . If stop_div , stops when loss diverges.