Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug when reading dataset with timestamp for sasrec model #2052

Merged
merged 9 commits into from
Feb 7, 2024
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
Loading