Skip to content

Commit 845bd80

Browse files
locks random state in train test split
1 parent d4ba5f6 commit 845bd80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python-recipes/recommendation-systems/01_collaborative_filtering.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
],
252252
"source": [
253253
"# split the data into training and testing sets (80% train, 20% test)\n",
254-
"train_set, test_set = train_test_split(ratings_data, test_size=0.2)\n",
254+
"train_set, test_set = train_test_split(ratings_data, test_size=0.2, random_state=42)\n",
255255
"\n",
256256
"# use SVD (Singular Value Decomposition) for collaborative filtering\n",
257257
"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",

0 commit comments

Comments
 (0)