Skip to content

Commit

Permalink
update 2.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingDD committed Jul 20, 2022
1 parent 69aef73 commit e45c2e4
Show file tree
Hide file tree
Showing 28 changed files with 117 additions and 63 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/daisyRec.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions daisy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from . import utils
from . import model
from . import config
from daisy import utils
from daisy import model
from daisy import config


__all__ = [
'config', 'utils', 'model'
]


__version__ = 'v2.0.6'
__version__ = 'v2.0.7'
2 changes: 1 addition & 1 deletion daisy/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import division
5 changes: 3 additions & 2 deletions daisy/model/AbstractRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions daisy/model/EASERecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from daisy.model.AbstractRecommender import GeneralRecommender


class EASE(GeneralRecommender):
def __init__(self, config):
super(EASE, self).__init__(config)
Expand Down
1 change: 1 addition & 0 deletions daisy/model/FMRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from daisy.model.AbstractRecommender import GeneralRecommender


class FM(GeneralRecommender):
def __init__(self, config):
"""
Expand Down
1 change: 1 addition & 0 deletions daisy/model/KNNCFRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion daisy/model/MFRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
1 change: 1 addition & 0 deletions daisy/model/NFMRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
3 changes: 2 additions & 1 deletion daisy/model/NGCFRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions daisy/model/NeuMFRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
1 change: 1 addition & 0 deletions daisy/model/PopRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from daisy.model.AbstractRecommender import GeneralRecommender


class MostPop(GeneralRecommender):
def __init__(self, config):
"""
Expand Down
1 change: 1 addition & 0 deletions daisy/model/PureSVDRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from daisy.model.AbstractRecommender import GeneralRecommender


class PureSVD(GeneralRecommender):
def __init__(self, config):
"""
Expand Down
1 change: 1 addition & 0 deletions daisy/model/SLiMRecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from daisy.model.AbstractRecommender import GeneralRecommender


class SLiM(GeneralRecommender):
def __init__(self, config):
"""
Expand Down
26 changes: 13 additions & 13 deletions daisy/model/__init__.py
Original file line number Diff line number Diff line change
@@ -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',
]
]
18 changes: 9 additions & 9 deletions daisy/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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'
]
]
32 changes: 16 additions & 16 deletions daisy/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions daisy/utils/dataset.py
Original file line number Diff line number Diff line change
@@ -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):
'''
Expand Down
3 changes: 2 additions & 1 deletion daisy/utils/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions daisy/utils/loss.py
Original file line number Diff line number Diff line change
@@ -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__()
Expand All @@ -11,6 +12,7 @@ def forward(self, pos_score, neg_score):

return loss


class HingeLoss(nn.Module):
def __init__(self):
super(HingeLoss, self).__init__()
Expand All @@ -20,6 +22,7 @@ def forward(self, pos_score, neg_score):

return loss


class TOP1Loss(nn.Module):
def __init__(self):
super(TOP1Loss, self).__init__()
Expand Down
2 changes: 1 addition & 1 deletion daisy/utils/metrics.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions daisy/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
23 changes: 11 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'

Expand Down Expand Up @@ -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 = '[email protected]',
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='[email protected]',
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
# python setup.py sdist upload -r pypi

0 comments on commit e45c2e4

Please sign in to comment.