From 81c1d63dc1d81057e22322caf519fc8bb99bb58d Mon Sep 17 00:00:00 2001 From: Jon Alberdi Date: Thu, 7 Mar 2019 15:12:39 +0100 Subject: [PATCH] Use seed in train_test_split Permits having the same result when running the same experiment twice. Follows recommendation given at https://github.com/coreylynch/pyFM/issues/19 --- pyfm/pylibfm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfm/pylibfm.py b/pyfm/pylibfm.py index b0b71a4..5926106 100644 --- a/pyfm/pylibfm.py +++ b/pyfm/pylibfm.py @@ -174,7 +174,7 @@ def fit(self, X, y): if self.verbose == True: print("Creating validation dataset of %.2f of training for adaptive regularization" % self.validation_size) X_train, validation, train_labels, validation_labels = train_test_split( - X, y, test_size=self.validation_size) + X, y, test_size=self.validation_size, random_state=self.seed) self.num_attribute = X_train.shape[1] # Convert datasets to sklearn sequential datasets for fast traversal