All problems
Linear Batch Scaling Rule
Problem
Apply the linear batch scaling rule for learning rates.
Return base_lr * new_batch / base_batch so the learning rate grows in proportion to the batch size. If base_batch is not positive, return base_lr unchanged.
Hint
Doubling the batch doubles the learning rate under this rule.
Test cases
case 1
in: [0.1,32,128]
expected: 0.4
case 2
in: [0.1,32,32]
expected: 0.1
case 3
in: [0.2,64,16]
expected: 0.05
case 4
in: [0.1,0,5]
expected: 0.1
Starter codePython
def linear_scaling_lr(base_lr, base_batch, new_batch):
# Your code here
pass4 test cases · run your code against them in the editor