r/u_Timely-Alternative53

Is it ever correct to train a Ridge Regression model on the test set?
▲ 10 r/u_Timely-Alternative53+1 crossposts

Is it ever correct to train a Ridge Regression model on the test set?

​

I was reading an ML book on Ridge Regression and came across the following code:

rr = Ridge(alpha=0.5)

rr.fit(w_test, h_test)

rr.score(w_test, h_test)

The book explicitly mentions fitting the Ridge model on the test data.

My understanding is that a model should always be trained using the training set

(fit(X_train, y_train))

and evaluated on the test set

(score(X_test, y_test) or predict(X_test)).

Am I missing some context here, or is this simply an error in the book? I'd love to hear how experienced ML practitioners interpret this example.

u/Timely-Alternative53 — 2 days ago