All problems
Scheduled Sampling Probability
Problem
Compute the teacher-forcing probability at a training step: clamp(initial_prob + step * rate, 0, 1).
Return the clamped probability. As training progresses the model relies more on its own predictions.
Hint
A negative rate simulates the reverse schedule, decaying toward zero.
Test cases
case 1
in: [0.1,2,0.1]
expected: 0.30000000000000004
case 2
in: [0.9,5,0.1]
expected: 1
case 3
in: [0,0,0.2]
expected: 0
case 4
in: [0.5,10,0]
expected: 0.5
Starter codePython
def scheduled_sampling_prob(initial_prob, step, rate):
# Your code here
pass4 test cases · run your code against them in the editor