Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] make NeuRec portable as a package instead of static project style #35

Open
DavidChenLondon opened this issue Oct 9, 2020 · 0 comments

Comments

@DavidChenLondon
Copy link
Contributor

Issue

NeuRec is an awesome project, and I had applied TransRec session-based recommender and achieved the best performance comparing to other individual algorithms.

However, regarding the engineering perspective, NeuRec is unfriendly in terms of Python project style when trying to modify its code (e.g. add serialization feature) in order to use it as a package along with other machine learning libraries, because it does not put all the classes under a unified package namespace (normal Python package will create its own root namespace, e.g. import tensorflow as tf) and using some absolute importing for relative directory (see below log).

➜  tmp ls NeuRec
NeuRec.properties          appveyor.yml               conf                       evaluator                  next.png                   travis_linux_steps.sh
README.md                  appveyor_windows_steps.ps1 data                       main.py                    requirements.txt           tutorial.ipynb
WeChat_QR_Code.jpg         architecture.jpg           dataset                    model                      setup.py                   util
➜  tmp python
Python 3.6.3 (default, Jan 29 2020, 11:15:24)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.10.44.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import NeuRec.data
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dev/tmp/NeuRec/data/__init__.py", line 1, in <module>
    from .sampler import PointwiseSampler
  File "/Users/dev/tmp/NeuRec/data/sampler.py", line 4, in <module>
    from util import DataIterator
ModuleNotFoundError: No module named 'util'.
>>>

This should be done by relative importing from .util import Data or absolute importing from NeuRec.util import Data.

Solution

The solution should be easy, create a new root directory 'NeuRec' and move all components into 'NeuRec' as the subdirectories, although lots of trivial importing statements in all Python files needs to be fixed.
I have a temporary solution https://github.com/DavidChenLondon/NeuRec/tree/smk which works in our recommendation engine, and includes other features like serializing NeuRec TensorFlow models.

However, I know that NeuRec is under active development (https://github.com/wubinzzu/NeuRec/tree/v3.x with https://github.com/ZhongchuanSun/reckit) currently, so it's hard for me to make a diverged change without discussing with NeuRec team first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant