From 845bd80c928c306e4d015dbd178d60fdfb4dfc5d Mon Sep 17 00:00:00 2001 From: Justin Cechmanek Date: Tue, 10 Dec 2024 11:22:04 -0800 Subject: [PATCH] locks random state in train test split --- .../recommendation-systems/01_collaborative_filtering.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-recipes/recommendation-systems/01_collaborative_filtering.ipynb b/python-recipes/recommendation-systems/01_collaborative_filtering.ipynb index 84165cb..e1abfc6 100644 --- a/python-recipes/recommendation-systems/01_collaborative_filtering.ipynb +++ b/python-recipes/recommendation-systems/01_collaborative_filtering.ipynb @@ -251,7 +251,7 @@ ], "source": [ "# split the data into training and testing sets (80% train, 20% test)\n", - "train_set, test_set = train_test_split(ratings_data, test_size=0.2)\n", + "train_set, test_set = train_test_split(ratings_data, test_size=0.2, random_state=42)\n", "\n", "# use SVD (Singular Value Decomposition) for collaborative filtering\n", "svd = SVD(n_factors=100, biased=False) # we'll set biased to False so that predictions are of the form \"rating_prediction = user_vector dot item_vector\"\n",