From 26641987cd7dacd0c2b14a4d07f09c688bbb72fe Mon Sep 17 00:00:00 2001 From: Drobin Max Date: Fri, 5 Jan 2024 12:49:17 +0300 Subject: [PATCH 1/4] Update util.py Fixed bug with reading dataset with splitting dataset with timestamp --- recommenders/models/sasrec/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recommenders/models/sasrec/util.py b/recommenders/models/sasrec/util.py index 8c81b563c..965c76467 100644 --- a/recommenders/models/sasrec/util.py +++ b/recommenders/models/sasrec/util.py @@ -35,7 +35,7 @@ def __init__(self, **kwargs): if self.filename: with open(self.filename, "r") as fr: sample = fr.readline() - ncols = sample.strip().split(self.col_sep) + ncols = len(sample.strip().split(self.col_sep)) if ncols == 3: self.with_time = True else: From 292fdf5fcab92202bf0ceaa48dd3f736813c56eb Mon Sep 17 00:00:00 2001 From: Drobin Max Date: Fri, 5 Jan 2024 13:03:35 +0300 Subject: [PATCH 2/4] Update util.py added exception for unkown count of columns --- recommenders/models/sasrec/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recommenders/models/sasrec/util.py b/recommenders/models/sasrec/util.py index 965c76467..e1b692446 100644 --- a/recommenders/models/sasrec/util.py +++ b/recommenders/models/sasrec/util.py @@ -38,8 +38,10 @@ def __init__(self, **kwargs): ncols = len(sample.strip().split(self.col_sep)) if ncols == 3: self.with_time = True - else: + elif ncol == 2: self.with_time = False + else: + raise ValueError(f'3 or 2 columns must be in dataset. Given {ncol} columns') def split(self, **kwargs): self.filename = kwargs.get("filename", self.filename) From 0c1933acf87877dcef03652cda700dafcd20bf69 Mon Sep 17 00:00:00 2001 From: Drobin Max Date: Fri, 5 Jan 2024 13:04:48 +0300 Subject: [PATCH 3/4] Update util.py fixed typo --- recommenders/models/sasrec/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recommenders/models/sasrec/util.py b/recommenders/models/sasrec/util.py index e1b692446..2aadb6435 100644 --- a/recommenders/models/sasrec/util.py +++ b/recommenders/models/sasrec/util.py @@ -38,10 +38,10 @@ def __init__(self, **kwargs): ncols = len(sample.strip().split(self.col_sep)) if ncols == 3: self.with_time = True - elif ncol == 2: + elif ncols == 2: self.with_time = False else: - raise ValueError(f'3 or 2 columns must be in dataset. Given {ncol} columns') + raise ValueError(f'3 or 2 columns must be in dataset. Given {ncols} columns') def split(self, **kwargs): self.filename = kwargs.get("filename", self.filename) From 7205f2aa8e5016690d6eb68454a49b996c3ad26a Mon Sep 17 00:00:00 2001 From: Miguel Fierro <3491412+miguelgfierro@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:42:31 +0100 Subject: [PATCH 4/4] Update util.py --- recommenders/models/sasrec/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recommenders/models/sasrec/util.py b/recommenders/models/sasrec/util.py index 2aadb6435..b92999bd2 100644 --- a/recommenders/models/sasrec/util.py +++ b/recommenders/models/sasrec/util.py @@ -41,7 +41,7 @@ def __init__(self, **kwargs): elif ncols == 2: self.with_time = False else: - raise ValueError(f'3 or 2 columns must be in dataset. Given {ncols} columns') + raise ValueError(f"3 or 2 columns must be in dataset. Given {ncols} columns") def split(self, **kwargs): self.filename = kwargs.get("filename", self.filename)