Train & validation & test, r2_score

As u mentioned in this lesson we are doing KFold Cross-Validation, as data contain train & test set and I want to find r2_score but I am confused how will get y_test

i don’t see any variable y_test in the lecture. maybe you’re referring to accuracy_score:

from sklearn.metrics import accuracy_score

accuracy_score(train_targets, train_preds)

in the lecture the train_preds variable is test_preds

Hoe can we find r2_score

r2_score(y_true, y_pred), i guess y_preds here is also test_preds

it says on documentation best possible score is 1.0 but can be negative.
it returns a float value.

https://scikit-learn.org/stable/modules/generated/sklearn.metrics.r2_score.html