nextrec 0.4.5__py3-none-any.whl → 0.4.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nextrec/__version__.py +1 -1
- nextrec/basic/callback.py +399 -21
- nextrec/basic/features.py +4 -0
- nextrec/basic/layers.py +103 -24
- nextrec/basic/metrics.py +71 -1
- nextrec/basic/model.py +285 -186
- nextrec/data/data_processing.py +1 -3
- nextrec/loss/loss_utils.py +73 -4
- nextrec/models/generative/__init__.py +16 -0
- nextrec/models/generative/hstu.py +110 -57
- nextrec/models/generative/rqvae.py +826 -0
- nextrec/models/match/dssm.py +5 -4
- nextrec/models/match/dssm_v2.py +4 -3
- nextrec/models/match/mind.py +5 -4
- nextrec/models/match/sdm.py +5 -4
- nextrec/models/match/youtube_dnn.py +5 -4
- nextrec/models/ranking/masknet.py +1 -1
- nextrec/utils/config.py +38 -1
- nextrec/utils/embedding.py +28 -0
- nextrec/utils/initializer.py +4 -4
- nextrec/utils/synthetic_data.py +19 -0
- nextrec-0.4.7.dist-info/METADATA +376 -0
- {nextrec-0.4.5.dist-info → nextrec-0.4.7.dist-info}/RECORD +26 -25
- nextrec-0.4.5.dist-info/METADATA +0 -357
- {nextrec-0.4.5.dist-info → nextrec-0.4.7.dist-info}/WHEEL +0 -0
- {nextrec-0.4.5.dist-info → nextrec-0.4.7.dist-info}/entry_points.txt +0 -0
- {nextrec-0.4.5.dist-info → nextrec-0.4.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
nextrec/__init__.py,sha256=_M3oUqyuvQ5k8Th_3wId6hQ_caclh7M5ad51XN09m98,235
|
|
2
|
-
nextrec/__version__.py,sha256=
|
|
2
|
+
nextrec/__version__.py,sha256=MHGyAIWXVeovtteWUUSzLq9UGWJLLooUZCXB9KGpNK8,22
|
|
3
3
|
nextrec/cli.py,sha256=b6tv7ZO7UBRVR6IfyqVP24JEcdu9-2_vV5MlfWcQucM,18468
|
|
4
4
|
nextrec/basic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
nextrec/basic/activation.py,sha256=uzTWfCOtBSkbu_Gk9XBNTj8__s241CaYLJk6l8nGX9I,2885
|
|
6
|
-
nextrec/basic/callback.py,sha256=
|
|
7
|
-
nextrec/basic/features.py,sha256=
|
|
8
|
-
nextrec/basic/layers.py,sha256=
|
|
6
|
+
nextrec/basic/callback.py,sha256=lELZhkB1TlAT_5My7Ce41u7Rox73rbyaulykWCk-svo,14108
|
|
7
|
+
nextrec/basic/features.py,sha256=kfgU3gCORjYD7ylmKJDrWIrRIL97GcKWCDWeULU5N7g,4339
|
|
8
|
+
nextrec/basic/layers.py,sha256=jDT6nnpCxdgzKMdhU-apxPgjHm-AHujRxjgBum4mBm0,29017
|
|
9
9
|
nextrec/basic/loggers.py,sha256=p9wNmLuRYyvHsOzP0eNOYSlV3hrTDjrt6ggrH_r4RE0,6243
|
|
10
|
-
nextrec/basic/metrics.py,sha256=
|
|
11
|
-
nextrec/basic/model.py,sha256=
|
|
10
|
+
nextrec/basic/metrics.py,sha256=EicHCyyr2j45J-emHf5KifQN6fnb6IV6gqEBu7ioANQ,26066
|
|
11
|
+
nextrec/basic/model.py,sha256=y1SI-isXTGbI9_1J54RMy7u6Hw9PXgjkiMHX38JxUaQ,100515
|
|
12
12
|
nextrec/basic/session.py,sha256=UOG_-EgCOxvqZwCkiEd8sgNV2G1sm_HbzKYVQw8yYDI,4483
|
|
13
13
|
nextrec/data/__init__.py,sha256=auT_PkbgU9pUCt7KQl6H2ajcUorRhSyHa8NG3wExcG8,1197
|
|
14
14
|
nextrec/data/batch_utils.py,sha256=FAJiweuDyAIzX7rICVmcxMofdFs2-7RLinovwB-lAYM,2878
|
|
15
|
-
nextrec/data/data_processing.py,sha256=
|
|
15
|
+
nextrec/data/data_processing.py,sha256=lnpJWqa5KwxxtlDPJ5PsVtO9uKke0u4OaJJvgudjRXI,5302
|
|
16
16
|
nextrec/data/data_utils.py,sha256=LaVNXATcqu0ARPV-6WESQz6JXi3g-zq4uKjcoqBFlqI,1219
|
|
17
17
|
nextrec/data/dataloader.py,sha256=L4VBpWUZrxozFBV54nhJAAC-ZX5Hg6zFwIwpGnguJ9c,18789
|
|
18
18
|
nextrec/data/preprocessor.py,sha256=BxoD6GHEre86i-TbxPi58Uwmg_G7oLkiER6f7VfmVHo,41583
|
|
19
19
|
nextrec/loss/__init__.py,sha256=mO5t417BneZ8Ysa51GyjDaffjWyjzFgPXIQrrggasaQ,827
|
|
20
20
|
nextrec/loss/listwise.py,sha256=UT9vJCOTOQLogVwaeTV7Z5uxIYnngGdxk-p9e97MGkU,5744
|
|
21
|
-
nextrec/loss/loss_utils.py,sha256=
|
|
21
|
+
nextrec/loss/loss_utils.py,sha256=8lGJpiJ7GYplUdQqJL5XzHIiQr98g5pRb2cTYdS5VLA,4646
|
|
22
22
|
nextrec/loss/pairwise.py,sha256=X9yg-8pcPt2IWU0AiUhWAt3_4W_3wIF0uSdDYTdoPFY,3398
|
|
23
23
|
nextrec/loss/pointwise.py,sha256=o9J3OznY0hlbDsUXqn3k-BBzYiuUH5dopz8QBFqS_kQ,7343
|
|
24
|
-
nextrec/models/generative/__init__.py,sha256=
|
|
25
|
-
nextrec/models/generative/hstu.py,sha256=
|
|
24
|
+
nextrec/models/generative/__init__.py,sha256=RU4DRibbfK802rzSXIgf3mSwYsSsYLKJiPzcXqprbvY,350
|
|
25
|
+
nextrec/models/generative/hstu.py,sha256=ro0ifzvlS0SQaS1PMVDjvGDBgql5RnWEPGCu_iRtMrQ,19605
|
|
26
|
+
nextrec/models/generative/rqvae.py,sha256=yxZ9KNEjRu0yxBjeNtCa2Y0ElB97diV_Z92CS9hbhzE,29255
|
|
26
27
|
nextrec/models/generative/tiger.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
28
|
nextrec/models/match/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
-
nextrec/models/match/dssm.py,sha256=
|
|
29
|
-
nextrec/models/match/dssm_v2.py,sha256=
|
|
30
|
-
nextrec/models/match/mind.py,sha256=
|
|
31
|
-
nextrec/models/match/sdm.py,sha256=
|
|
32
|
-
nextrec/models/match/youtube_dnn.py,sha256
|
|
29
|
+
nextrec/models/match/dssm.py,sha256=W6oBOEMGT-xYvhd-qzmGpYqxm9B-fwIQaXE7nEw2gfI,7923
|
|
30
|
+
nextrec/models/match/dssm_v2.py,sha256=I2eWWyzFd7nIiShOB7VPxNMLoqST5IY98WxjDyvAGa8,6955
|
|
31
|
+
nextrec/models/match/mind.py,sha256=semg4EEThD4l7K8fW1wuRF3i9Ex-smJVI4CNORVajvA,15089
|
|
32
|
+
nextrec/models/match/sdm.py,sha256=kwDjDkFpoTmicfKScXjhJLe500upbg8eDXICQLMW03k,10557
|
|
33
|
+
nextrec/models/match/youtube_dnn.py,sha256=-XuaM7lh02qkLCwJF3KgWxOQGn61p92MnYA100LWG4o,7283
|
|
33
34
|
nextrec/models/multi_task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
35
|
nextrec/models/multi_task/esmm.py,sha256=tQg_jE51VDTyc-F0auviyP8CI9uzYQ_KjybbCAXWp1s,6491
|
|
35
36
|
nextrec/models/multi_task/mmoe.py,sha256=qFWKdCE_VSGpVrMgx0NOO-HtLRNGdVxCWdkMfoEgjLA,8583
|
|
@@ -46,24 +47,24 @@ nextrec/models/ranking/dien.py,sha256=G1W_pj8XyGBPgZo_86I3LgfHzQvR-xvR-PGNJZdRdA
|
|
|
46
47
|
nextrec/models/ranking/din.py,sha256=gcibKTxK6nQCCxYMymO9ttu3UG2MSrOWRNBPCmJgMEM,9422
|
|
47
48
|
nextrec/models/ranking/fibinet.py,sha256=OuE4MoG7rHycyRRQtKOvxHbuf7C6zoJFxGFerXmmn9U,7919
|
|
48
49
|
nextrec/models/ranking/fm.py,sha256=ko_Eao9UfklakEk_TVEFZSyVAojmtclo1uIMBhL4FLU,4525
|
|
49
|
-
nextrec/models/ranking/masknet.py,sha256=
|
|
50
|
+
nextrec/models/ranking/masknet.py,sha256=JqBSW1Wh_-P2OoEPss4FBhFdsBfTJYBsj9RR0Eoy6pk,12373
|
|
50
51
|
nextrec/models/ranking/pnn.py,sha256=twwixy26mfAVaI9AqNnMLdwOG-WtDga60xsNiyJrFjI,8174
|
|
51
52
|
nextrec/models/ranking/widedeep.py,sha256=Xm2klmKBOoSKWCBQN7FhwLStu0BHSTOgAJ9kwLmtiFY,5077
|
|
52
53
|
nextrec/models/ranking/xdeepfm.py,sha256=kcPLoNC1940YxRMgWZS4mSxIXlwtc_HfNDIae_uYrsU,8156
|
|
53
54
|
nextrec/utils/__init__.py,sha256=zqU9vjRUpVzJepcvdbxboik68K5jnMR40kdVjr6tpXY,2599
|
|
54
|
-
nextrec/utils/config.py,sha256=
|
|
55
|
+
nextrec/utils/config.py,sha256=69Vj55kujc36iG9Tpx9Ljtjpw3agHr1D17ONI9JRXdo,19811
|
|
55
56
|
nextrec/utils/device.py,sha256=DtgmrJnVJQKtgtVUbm0SW0vZ5Le0R9HU8TsvqPnRLZc,2453
|
|
56
57
|
nextrec/utils/distributed.py,sha256=tIkgUjzEjR_FHOm9ckyM8KddkCfxNSogP-rdHcVGhuk,4782
|
|
57
|
-
nextrec/utils/embedding.py,sha256=
|
|
58
|
+
nextrec/utils/embedding.py,sha256=akAEc062MG2cD7VIOllHaqtwzAirQR2gq5iW7oKpGAU,1449
|
|
58
59
|
nextrec/utils/feature.py,sha256=LcXaWP98zMZhJTKL92VVHX8mqOE5Q0MyVq3hw5Z9kxs,300
|
|
59
60
|
nextrec/utils/file.py,sha256=s2cO1LRbU7xPeAbVoOA6XOoV6wvLrW6oy6p9fVSz9pc,3024
|
|
60
|
-
nextrec/utils/initializer.py,sha256=
|
|
61
|
+
nextrec/utils/initializer.py,sha256=sEkP5DUQ4x2Cydc2h5MoGzBhLr-4tt6x6bqTO2f0TyE,2206
|
|
61
62
|
nextrec/utils/model.py,sha256=dYl1XfIZt6aVjNyV2AAhcArwFRMcEAKrjG_pr8AVHs0,1163
|
|
62
63
|
nextrec/utils/optimizer.py,sha256=eX8baIvWOpwDTGninbyp6pQfzdHbIL62GTi4ldpYcfM,2337
|
|
63
|
-
nextrec/utils/synthetic_data.py,sha256=
|
|
64
|
+
nextrec/utils/synthetic_data.py,sha256=V6lxEQCU-yJXMBCoCAeKZZWBMYXpZhvbyfiI8jCmvqs,18112
|
|
64
65
|
nextrec/utils/tensor.py,sha256=Z6MBpSuQpHw4kGjeKxG0cXZMpRBCM45zTKhk9WolyiM,2220
|
|
65
|
-
nextrec-0.4.
|
|
66
|
-
nextrec-0.4.
|
|
67
|
-
nextrec-0.4.
|
|
68
|
-
nextrec-0.4.
|
|
69
|
-
nextrec-0.4.
|
|
66
|
+
nextrec-0.4.7.dist-info/METADATA,sha256=FBGofRoDIlk-Y4TE1-QNFaLgHSM1SVOWlm9fvThE-QM,19456
|
|
67
|
+
nextrec-0.4.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
68
|
+
nextrec-0.4.7.dist-info/entry_points.txt,sha256=NN-dNSdfMRTv86bNXM7d3ZEPW2BQC6bRi7QP7i9cIps,45
|
|
69
|
+
nextrec-0.4.7.dist-info/licenses/LICENSE,sha256=2fQfVKeafywkni7MYHyClC6RGGC3laLTXCNBx-ubtp0,1064
|
|
70
|
+
nextrec-0.4.7.dist-info/RECORD,,
|
nextrec-0.4.5.dist-info/METADATA
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: nextrec
|
|
3
|
-
Version: 0.4.5
|
|
4
|
-
Summary: A comprehensive recommendation library with match, ranking, and multi-task learning models
|
|
5
|
-
Project-URL: Homepage, https://github.com/zerolovesea/NextRec
|
|
6
|
-
Project-URL: Repository, https://github.com/zerolovesea/NextRec
|
|
7
|
-
Project-URL: Documentation, https://github.com/zerolovesea/NextRec/blob/main/README.md
|
|
8
|
-
Project-URL: Issues, https://github.com/zerolovesea/NextRec/issues
|
|
9
|
-
Author-email: zerolovesea <zyaztec@gmail.com>
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Keywords: ctr,deep-learning,match,pytorch,ranking,recommendation
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Intended Audience :: Science/Research
|
|
15
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
-
Requires-Python: >=3.10
|
|
22
|
-
Requires-Dist: numpy<2.0,>=1.21; sys_platform == 'linux' and python_version < '3.12'
|
|
23
|
-
Requires-Dist: numpy<3.0,>=1.26; sys_platform == 'linux' and python_version >= '3.12'
|
|
24
|
-
Requires-Dist: numpy>=1.23.0; sys_platform == 'win32'
|
|
25
|
-
Requires-Dist: numpy>=1.24.0; sys_platform == 'darwin'
|
|
26
|
-
Requires-Dist: pandas<2.0,>=1.5; sys_platform == 'linux' and python_version < '3.12'
|
|
27
|
-
Requires-Dist: pandas<2.3.0,>=2.1.0; sys_platform == 'win32'
|
|
28
|
-
Requires-Dist: pandas>=2.0.0; sys_platform == 'darwin'
|
|
29
|
-
Requires-Dist: pandas>=2.1.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
30
|
-
Requires-Dist: pyarrow<13.0.0,>=10.0.0; sys_platform == 'linux' and python_version < '3.12'
|
|
31
|
-
Requires-Dist: pyarrow<15.0.0,>=12.0.0; sys_platform == 'win32'
|
|
32
|
-
Requires-Dist: pyarrow>=12.0.0; sys_platform == 'darwin'
|
|
33
|
-
Requires-Dist: pyarrow>=16.0.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
34
|
-
Requires-Dist: scikit-learn<2.0,>=1.2; sys_platform == 'linux' and python_version < '3.12'
|
|
35
|
-
Requires-Dist: scikit-learn>=1.3.0; sys_platform == 'darwin'
|
|
36
|
-
Requires-Dist: scikit-learn>=1.3.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
37
|
-
Requires-Dist: scikit-learn>=1.3.0; sys_platform == 'win32'
|
|
38
|
-
Requires-Dist: scipy<1.12,>=1.8; sys_platform == 'linux' and python_version < '3.12'
|
|
39
|
-
Requires-Dist: scipy>=1.10.0; sys_platform == 'darwin'
|
|
40
|
-
Requires-Dist: scipy>=1.10.0; sys_platform == 'win32'
|
|
41
|
-
Requires-Dist: scipy>=1.11.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
42
|
-
Requires-Dist: torch>=2.0.0
|
|
43
|
-
Requires-Dist: torchvision>=0.15.0
|
|
44
|
-
Requires-Dist: tqdm>=4.65.0
|
|
45
|
-
Provides-Extra: dev
|
|
46
|
-
Requires-Dist: jupyter>=1.0.0; extra == 'dev'
|
|
47
|
-
Requires-Dist: matplotlib>=3.7.0; extra == 'dev'
|
|
48
|
-
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
49
|
-
Requires-Dist: pytest-html>=3.2.0; extra == 'dev'
|
|
50
|
-
Requires-Dist: pytest-mock>=3.11.0; extra == 'dev'
|
|
51
|
-
Requires-Dist: pytest-timeout>=2.1.0; extra == 'dev'
|
|
52
|
-
Requires-Dist: pytest-xdist>=3.3.0; extra == 'dev'
|
|
53
|
-
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
54
|
-
Requires-Dist: seaborn>=0.12.0; extra == 'dev'
|
|
55
|
-
Description-Content-Type: text/markdown
|
|
56
|
-
|
|
57
|
-
<p align="center">
|
|
58
|
-
<img align="center" src="assets/logo.png" width="40%">
|
|
59
|
-
<p>
|
|
60
|
-
|
|
61
|
-
<div align="center">
|
|
62
|
-
|
|
63
|
-

|
|
64
|
-

|
|
65
|
-

|
|
66
|
-

|
|
67
|
-
|
|
68
|
-
English | [中文文档](README_zh.md)
|
|
69
|
-
|
|
70
|
-
**A Unified, Efficient, and Scalable Recommendation System Framework**
|
|
71
|
-
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
## Table of Contents
|
|
75
|
-
|
|
76
|
-
- [Introduction](#introduction)
|
|
77
|
-
- [Installation](#installation)
|
|
78
|
-
- [Architecture](#architecture)
|
|
79
|
-
- [5-Minute Quick Start](#5-minute-quick-start)
|
|
80
|
-
- [CLI Usage](#cli-usage)
|
|
81
|
-
- [Platform Compatibility](#platform-compatibility)
|
|
82
|
-
- [Supported Models](#supported-models)
|
|
83
|
-
- [Contributing](#contributing)
|
|
84
|
-
|
|
85
|
-
## Introduction
|
|
86
|
-
|
|
87
|
-
NextRec is a modern recommendation framework built on PyTorch, delivering a unified experience for modeling, training, and evaluation. Design with rich model implementations, data-processing utilities, and engineering-ready training components. NextRec focuses on large-scale industrial recommendation scenarios on Spark clusters, training on massive offline features(`parquet/csv`).
|
|
88
|
-
|
|
89
|
-
## Why NextRec
|
|
90
|
-
|
|
91
|
-
- **Unified feature engineering & data pipeline**: NextRec provide unified Dense/Sparse/Sequence feature definitions, DataProcessor, and batch-optimized RecDataLoader, matching offline feature training/inference in industrial big-data settings.
|
|
92
|
-
- **Multi-scenario coverage**: Ranking (CTR/CVR), retrieval, multi-task learning, and more marketing/rec models, with a continuously expanding model zoo.
|
|
93
|
-
- **Developer-friendly experience**: `Stream processing/distributed training/inference` for `csv/parquet/pathlike` data, plus GPU/MPS acceleration and visualization support.
|
|
94
|
-
- **Efficient training & evaluation**: Standardized engine with optimizers, LR schedulers, early stopping, checkpoints, and detailed logging out of the box.
|
|
95
|
-
|
|
96
|
-
## Architecture
|
|
97
|
-
|
|
98
|
-
NextRec adopts a modular design, enabling full-pipeline reusability and scalability across data processing → model construction → training & evaluation → inference & deployment. Its core components include: a Feature-Spec-driven Embedding architecture, the BaseModel abstraction, a set of independent reusable Layers, a unified DataLoader for both training and inference, and a ready-to-use Model Zoo.
|
|
99
|
-
|
|
100
|
-

|
|
101
|
-
|
|
102
|
-
> The project borrows ideas from excellent open-source rec libraries, for example: [torch-rechub](https://github.com/datawhalechina/torch-rechub). torch-rechub remains mature in architecture and models; the author contributed a bit there—feel free to check it out.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Installation
|
|
107
|
-
|
|
108
|
-
You can quickly install the latest NextRec via `pip install nextrec`; Python 3.10+ is required. If you want to run some tutorial codes, pull this project first:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
git clone https://github.com/zerolovesea/NextRec.git
|
|
112
|
-
cd NextRec/
|
|
113
|
-
pip install nextrec # or pip install -e .
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Tutorials
|
|
117
|
-
|
|
118
|
-
See `tutorials/` for examples covering ranking, retrieval, multi-task learning, and data processing:
|
|
119
|
-
|
|
120
|
-
- [movielen_ranking_deepfm.py](/tutorials/movielen_ranking_deepfm.py) — DeepFM training on MovieLens 100k dataset
|
|
121
|
-
- [example_ranking_din.py](/tutorials/example_ranking_din.py) — DIN Deep Interest Network training on e-commerce dataset
|
|
122
|
-
- [example_multitask.py](/tutorials/example_multitask.py) — ESMM multi-task learning training on e-commerce dataset
|
|
123
|
-
- [movielen_match_dssm.py](/tutorials/example_match_dssm.py) — DSSM retrieval model training on MovieLens 100k dataset
|
|
124
|
-
|
|
125
|
-
- [run_all_ranking_models.py](/tutorials/run_all_ranking_models.py) — Quickly validate availability of all ranking models
|
|
126
|
-
- [run_all_multitask_models.py](/tutorials/run_all_multitask_models.py) — Quickly validate availability of all multi-task models
|
|
127
|
-
- [run_all_match_models.py](/tutorials/run_all_match_models.py) — Quickly validate availability of all retrieval models
|
|
128
|
-
|
|
129
|
-
To dive deeper into NextRec framework details, Jupyter notebooks are available:
|
|
130
|
-
|
|
131
|
-
- [Hands on the NextRec framework](/tutorials/notebooks/en/Hands%20on%20nextrec.ipynb)
|
|
132
|
-
- [Using the data processor for preprocessing](/tutorials/notebooks/en/Hands%20on%20dataprocessor.ipynb)
|
|
133
|
-
|
|
134
|
-
## 5-Minute Quick Start
|
|
135
|
-
|
|
136
|
-
We provide a detailed quick-start guide and paired datasets to help you get familiar with different features of NextRec framework. In `datasets/` you'll find an e-commerce scenario test dataset like this:
|
|
137
|
-
|
|
138
|
-
| user_id | item_id | dense_0 | dense_1 | dense_2 | dense_3 | dense_4 | dense_5 | dense_6 | dense_7 | sparse_0 | sparse_1 | sparse_2 | sparse_3 | sparse_4 | sparse_5 | sparse_6 | sparse_7 | sparse_8 | sparse_9 | sequence_0 | sequence_1 | label |
|
|
139
|
-
|--------|---------|-------------|-------------|-------------|------------|-------------|-------------|-------------|-------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|-----------------------------------------------------------|-----------------------------------------------------------|-------|
|
|
140
|
-
| 1 | 7817 | 0.14704075 | 0.31020382 | 0.77780896 | 0.944897 | 0.62315375 | 0.57124174 | 0.77009535 | 0.3211029 | 315 | 260 | 379 | 146 | 168 | 161 | 138 | 88 | 5 | 312 | [170,175,97,338,105,353,272,546,175,545,463,128,0,0,0] | [368,414,820,405,548,63,327,0,0,0,0,0,0,0,0] | 0 |
|
|
141
|
-
| 1 | 3579 | 0.77811223 | 0.80359334 | 0.5185201 | 0.91091245 | 0.043562356 | 0.82142705 | 0.8803686 | 0.33748195 | 149 | 229 | 442 | 6 | 167 | 252 | 25 | 402 | 7 | 168 | [179,48,61,551,284,165,344,151,0,0,0,0,0,0,0] | [814,0,0,0,0,0,0,0,0,0,0,0,0,0,0] | 1 |
|
|
142
|
-
|
|
143
|
-
Below is a short example showing how to train a DIN (Deep Interest Network) model. You can also run `python tutorials/example_ranking_din.py` directly to execute the training and inference code.
|
|
144
|
-
|
|
145
|
-
After training starts, you can find detailed training logs at `nextrec_logs/din_tutorial`.
|
|
146
|
-
|
|
147
|
-
```python
|
|
148
|
-
import pandas as pd
|
|
149
|
-
|
|
150
|
-
from nextrec.models.ranking.din import DIN
|
|
151
|
-
from nextrec.basic.features import DenseFeature, SparseFeature, SequenceFeature
|
|
152
|
-
|
|
153
|
-
df = pd.read_csv('dataset/ranking_task.csv')
|
|
154
|
-
|
|
155
|
-
for col in df.columns and 'sequence' in col: # csv loads lists as text; convert them back to objects
|
|
156
|
-
df[col] = df[col].apply(lambda x: eval(x) if isinstance(x, str) else x)
|
|
157
|
-
|
|
158
|
-
# Define feature columns
|
|
159
|
-
dense_features = [DenseFeature(name=f'dense_{i}', input_dim=1) for i in range(8)]
|
|
160
|
-
|
|
161
|
-
sparse_features = [SparseFeature(name='user_id', embedding_name='user_emb', vocab_size=int(df['user_id'].max() + 1), embedding_dim=32), SparseFeature(name='item_id', embedding_name='item_emb', vocab_size=int(df['item_id'].max() + 1), embedding_dim=32),]
|
|
162
|
-
|
|
163
|
-
sparse_features.extend([SparseFeature(name=f'sparse_{i}', embedding_name=f'sparse_{i}_emb', vocab_size=int(df[f'sparse_{i}'].max() + 1), embedding_dim=32) for i in range(10)])
|
|
164
|
-
|
|
165
|
-
sequence_features = [
|
|
166
|
-
SequenceFeature(name='sequence_0', vocab_size=int(df['sequence_0'].apply(lambda x: max(x)).max() + 1), embedding_dim=32, padding_idx=0, embedding_name='item_emb'),
|
|
167
|
-
SequenceFeature(name='sequence_1', vocab_size=int(df['sequence_1'].apply(lambda x: max(x)).max() + 1), embedding_dim=16, padding_idx=0, embedding_name='sparse_0_emb'),]
|
|
168
|
-
|
|
169
|
-
mlp_params = {
|
|
170
|
-
"dims": [256, 128, 64],
|
|
171
|
-
"activation": "relu",
|
|
172
|
-
"dropout": 0.3,
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
model = DIN(
|
|
176
|
-
dense_features=dense_features,
|
|
177
|
-
sparse_features=sparse_features,
|
|
178
|
-
sequence_features=sequence_features,
|
|
179
|
-
mlp_params=mlp_params,
|
|
180
|
-
attention_hidden_units=[80, 40],
|
|
181
|
-
attention_activation='sigmoid',
|
|
182
|
-
attention_use_softmax=True,
|
|
183
|
-
target=['label'], # target variable
|
|
184
|
-
device='mps',
|
|
185
|
-
embedding_l1_reg=1e-6,
|
|
186
|
-
embedding_l2_reg=1e-5,
|
|
187
|
-
dense_l1_reg=1e-5,
|
|
188
|
-
dense_l2_reg=1e-4,
|
|
189
|
-
session_id="din_tutorial", # experiment id for logs
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
# Compile model with optimizer and loss
|
|
193
|
-
model.compile(
|
|
194
|
-
optimizer = "adam",
|
|
195
|
-
optimizer_params = {"lr": 1e-3, "weight_decay": 1e-5},
|
|
196
|
-
loss = "focal",
|
|
197
|
-
loss_params={"gamma": 2.0, "alpha": 0.25},
|
|
198
|
-
)
|
|
199
|
-
|
|
200
|
-
model.fit(
|
|
201
|
-
train_data=df,
|
|
202
|
-
metrics=['auc', 'gauc', 'logloss'], # metrics to track
|
|
203
|
-
epochs=3,
|
|
204
|
-
batch_size=512,
|
|
205
|
-
shuffle=True,
|
|
206
|
-
user_id_column='user_id' # used for GAUC
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
# Evaluate after training
|
|
210
|
-
metrics = model.evaluate(
|
|
211
|
-
df,
|
|
212
|
-
metrics=['auc', 'gauc', 'logloss'],
|
|
213
|
-
batch_size=512,
|
|
214
|
-
user_id_column='user_id'
|
|
215
|
-
)
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
## CLI Usage
|
|
219
|
-
|
|
220
|
-
NextRec provides a powerful command-line interface for model training and prediction using YAML configuration files. For detailed CLI documentation, see:
|
|
221
|
-
|
|
222
|
-
- [NextRec CLI User Guide](/nextrec_cli_preset/NextRec-CLI.md) - Complete guide for using the CLI
|
|
223
|
-
- [NextRec CLI Configuration Examples](/nextrec_cli_preset/) - CLI configuration file examples
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
# Train a model
|
|
227
|
-
nextrec --mode=train --train_config=path/to/train_config.yaml
|
|
228
|
-
|
|
229
|
-
# Run prediction
|
|
230
|
-
nextrec --mode=predict --predict_config=path/to/predict_config.yaml
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
> As of version 0.4.5, NextRec CLI supports single-machine training; distributed training features are currently under development.
|
|
234
|
-
|
|
235
|
-
## Platform Compatibility
|
|
236
|
-
|
|
237
|
-
The current version is 0.4.5. All models and test code have been validated on the following platforms. If you encounter compatibility issues, please report them in the issue tracker with your system version:
|
|
238
|
-
|
|
239
|
-
| Platform | Configuration |
|
|
240
|
-
|----------|---------------|
|
|
241
|
-
| MacOS latest | MacBook Pro M4 Pro 24GB RAM |
|
|
242
|
-
| Ubuntu latest | AutoDL 4070D Dual GPU |
|
|
243
|
-
| CentOS 7 | Intel Xeon 5138Y 96 cores 377GB RAM |
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
## Supported Models
|
|
248
|
-
|
|
249
|
-
### Ranking Models
|
|
250
|
-
|
|
251
|
-
| Model | Paper | Year | Status |
|
|
252
|
-
|-------|-------|------|--------|
|
|
253
|
-
| [FM](nextrec/models/ranking/fm.py) | Factorization Machines | ICDM 2010 | Supported |
|
|
254
|
-
| [AFM](nextrec/models/ranking/afm.py) | Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks | IJCAI 2017 | Supported |
|
|
255
|
-
| [DeepFM](nextrec/models/ranking/deepfm.py) | DeepFM: A Factorization-Machine based Neural Network for CTR Prediction | IJCAI 2017 | Supported |
|
|
256
|
-
| [Wide&Deep](nextrec/models/ranking/widedeep.py) | Wide & Deep Learning for Recommender Systems | DLRS 2016 | Supported |
|
|
257
|
-
| [xDeepFM](nextrec/models/ranking/xdeepfm.py) | xDeepFM: Combining Explicit and Implicit Feature Interactions | KDD 2018 | Supported |
|
|
258
|
-
| [FiBiNET](nextrec/models/ranking/fibinet.py) | FiBiNET: Combining Feature Importance and Bilinear Feature Interaction for CTR Prediction | RecSys 2019 | Supported |
|
|
259
|
-
| [PNN](nextrec/models/ranking/pnn.py) | Product-based Neural Networks for User Response Prediction | ICDM 2016 | Supported |
|
|
260
|
-
| [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic Feature Interaction Learning | CIKM 2019 | Supported |
|
|
261
|
-
| [DCN](nextrec/models/ranking/dcn.py) | Deep & Cross Network for Ad Click Predictions | ADKDD 2017 | Supported |
|
|
262
|
-
| [DCN v2](nextrec/models/ranking/dcn_v2.py) | DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems | KDD 2021 | In Progress |
|
|
263
|
-
| [DIN](nextrec/models/ranking/din.py) | Deep Interest Network for CTR Prediction | KDD 2018 | Supported |
|
|
264
|
-
| [DIEN](nextrec/models/ranking/dien.py) | Deep Interest Evolution Network | AAAI 2019 | Supported |
|
|
265
|
-
| [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Feature-wise Gating Blocks for High-dimensional Sparse Recommendation Data | 2020 | Supported |
|
|
266
|
-
|
|
267
|
-
### Retrieval Models
|
|
268
|
-
|
|
269
|
-
| Model | Paper | Year | Status |
|
|
270
|
-
|-------|-------|------|--------|
|
|
271
|
-
| [DSSM](nextrec/models/match/dssm.py) | Learning Deep Structured Semantic Models | CIKM 2013 | Supported |
|
|
272
|
-
| [DSSM v2](nextrec/models/match/dssm_v2.py) | DSSM with pairwise BPR-style optimization | - | Supported |
|
|
273
|
-
| [YouTube DNN](nextrec/models/match/youtube_dnn.py) | Deep Neural Networks for YouTube Recommendations | RecSys 2016 | Supported |
|
|
274
|
-
| [MIND](nextrec/models/match/mind.py) | Multi-Interest Network with Dynamic Routing | CIKM 2019 | Supported |
|
|
275
|
-
| [SDM](nextrec/models/match/sdm.py) | Sequential Deep Matching Model | - | Supported |
|
|
276
|
-
|
|
277
|
-
### Multi-task Models
|
|
278
|
-
|
|
279
|
-
| Model | Paper | Year | Status |
|
|
280
|
-
|-------|-------|------|--------|
|
|
281
|
-
| [MMOE](nextrec/models/multi_task/mmoe.py) | Modeling Task Relationships in Multi-task Learning | KDD 2018 | Supported |
|
|
282
|
-
| [PLE](nextrec/models/multi_task/ple.py) | Progressive Layered Extraction | RecSys 2020 | Supported |
|
|
283
|
-
| [ESMM](nextrec/models/multi_task/esmm.py) | Entire Space Multi-task Model | SIGIR 2018 | Supported |
|
|
284
|
-
| [ShareBottom](nextrec/models/multi_task/share_bottom.py) | Multitask Learning | - | Supported |
|
|
285
|
-
| [POSO](nextrec/models/multi_task/poso.py) | POSO: Personalized Cold-start Modules for Large-scale Recommender Systems | 2021 | Supported |
|
|
286
|
-
|
|
287
|
-
### Generative Models
|
|
288
|
-
|
|
289
|
-
| Model | Paper | Year | Status |
|
|
290
|
-
|-------|-------|------|--------|
|
|
291
|
-
| [TIGER](nextrec/models/generative/tiger.py) | Recommender Systems with Generative Retrieval | NeurIPS 2023 | In Progress |
|
|
292
|
-
| [HSTU](nextrec/models/generative/hstu.py) | Hierarchical Sequential Transduction Units | - | Supported |
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
## Contributing
|
|
297
|
-
|
|
298
|
-
We welcome contributions of any form!
|
|
299
|
-
|
|
300
|
-
### How to Contribute
|
|
301
|
-
|
|
302
|
-
1. Fork the repository
|
|
303
|
-
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
304
|
-
3. Commit your changes (`git commit -m 'Add AmazingFeature'`)
|
|
305
|
-
4. Push your branch (`git push origin feature/AmazingFeature`)
|
|
306
|
-
5. Open a Pull Request
|
|
307
|
-
|
|
308
|
-
> Before submitting a PR, please run `python test/run_tests.py` and `python scripts/format_code.py` to ensure all tests pass and code style is consistent.
|
|
309
|
-
|
|
310
|
-
### Code Style
|
|
311
|
-
|
|
312
|
-
- Follow PEP8
|
|
313
|
-
- Provide unit tests for new functionality
|
|
314
|
-
- Update documentation accordingly
|
|
315
|
-
|
|
316
|
-
### Reporting Issues
|
|
317
|
-
|
|
318
|
-
When submitting issues on GitHub, please include:
|
|
319
|
-
|
|
320
|
-
- Description of the problem
|
|
321
|
-
- Reproduction steps
|
|
322
|
-
- Expected behavior
|
|
323
|
-
- Actual behavior
|
|
324
|
-
- Environment info (Python version, PyTorch version, etc.)
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
## License
|
|
329
|
-
|
|
330
|
-
This project is licensed under the [Apache 2.0 License](./LICENSE).
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## Contact
|
|
335
|
-
|
|
336
|
-
- **GitHub Issues**: [Submit an issue](https://github.com/zerolovesea/NextRec/issues)
|
|
337
|
-
- **Email**: zyaztec@gmail.com
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Acknowledgements
|
|
342
|
-
|
|
343
|
-
NextRec is inspired by the following great open-source projects:
|
|
344
|
-
|
|
345
|
-
- [torch-rechub](https://github.com/datawhalechina/torch-rechub) — Flexible, easy-to-extend recommendation framework
|
|
346
|
-
- [FuxiCTR](https://github.com/reczoo/FuxiCTR) — Configurable, tunable, and reproducible CTR library
|
|
347
|
-
- [RecBole](https://github.com/RUCAIBox/RecBole) — Unified, comprehensive, and efficient recommendation library
|
|
348
|
-
|
|
349
|
-
Special thanks to all open-source contributors!
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
<div align="center">
|
|
354
|
-
|
|
355
|
-
**[Back to Top](#nextrec)**
|
|
356
|
-
|
|
357
|
-
</div>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|