-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from saghiles/master
Reorganize: results, Add: Amazon Office datasets, Tests Graph module and office data
- Loading branch information
Showing
14 changed files
with
6,632 additions
and
5,859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
@author: Aghiles Salah <asalah@smu.edu.sg> | ||
This data is built based on the Amazon datasets provided by Julian McAuley at: http://jmcauley.ucsd.edu/data/amazon/ | ||
""" | ||
|
||
from ..utils import validate_format | ||
from ..utils import cache | ||
from ..data import reader | ||
|
||
VALID_DATA_FORMATS = ['UIR', 'UIRT'] | ||
|
||
|
||
def load_rating(data_format='UIR'): | ||
"""Load the user-item ratings | ||
Parameters | ||
---------- | ||
data_format: str, default: 'UIR' | ||
Data format to be returned. | ||
Returns | ||
------- | ||
data: array-like | ||
Data in the form of a list of tuples depending on the specified data format. | ||
""" | ||
|
||
data_format = validate_format(data_format, VALID_DATA_FORMATS) | ||
fpath = cache(url='https://static.preferred.ai/cornac/datasets/amazon_office/rating.txt', | ||
relative_path='amazon_office/rating.txt') | ||
if data_format == 'UIR': | ||
return reader.read_uir(fpath,sep=' ') | ||
|
||
|
||
def load_context(data_format='UIR'): | ||
"""Load the item-item interactions | ||
Parameters | ||
---------- | ||
data_format: str, default: 'UIR' | ||
Data format to be returned. | ||
Returns | ||
------- | ||
data: array-like | ||
Data in the form of a list of tuples depending on the specified data format. | ||
""" | ||
|
||
data_format = validate_format(data_format, VALID_DATA_FORMATS) | ||
fpath = cache(url='https://static.preferred.ai/cornac/datasets/amazon_office/context.txt', | ||
relative_path='amazon_office/context.txt') | ||
if data_format == 'UIR': | ||
return reader.read_uir(fpath,sep=' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.