Lesson 4. Rossman prediction RMSPE query

def exp_rmspe(y_pred, targ):
    targ = inv_y(targ)
    pct_var = (targ - inv_y(y_pred))/targ
    return math.sqrt((pct_var**2).mean())
max_log_y = np.max(yl)
y_range = (0, max_log_y*1.2)

Could someone please clarify?
What is the purpose of max_log_y and why y_range has been created here.

The purpose is so that the output can never be predicted out of this range, as this makes it easier for the model to train. It gives the model less opportunities to be wildly wrong. This is deemed a reasonable range as prediction is unlikely to go outside this range

But definitely worth experimenting with what happens if you remove y_range.

1 Like

thank you…appreciate the quick response