Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions cornac/datasets/filmtrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def _get_cache_dir():
cache_dir = get_cache_path('filmtrust')[0]
cache_dir = get_cache_path("filmtrust")[0]
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
return cache_dir
Expand All @@ -44,10 +44,14 @@ def load_feedback(reader: Reader = None) -> List:
data: array-like
Data in the form of a list of tuples (user, item, rating).
"""
fpath = cache(url='https://www.librec.net/datasets/filmtrust.zip',
unzip=True, cache_dir=_get_cache_dir(), relative_path='ratings.txt')
fpath = cache(
url="https://static.preferred.ai/cornac/datasets/filmtrust/filmtrust.zip",
unzip=True,
cache_dir=_get_cache_dir(),
relative_path="ratings.txt",
)
reader = Reader() if reader is None else reader
return reader.read(fpath, sep=' ')
return reader.read(fpath, sep=" ")


def load_trust(reader: Reader = None) -> List:
Expand All @@ -63,7 +67,11 @@ def load_trust(reader: Reader = None) -> List:
data: array-like
Data in the form of a list of tuples (user, user, 1).
"""
fpath = cache(url='https://www.librec.net/datasets/filmtrust.zip',
unzip=True, cache_dir=_get_cache_dir(),relative_path='trust.txt')
fpath = cache(
url="https://static.preferred.ai/cornac/datasets/filmtrust/filmtrust.zip",
unzip=True,
cache_dir=_get_cache_dir(),
relative_path="trust.txt",
)
reader = Reader() if reader is None else reader
return reader.read(fpath, sep=' ')
return reader.read(fpath, sep=" ")