Skip to content

Instantly share code, notes, and snippets.

@erap129
Created February 19, 2022 07:29
Show Gist options
  • Select an option

  • Save erap129/76686996750758c7530de98bb326a655 to your computer and use it in GitHub Desktop.

Select an option

Save erap129/76686996750758c7530de98bb326a655 to your computer and use it in GitHub Desktop.
reader = Reader(rating_scale=(1, 5))
data = Dataset.load_from_df(ratings_df[['user_id', 'movie_id', 'rating']], reader)
trainset, testset = train_test_split(data, test_size=.25)
LOOCV = LeaveOneOut(n_splits=1, random_state=1)
train_loocv, test_loocv = list(LOOCV.split(data))[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment