Skip to content

Commit

Permalink
Merge pull request #2052 from gazon1/patch-1
Browse files Browse the repository at this point in the history
Fixed bug when reading dataset with timestamp for sasrec model
  • Loading branch information
miguelgfierro committed Feb 7, 2024
2 parents aa5c4e1 + 7205f2a commit 2c22f5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions recommenders/models/sasrec/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ 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:
elif ncols == 2:
self.with_time = False
else:
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)
Expand Down

0 comments on commit 2c22f5e

Please sign in to comment.