Skip to content

Commit

Permalink
Merge pull request #482 from ShanleiMu/master
Browse files Browse the repository at this point in the history
FEA: update setuptools
  • Loading branch information
ShanleiMu authored Nov 3, 2020
2 parents 98fd97c + 52ee656 commit b379bba
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
1 change: 1 addition & 0 deletions conda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$PYTHON setup.py install
39 changes: 39 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package:
name: recbole
version: 0.1.0

source:
path: ../

requirements:
build:
- python
host:
- python
- numpy >=1.17.2
- scipy >=1.3.1
- pandas >=1.0.5
- tqdm >=4.48.2
- pyyaml >=5.1.0
- matplotlib >=3.1.3
- scikit-learn >=0.23.2
- pytorch
run:
- python
- numpy >=1.17.2
- scipy >=1.3.1
- pandas >=1.0.5
- tqdm >=4.48.2
- pyyaml >=5.1.0
- matplotlib >=3.1.3
- scikit-learn >=0.23.2
- pytorch

test:
imports:
- recbole

about:
home: https://recbole.io/
license: MIT
summary: "A unified, comprehensive and efficient recommendation library"
17 changes: 9 additions & 8 deletions recbole/trainer/hyper_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@
"""

import numpy as np

import hyperopt
from functools import partial
from hyperopt import fmin, tpe, hp, pyll
from hyperopt.base import miscs_update_idxs_vals
from hyperopt.pyll.base import dfs, as_apply
from hyperopt.pyll.stochastic import implicit_stochastic_symbols
from hyperopt.pyll.base import Apply

from recbole.utils.utils import dict2str


def _recursiveFindNodes(root, node_type='switch'):
from hyperopt.pyll.base import Apply
nodes = []
if isinstance(root, (list, tuple)):
for node in root:
Expand Down Expand Up @@ -75,6 +69,8 @@ class ExhaustiveSearchError(Exception):


def _validate_space_exhaustive_search(space):
from hyperopt.pyll.base import dfs, as_apply
from hyperopt.pyll.stochastic import implicit_stochastic_symbols
supported_stochastic_symbols = ['randint', 'quniform', 'qloguniform', 'qnormal', 'qlognormal', 'categorical']
for node in dfs(as_apply(space)):
if node.name in implicit_stochastic_symbols:
Expand All @@ -87,6 +83,8 @@ def exhaustive_search(new_ids, domain, trials, seed, nbMaxSucessiveFailures=1000
r""" This is for exhaustive search in HyperTuning.
"""
from hyperopt import pyll
from hyperopt.base import miscs_update_idxs_vals
# Build a hash set for previous trials
hashset = set([hash(frozenset([(key, value[0]) if len(value) > 0 else ((key, None))
for key, value in trial['misc']['vals'].items()])) for trial in trials.trials])
Expand Down Expand Up @@ -139,7 +137,7 @@ class HyperTuning(object):
"""

def __init__(self, objective_function, space=None, params_file=None, fixed_config_file_list=None,
algo=tpe.suggest, max_evals=100):
algo='exhaustive', max_evals=100):
self.best_score = None
self.best_params = None
self.best_test_result = None
Expand All @@ -165,6 +163,7 @@ def __init__(self, objective_function, space=None, params_file=None, fixed_confi

@staticmethod
def _build_space_from_file(file):
from hyperopt import hp
space = {}
with open(file, 'r') as fp:
for line in fp:
Expand Down Expand Up @@ -230,6 +229,7 @@ def trial(self, params):
Args:
params (dict): the parameter dictionary
"""
import hyperopt
config_dict = params.copy()
params_str = self.params2str(params)
print('running parameters:', config_dict)
Expand Down Expand Up @@ -261,4 +261,5 @@ def run(self):
r""" begin to search the best parameters
"""
from hyperopt import fmin
fmin(self.trial, self.space, algo=self.algo, max_evals=self.max_evals)
19 changes: 17 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@

extras_require = {}

classifiers = ["License :: OSI Approved :: MIT License"]

long_description = 'RecBole is developed based on Python and PyTorch for ' \
'reproducing and developing recommendation algorithms in ' \
'a unified, comprehensive and efficient framework for ' \
'research purpose. In the first version, Our library ' \
'includes 53 recommendation algorithms, covering four ' \
'major categories: General Recommendation, Sequential ' \
'Recommendation, Context-aware Recommendation and ' \
'Knowledge-based Recommendation.'

# Readthedocs requires Sphinx extensions to be specified as part of
# install_requires in order to build properly.
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
Expand All @@ -23,7 +34,9 @@
name='recbole',
version=
'0.1.0', # please remember to edit recbole/__init__.py in response, once updating the version
description='A package for building recommender systems',
description='A unified, comprehensive and efficient recommendation library',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/RUCAIBox/RecBole',
author='RecBoleTeam',
author_email='[email protected]',
Expand All @@ -35,4 +48,6 @@
install_requires=install_requires,
setup_requires=setup_requires,
extras_require=extras_require,
zip_safe=False)
zip_safe=False,
classifiers=classifiers,
)

0 comments on commit b379bba

Please sign in to comment.