diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/daisyRec.iml b/.idea/daisyRec.iml
new file mode 100644
index 0000000..039314d
--- /dev/null
+++ b/.idea/daisyRec.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..a879333
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..401d89b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/daisy/__init__.py b/daisy/__init__.py
index f339ce5..7f92b76 100644
--- a/daisy/__init__.py
+++ b/daisy/__init__.py
@@ -1,6 +1,6 @@
-from . import utils
-from . import model
-from . import config
+from daisy import utils
+from daisy import model
+from daisy import config
__all__ = [
@@ -8,4 +8,4 @@
]
-__version__ = 'v2.0.6'
\ No newline at end of file
+__version__ = 'v2.0.7'
diff --git a/daisy/config/__init__.py b/daisy/config/__init__.py
index c23ae94..f8e91f2 100644
--- a/daisy/config/__init__.py
+++ b/daisy/config/__init__.py
@@ -1,3 +1,3 @@
from __future__ import absolute_import
from __future__ import print_function
-from __future__ import division
\ No newline at end of file
+from __future__ import division
diff --git a/daisy/model/AbstractRecommender.py b/daisy/model/AbstractRecommender.py
index 6605683..0a484e5 100644
--- a/daisy/model/AbstractRecommender.py
+++ b/daisy/model/AbstractRecommender.py
@@ -4,8 +4,9 @@
import torch.nn as nn
import torch.optim as optim
-from ..utils.config import initializer_param_config, initializer_config
-from ..utils.loss import BPRLoss, TOP1Loss, HingeLoss
+from daisy.utils.config import initializer_param_config, initializer_config
+from daisy.utils.loss import BPRLoss, TOP1Loss, HingeLoss
+
class AbstractRecommender(nn.Module):
def __init__(self):
diff --git a/daisy/model/EASERecommender.py b/daisy/model/EASERecommender.py
index 6ee57f1..ed98d14 100644
--- a/daisy/model/EASERecommender.py
+++ b/daisy/model/EASERecommender.py
@@ -12,6 +12,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
+
class EASE(GeneralRecommender):
def __init__(self, config):
super(EASE, self).__init__(config)
diff --git a/daisy/model/FMRecommender.py b/daisy/model/FMRecommender.py
index 75adb45..8f92c40 100644
--- a/daisy/model/FMRecommender.py
+++ b/daisy/model/FMRecommender.py
@@ -13,6 +13,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
+
class FM(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/KNNCFRecommender.py b/daisy/model/KNNCFRecommender.py
index 1e34934..7714df0 100644
--- a/daisy/model/KNNCFRecommender.py
+++ b/daisy/model/KNNCFRecommender.py
@@ -28,6 +28,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
+
def convert_df(user_num, item_num, df):
"""
Convert DataFrame to make matrix to make similarity calculation available
diff --git a/daisy/model/MFRecommender.py b/daisy/model/MFRecommender.py
index 62a2f2c..c810645 100644
--- a/daisy/model/MFRecommender.py
+++ b/daisy/model/MFRecommender.py
@@ -16,12 +16,12 @@
year={2012}
}
'''
-
import torch
import torch.nn as nn
from daisy.model.AbstractRecommender import GeneralRecommender
+
class MF(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/NFMRecommender.py b/daisy/model/NFMRecommender.py
index d56e440..5e6a7f4 100644
--- a/daisy/model/NFMRecommender.py
+++ b/daisy/model/NFMRecommender.py
@@ -13,6 +13,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
from daisy.utils.config import initializer_param_config, initializer_config
+
class NFM(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/NGCFRecommender.py b/daisy/model/NGCFRecommender.py
index 72d8ba1..092b431 100644
--- a/daisy/model/NGCFRecommender.py
+++ b/daisy/model/NGCFRecommender.py
@@ -12,7 +12,8 @@
import torch.nn.functional as F
from daisy.model.AbstractRecommender import GeneralRecommender
-from daisy.utils.config import initializer_param_config, initializer_config
+from daisy.utils.config import initializer_config
+
class NGCF(GeneralRecommender):
def __init__(self, config):
diff --git a/daisy/model/NeuMFRecommender.py b/daisy/model/NeuMFRecommender.py
index 66bac26..cff0a44 100644
--- a/daisy/model/NeuMFRecommender.py
+++ b/daisy/model/NeuMFRecommender.py
@@ -13,6 +13,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
from daisy.utils.config import initializer_param_config, initializer_config
+
class NeuMF(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/PopRecommender.py b/daisy/model/PopRecommender.py
index d4ed345..97bed25 100644
--- a/daisy/model/PopRecommender.py
+++ b/daisy/model/PopRecommender.py
@@ -12,6 +12,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
+
class MostPop(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/PureSVDRecommender.py b/daisy/model/PureSVDRecommender.py
index 3cb798d..e73c51f 100644
--- a/daisy/model/PureSVDRecommender.py
+++ b/daisy/model/PureSVDRecommender.py
@@ -14,6 +14,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
+
class PureSVD(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/SLiMRecommender.py b/daisy/model/SLiMRecommender.py
index dd1ff70..61472a6 100644
--- a/daisy/model/SLiMRecommender.py
+++ b/daisy/model/SLiMRecommender.py
@@ -23,6 +23,7 @@
from daisy.model.AbstractRecommender import GeneralRecommender
+
class SLiM(GeneralRecommender):
def __init__(self, config):
"""
diff --git a/daisy/model/__init__.py b/daisy/model/__init__.py
index 7803eab..34c1f33 100644
--- a/daisy/model/__init__.py
+++ b/daisy/model/__init__.py
@@ -1,17 +1,17 @@
-from .EASERecommender import EASE
-from .FMRecommender import FM
-from .Item2VecRecommender import Item2Vec
-from .KNNCFRecommender import ItemKNNCF
-from .MFRecommender import MF
-from .NeuMFRecommender import NeuMF
-from .NFMRecommender import NFM
-from .NGCFRecommender import NGCF
-from .PopRecommender import MostPop
-from .PureSVDRecommender import PureSVD
-from .SLiMRecommender import SLiM
-from .VAECFRecommender import VAECF
+from daisy.model.EASERecommender import EASE
+from daisy.model.FMRecommender import FM
+from daisy.model.Item2VecRecommender import Item2Vec
+from daisy.model.KNNCFRecommender import ItemKNNCF
+from daisy.model.MFRecommender import MF
+from daisy.model.NeuMFRecommender import NeuMF
+from daisy.model.NFMRecommender import NFM
+from daisy.model.NGCFRecommender import NGCF
+from daisy.model.PopRecommender import MostPop
+from daisy.model.PureSVDRecommender import PureSVD
+from daisy.model.SLiMRecommender import SLiM
+from daisy.model.VAECFRecommender import VAECF
__all__ = [
'EASE', 'FM', 'Item2Vec', 'ItemKNNCF', 'MF', 'NeuMF', 'NFM', 'NGCF', 'MostPop',
'PureSVD', 'SLiM', 'VAECF',
-]
\ No newline at end of file
+]
diff --git a/daisy/utils/__init__.py b/daisy/utils/__init__.py
index 7b77bb9..83f30f9 100644
--- a/daisy/utils/__init__.py
+++ b/daisy/utils/__init__.py
@@ -1,11 +1,11 @@
-from .config import *
-from .dataset import *
-from .loader import *
-from .metrics import *
-from .parser import *
-from .sampler import *
-from .splitter import *
-from .utils import *
+from daisy.utils.config import *
+from daisy.utils.dataset import *
+from daisy.utils.loader import *
+from daisy.utils.metrics import *
+from daisy.utils.parser import *
+from daisy.utils.sampler import *
+from daisy.utils.splitter import *
+from daisy.utils.utils import *
__all__ = [
'log_colors_config', 'tune_params_config', 'param_type_config', 'metrics_config',
@@ -15,4 +15,4 @@
'parse_args', 'Metric', 'Coverage', 'Popularity', 'Diversity', 'Precision', 'Recall',
'MRR', 'MAP', 'NDCG', 'HR', 'AUC', 'F1', 'RawDataReader', 'Preprocessor', 'get_dataloader',
'BasicDataset', 'CandidatesDataset', 'AEDataset'
-]
\ No newline at end of file
+]
diff --git a/daisy/utils/config.py b/daisy/utils/config.py
index c5b683f..44d83b5 100644
--- a/daisy/utils/config.py
+++ b/daisy/utils/config.py
@@ -10,22 +10,22 @@
import torch
import torch.nn as nn
-from ..model.KNNCFRecommender import ItemKNNCF
-from ..model.PureSVDRecommender import PureSVD
-from ..model.SLiMRecommender import SLiM
-from ..model.PopRecommender import MostPop
-from ..model.MFRecommender import MF
-from ..model.FMRecommender import FM
-from ..model.Item2VecRecommender import Item2Vec
-from ..model.NeuMFRecommender import NeuMF
-from ..model.NFMRecommender import NFM
-from ..model.NGCFRecommender import NGCF
-from ..model.VAECFRecommender import VAECF
-from ..model.EASERecommender import EASE
-
-from .metrics import Precision, Recall, NDCG, MRR, MAP, HR, F1, AUC, Coverage, Diversity, Popularity
-from .parser import parse_args
-from .utils import ensure_dir, get_local_time
+from daisy.model.KNNCFRecommender import ItemKNNCF
+from daisy.model.PureSVDRecommender import PureSVD
+from daisy.model.SLiMRecommender import SLiM
+from daisy.model.PopRecommender import MostPop
+from daisy.model.MFRecommender import MF
+from daisy.model.FMRecommender import FM
+from daisy.model.Item2VecRecommender import Item2Vec
+from daisy.model.NeuMFRecommender import NeuMF
+from daisy.model.NFMRecommender import NFM
+from daisy.model.NGCFRecommender import NGCF
+from daisy.model.VAECFRecommender import VAECF
+from daisy.model.EASERecommender import EASE
+
+from daisy.utils.metrics import Precision, Recall, NDCG, MRR, MAP, HR, F1, AUC, Coverage, Diversity, Popularity
+from daisy.utils.parser import parse_args
+from daisy.utils.utils import ensure_dir, get_local_time
log_colors_config = {
'DEBUG': 'cyan',
diff --git a/daisy/utils/dataset.py b/daisy/utils/dataset.py
index 9040291..4318620 100644
--- a/daisy/utils/dataset.py
+++ b/daisy/utils/dataset.py
@@ -1,10 +1,12 @@
import torch
from torch.utils.data import Dataset, DataLoader
+
def get_dataloader(ds, batch_size, shuffle, num_workers=4):
return DataLoader(
ds, batch_size=batch_size, shuffle=shuffle, num_workers=num_workers)
+
class BasicDataset(Dataset):
def __init__(self, samples):
'''
diff --git a/daisy/utils/loader.py b/daisy/utils/loader.py
index 901e365..e54fda6 100644
--- a/daisy/utils/loader.py
+++ b/daisy/utils/loader.py
@@ -8,7 +8,8 @@
import scipy.io as sio
from collections import Counter
-from .utils import ensure_dir
+from daisy.utils.utils import ensure_dir
+
class RawDataReader(object):
def __init__(self, config):
diff --git a/daisy/utils/loss.py b/daisy/utils/loss.py
index e809c92..372cd79 100644
--- a/daisy/utils/loss.py
+++ b/daisy/utils/loss.py
@@ -1,6 +1,7 @@
import torch
import torch.nn as nn
+
class BPRLoss(nn.Module):
def __init__(self, gamma=1e-10):
super(BPRLoss, self).__init__()
@@ -11,6 +12,7 @@ def forward(self, pos_score, neg_score):
return loss
+
class HingeLoss(nn.Module):
def __init__(self):
super(HingeLoss, self).__init__()
@@ -20,6 +22,7 @@ def forward(self, pos_score, neg_score):
return loss
+
class TOP1Loss(nn.Module):
def __init__(self):
super(TOP1Loss, self).__init__()
diff --git a/daisy/utils/metrics.py b/daisy/utils/metrics.py
index e6d7ab9..4fb684d 100644
--- a/daisy/utils/metrics.py
+++ b/daisy/utils/metrics.py
@@ -1,6 +1,6 @@
import numpy as np
-from .config import metrics_config
+from daisy.utils.config import metrics_config
class Metric(object):
def __init__(self, config) -> None:
diff --git a/daisy/utils/utils.py b/daisy/utils/utils.py
index b2018a8..10a4d0e 100644
--- a/daisy/utils/utils.py
+++ b/daisy/utils/utils.py
@@ -7,8 +7,8 @@
import scipy.sparse as sp
from collections import defaultdict
-from .metrics import Metric
-from .config import metrics_name_config
+from daisy.utils.metrics import Metric
+from daisy.utils.config import metrics_name_config
def ensure_dir(path):
if not os.path.exists(path):
diff --git a/setup.py b/setup.py
index 4a5cee4..5af600c 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,6 @@
classifiers = ["License :: OSI Approved :: MIT License"]
-
long_description = 'daisyRec is a Python toolkit developed for benchmarking top-N recommendation task.' \
'The name DAISY stands for multi-Dimension fAirly comparIson for recommender SYstem.'
@@ -38,24 +37,24 @@
print('=============================================')
setup(
- name = 'daisyRec',
- packages = [package for package in find_packages() if package.startswith('daisy')],
+ name='daisyRec',
+ packages=[package for package in find_packages() if package.startswith('daisy')],
# packages = find_packages(exclude=['tests*']),
- version = 'v2.0.6', # Ideally should be same as your GitHub release tag varsion
+ version='v2.0.7', # Ideally should be same as your GitHub release tag varsion
description=('An easy-to-use library for recommender systems.'),
- long_description = long_description,
+ long_description=long_description,
# long_description_content_type="text/markdown",
- author = 'Yu Di',
- author_email = 'di.yu.2021@mitb.smu.edu.sg',
- url = 'https://github.com/AmazingDD/daisyRec',
- download_url = 'https://github.com/AmazingDD/daisyRec/archive/refs/tags/v2.0.6.tar.gz',
- keywords = ['ranking', 'recommendation'],
+ author='Yu Di',
+ author_email='di.yu.2021@mitb.smu.edu.sg',
+ url='https://github.com/AmazingDD/daisyRec',
+ download_url='https://github.com/AmazingDD/daisyRec/archive/refs/tags/v2.0.7.tar.gz',
+ keywords=['ranking', 'recommendation'],
include_package_data=True,
install_requires=install_requires,
setup_requires=setup_requires,
extras_require=extras_require,
zip_safe=False,
- classifiers = classifiers,
+ classifiers=classifiers,
)
-# python setup.py sdist upload -r pypi
\ No newline at end of file
+# python setup.py sdist upload -r pypi