nextrec 0.4.31__py3-none-any.whl → 0.4.33__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/model.py +60 -12
- nextrec/basic/summary.py +2 -1
- nextrec/cli.py +56 -41
- nextrec/data/batch_utils.py +2 -2
- nextrec/data/preprocessor.py +125 -26
- nextrec/models/multi_task/[pre]aitm.py +3 -3
- nextrec/models/multi_task/[pre]snr_trans.py +3 -3
- nextrec/models/multi_task/[pre]star.py +3 -3
- nextrec/models/multi_task/apg.py +3 -3
- nextrec/models/multi_task/cross_stitch.py +3 -3
- nextrec/models/multi_task/escm.py +3 -3
- nextrec/models/multi_task/esmm.py +3 -3
- nextrec/models/multi_task/hmoe.py +3 -3
- nextrec/models/multi_task/mmoe.py +3 -3
- nextrec/models/multi_task/pepnet.py +4 -4
- nextrec/models/multi_task/ple.py +3 -3
- nextrec/models/multi_task/poso.py +3 -3
- nextrec/models/multi_task/share_bottom.py +3 -3
- nextrec/models/ranking/afm.py +3 -2
- nextrec/models/ranking/autoint.py +3 -2
- nextrec/models/ranking/dcn.py +3 -2
- nextrec/models/ranking/dcn_v2.py +3 -2
- nextrec/models/ranking/deepfm.py +3 -2
- nextrec/models/ranking/dien.py +3 -2
- nextrec/models/ranking/din.py +3 -2
- nextrec/models/ranking/eulernet.py +3 -2
- nextrec/models/ranking/ffm.py +3 -2
- nextrec/models/ranking/fibinet.py +3 -2
- nextrec/models/ranking/fm.py +3 -2
- nextrec/models/ranking/lr.py +3 -2
- nextrec/models/ranking/masknet.py +3 -2
- nextrec/models/ranking/pnn.py +3 -2
- nextrec/models/ranking/widedeep.py +3 -2
- nextrec/models/ranking/xdeepfm.py +3 -2
- nextrec/models/tree_base/__init__.py +15 -0
- nextrec/models/tree_base/base.py +693 -0
- nextrec/models/tree_base/catboost.py +97 -0
- nextrec/models/tree_base/lightgbm.py +69 -0
- nextrec/models/tree_base/xgboost.py +61 -0
- nextrec/utils/config.py +1 -0
- nextrec/utils/types.py +2 -0
- {nextrec-0.4.31.dist-info → nextrec-0.4.33.dist-info}/METADATA +5 -5
- {nextrec-0.4.31.dist-info → nextrec-0.4.33.dist-info}/RECORD +47 -42
- {nextrec-0.4.31.dist-info → nextrec-0.4.33.dist-info}/licenses/LICENSE +1 -1
- {nextrec-0.4.31.dist-info → nextrec-0.4.33.dist-info}/WHEEL +0 -0
- {nextrec-0.4.31.dist-info → nextrec-0.4.33.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou,zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Ma X, Zhao L, Huang G, Wang Z, Hu Z, Zhu X, Gai K. Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate. In: Proceedings of the 41st International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR ’18), 2018, pp. 1137–1140.
|
|
@@ -46,7 +46,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
46
46
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
47
47
|
from nextrec.basic.heads import TaskHead
|
|
48
48
|
from nextrec.basic.model import BaseModel
|
|
49
|
-
from nextrec.utils.types import
|
|
49
|
+
from nextrec.utils.types import TaskTypeInput
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
class ESMM(BaseModel):
|
|
@@ -76,7 +76,7 @@ class ESMM(BaseModel):
|
|
|
76
76
|
sequence_features: list[SequenceFeature],
|
|
77
77
|
ctr_mlp_params: dict,
|
|
78
78
|
cvr_mlp_params: dict,
|
|
79
|
-
task: list[
|
|
79
|
+
task: list[TaskTypeInput] | None = None,
|
|
80
80
|
target: list[str] | None = None, # Note: ctcvr = ctr * cvr
|
|
81
81
|
**kwargs,
|
|
82
82
|
):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 01/01/2026
|
|
3
|
-
Checkpoint: edit on 01/
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
[1] Zhao Z, Liu Y, Jin R, Zhu X, He X. HMOE: Improving Multi-Scenario Learning to Rank in E-commerce by Exploiting Task Relationships in the Label Space. Proceedings of the 29th ACM International Conference on Information & Knowledge Management (CIKM ’20), 2020, pp. 2069–2078.
|
|
6
6
|
URL: https://dl.acm.org/doi/10.1145/3340531.3412713
|
|
@@ -23,7 +23,7 @@ from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
|
23
23
|
from nextrec.basic.heads import TaskHead
|
|
24
24
|
from nextrec.basic.model import BaseModel
|
|
25
25
|
from nextrec.utils.model import get_mlp_output_dim
|
|
26
|
-
from nextrec.utils.types import TaskTypeName
|
|
26
|
+
from nextrec.utils.types import TaskTypeInput, TaskTypeName
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class HMOE(BaseModel):
|
|
@@ -53,7 +53,7 @@ class HMOE(BaseModel):
|
|
|
53
53
|
tower_mlp_params_list: list[dict] | None = None,
|
|
54
54
|
task_weight_mlp_params: list[dict] | None = None,
|
|
55
55
|
target: list[str] | str | None = None,
|
|
56
|
-
task:
|
|
56
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
57
57
|
**kwargs,
|
|
58
58
|
) -> None:
|
|
59
59
|
dense_features = dense_features or []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou,zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Ma J, Zhao Z, Yi X, Chen J, Hong L, Chi E H. Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts. In: Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD ’18), 2018, pp. 1930–1939.
|
|
@@ -48,7 +48,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
48
48
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
49
49
|
from nextrec.basic.heads import TaskHead
|
|
50
50
|
from nextrec.basic.model import BaseModel
|
|
51
|
-
from nextrec.utils.types import
|
|
51
|
+
from nextrec.utils.types import TaskTypeInput
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
class MMOE(BaseModel):
|
|
@@ -81,7 +81,7 @@ class MMOE(BaseModel):
|
|
|
81
81
|
num_experts: int = 3,
|
|
82
82
|
tower_mlp_params_list: list[dict] | None = None,
|
|
83
83
|
target: list[str] | str | None = None,
|
|
84
|
-
task:
|
|
84
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
85
85
|
**kwargs,
|
|
86
86
|
):
|
|
87
87
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 01/01/2026
|
|
3
|
-
Checkpoint: edit on 01/
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Chang J, Zhang C, Hui Y, Leng D, Niu Y, Song Y, Gai K. PEPNet: Parameter and Embedding Personalized Network for Infusing with Personalized Prior Information. In: Proceedings of the 29th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD ’23), 2023.
|
|
@@ -58,7 +58,7 @@ from nextrec.basic.layers import EmbeddingLayer, GateMLP
|
|
|
58
58
|
from nextrec.basic.heads import TaskHead
|
|
59
59
|
from nextrec.basic.model import BaseModel
|
|
60
60
|
from nextrec.utils.model import select_features
|
|
61
|
-
from nextrec.utils.types import TaskTypeName
|
|
61
|
+
from nextrec.utils.types import TaskTypeInput, TaskTypeName
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
class PPNet(nn.Module):
|
|
@@ -184,7 +184,7 @@ class PEPNet(BaseModel):
|
|
|
184
184
|
sparse_features: list[SparseFeature] | None = None,
|
|
185
185
|
sequence_features: list[SequenceFeature] | None = None,
|
|
186
186
|
target: list[str] | str | None = None,
|
|
187
|
-
task:
|
|
187
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
188
188
|
mlp_params: dict | None = None,
|
|
189
189
|
feature_gate_mlp_params: dict | None = None,
|
|
190
190
|
gate_mlp_params: dict | None = None,
|
|
@@ -334,7 +334,7 @@ class PEPNet(BaseModel):
|
|
|
334
334
|
|
|
335
335
|
task_logits = []
|
|
336
336
|
for block in self.ppnet_blocks:
|
|
337
|
-
|
|
337
|
+
task_logits.append(block(o_ep=dnn_input, o_prior=task_sf_emb))
|
|
338
338
|
|
|
339
339
|
y = torch.cat(task_logits, dim=1)
|
|
340
340
|
return self.prediction_layer(y)
|
nextrec/models/multi_task/ple.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou,zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Tang H, Liu J, Zhao M, Gong X. Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations. In: Proceedings of the 14th ACM Conference on Recommender Systems (RecSys ’20), 2020, pp. 269–278.
|
|
@@ -52,7 +52,7 @@ from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
|
52
52
|
from nextrec.basic.heads import TaskHead
|
|
53
53
|
from nextrec.basic.model import BaseModel
|
|
54
54
|
from nextrec.utils.model import get_mlp_output_dim
|
|
55
|
-
|
|
55
|
+
from nextrec.utils.types import TaskTypeInput
|
|
56
56
|
|
|
57
57
|
class CGCLayer(nn.Module):
|
|
58
58
|
"""
|
|
@@ -202,7 +202,7 @@ class PLE(BaseModel):
|
|
|
202
202
|
num_levels: int = 2,
|
|
203
203
|
tower_mlp_params_list: list[dict] | None = None,
|
|
204
204
|
target: list[str] | None = None,
|
|
205
|
-
task:
|
|
205
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
206
206
|
**kwargs,
|
|
207
207
|
):
|
|
208
208
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 28/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou,zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Dai S, Lin H, Zhao Z, Lin J, Wu H, Wang Z, Yang S, Liu J. POSO: Personalized Cold Start Modules for Large-scale Recommender Systems. arXiv preprint arXiv:2108.04690, 2021.
|
|
@@ -50,7 +50,7 @@ from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
|
50
50
|
from nextrec.basic.heads import TaskHead
|
|
51
51
|
from nextrec.basic.model import BaseModel
|
|
52
52
|
from nextrec.utils.model import select_features
|
|
53
|
-
from nextrec.utils.types import
|
|
53
|
+
from nextrec.utils.types import TaskTypeInput
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
class POSOGate(nn.Module):
|
|
@@ -310,7 +310,7 @@ class POSO(BaseModel):
|
|
|
310
310
|
pc_sequence_features: list[str] | None,
|
|
311
311
|
tower_mlp_params_list: list[dict],
|
|
312
312
|
target: list[str] | None = None,
|
|
313
|
-
task:
|
|
313
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
314
314
|
architecture: Literal["mlp", "mmoe"] = "mlp",
|
|
315
315
|
# POSO gating defaults
|
|
316
316
|
gate_hidden_dim: int = 32,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou,zyaztec@gmail.com
|
|
5
5
|
|
|
6
6
|
Shared-Bottom is the classic hard-parameter-sharing baseline for multi-task learning.
|
|
@@ -43,7 +43,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
43
43
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
44
44
|
from nextrec.basic.heads import TaskHead
|
|
45
45
|
from nextrec.basic.model import BaseModel
|
|
46
|
-
|
|
46
|
+
from nextrec.utils.types import TaskTypeInput
|
|
47
47
|
|
|
48
48
|
class ShareBottom(BaseModel):
|
|
49
49
|
@property
|
|
@@ -65,7 +65,7 @@ class ShareBottom(BaseModel):
|
|
|
65
65
|
bottom_mlp_params: dict,
|
|
66
66
|
tower_mlp_params_list: list[dict],
|
|
67
67
|
target: list[str],
|
|
68
|
-
task:
|
|
68
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
69
69
|
**kwargs,
|
|
70
70
|
):
|
|
71
71
|
|
nextrec/models/ranking/afm.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Xiao J, Ye H, He X, et al. Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks
|
|
@@ -43,6 +43,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
43
43
|
from nextrec.basic.layers import EmbeddingLayer, InputMask
|
|
44
44
|
from nextrec.basic.heads import TaskHead
|
|
45
45
|
from nextrec.basic.model import BaseModel
|
|
46
|
+
from nextrec.utils.types import TaskTypeInput
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
class AFM(BaseModel):
|
|
@@ -60,7 +61,7 @@ class AFM(BaseModel):
|
|
|
60
61
|
sparse_features: list[SparseFeature] | None = None,
|
|
61
62
|
sequence_features: list[SequenceFeature] | None = None,
|
|
62
63
|
target: str | list[str] | None = None,
|
|
63
|
-
task:
|
|
64
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
64
65
|
attention_dim: int = 32,
|
|
65
66
|
attention_dropout: float = 0.0,
|
|
66
67
|
**kwargs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Song W, Shi C, Xiao Z, et al. AutoInt: Automatic feature interaction learning via self-attentive neural networks. In: Proceedings of the 28th ACM International Conference on Information and Knowledge Management (CIKM ’19), 2019, pp. 1161–1170.
|
|
@@ -59,6 +59,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
59
59
|
from nextrec.basic.layers import EmbeddingLayer, MultiHeadSelfAttention
|
|
60
60
|
from nextrec.basic.heads import TaskHead
|
|
61
61
|
from nextrec.basic.model import BaseModel
|
|
62
|
+
from nextrec.utils.types import TaskTypeInput
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
class AutoInt(BaseModel):
|
|
@@ -76,7 +77,7 @@ class AutoInt(BaseModel):
|
|
|
76
77
|
sparse_features: list[SparseFeature],
|
|
77
78
|
sequence_features: list[SequenceFeature],
|
|
78
79
|
target: str | list[str] | None = None,
|
|
79
|
-
task:
|
|
80
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
80
81
|
att_layer_num: int = 3,
|
|
81
82
|
att_embedding_dim: int = 8,
|
|
82
83
|
att_head_num: int = 2,
|
nextrec/models/ranking/dcn.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Wang R, Fu B, Fu G, et al. Deep & cross network for ad click predictions[C] //Proceedings of the ADKDD'17. 2017: 1-7.
|
|
@@ -56,6 +56,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
56
56
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
57
57
|
from nextrec.basic.heads import TaskHead
|
|
58
58
|
from nextrec.basic.model import BaseModel
|
|
59
|
+
from nextrec.utils.types import TaskTypeInput
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
class CrossNetwork(nn.Module):
|
|
@@ -94,7 +95,7 @@ class DCN(BaseModel):
|
|
|
94
95
|
sparse_features: list[SparseFeature] | None = None,
|
|
95
96
|
sequence_features: list[SequenceFeature] | None = None,
|
|
96
97
|
target: str | list[str] | None = None,
|
|
97
|
-
task:
|
|
98
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
98
99
|
cross_num: int = 3,
|
|
99
100
|
mlp_params: dict | None = None,
|
|
100
101
|
**kwargs,
|
nextrec/models/ranking/dcn_v2.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] R. Wang et al. DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems. KDD 2021.
|
|
@@ -49,6 +49,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
49
49
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
50
50
|
from nextrec.basic.heads import TaskHead
|
|
51
51
|
from nextrec.basic.model import BaseModel
|
|
52
|
+
from nextrec.utils.types import TaskTypeInput
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
class CrossNetV2(nn.Module):
|
|
@@ -192,7 +193,7 @@ class DCNv2(BaseModel):
|
|
|
192
193
|
sparse_features: list[SparseFeature] | None = None,
|
|
193
194
|
sequence_features: list[SequenceFeature] | None = None,
|
|
194
195
|
target: str | list[str] | None = None,
|
|
195
|
-
task:
|
|
196
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
196
197
|
cross_num: int = 3,
|
|
197
198
|
cross_type: Literal["matrix", "mix", "low_rank"] = "matrix",
|
|
198
199
|
architecture: Literal["parallel", "stacked"] = "parallel",
|
nextrec/models/ranking/deepfm.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 27/10/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou,zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Guo H, Tang R, Ye Y, et al. DeepFM: A factorization-machine based neural network for CTR prediction[J]. arXiv preprint arXiv:1703.04247, 2017.
|
|
@@ -45,6 +45,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
45
45
|
from nextrec.basic.layers import FM, LR, MLP, EmbeddingLayer
|
|
46
46
|
from nextrec.basic.heads import TaskHead
|
|
47
47
|
from nextrec.basic.model import BaseModel
|
|
48
|
+
from nextrec.utils.types import TaskTypeInput
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
class DeepFM(BaseModel):
|
|
@@ -62,7 +63,7 @@ class DeepFM(BaseModel):
|
|
|
62
63
|
sparse_features: list[SparseFeature] | None = None,
|
|
63
64
|
sequence_features: list[SequenceFeature] | None = None,
|
|
64
65
|
target: str | list[str] | None = None,
|
|
65
|
-
task:
|
|
66
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
66
67
|
mlp_params: dict | None = None,
|
|
67
68
|
**kwargs,
|
|
68
69
|
):
|
nextrec/models/ranking/dien.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
3
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
4
|
-
Checkpoint: edit on
|
|
4
|
+
Checkpoint: edit on 01/14/2026
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Zhou G, Mou N, Fan Y, et al. Deep interest evolution network for click-through rate prediction[C] // Proceedings of the AAAI conference on artificial intelligence. 2019, 33(01): 5941-5948. (https://arxiv.org/abs/1809.03672)
|
|
7
7
|
|
|
@@ -56,6 +56,7 @@ from nextrec.basic.layers import (
|
|
|
56
56
|
)
|
|
57
57
|
from nextrec.basic.heads import TaskHead
|
|
58
58
|
from nextrec.basic.model import BaseModel
|
|
59
|
+
from nextrec.utils.types import TaskTypeInput
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
class AUGRU(nn.Module):
|
|
@@ -204,7 +205,7 @@ class DIEN(BaseModel):
|
|
|
204
205
|
sparse_features: list[SparseFeature] | None = None,
|
|
205
206
|
sequence_features: list[SequenceFeature] | None = None,
|
|
206
207
|
target: str | list[str] | None = None,
|
|
207
|
-
task:
|
|
208
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
208
209
|
behavior_feature_name: str | None = None,
|
|
209
210
|
candidate_feature_name: str | None = None,
|
|
210
211
|
neg_behavior_feature_name: str | None = None,
|
nextrec/models/ranking/din.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Zhou G, Zhu X, Song C, et al. Deep interest network for click-through rate prediction[C] //Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining. 2018: 1059-1068.
|
|
@@ -56,6 +56,7 @@ from nextrec.basic.layers import (
|
|
|
56
56
|
)
|
|
57
57
|
from nextrec.basic.heads import TaskHead
|
|
58
58
|
from nextrec.basic.model import BaseModel
|
|
59
|
+
from nextrec.utils.types import TaskTypeInput
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
class DIN(BaseModel):
|
|
@@ -73,7 +74,7 @@ class DIN(BaseModel):
|
|
|
73
74
|
sparse_features: list[SparseFeature] | None = None,
|
|
74
75
|
sequence_features: list[SequenceFeature] | None = None,
|
|
75
76
|
target: str | list[str] | None = None,
|
|
76
|
-
task:
|
|
77
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
77
78
|
behavior_feature_name: str | None = None,
|
|
78
79
|
candidate_feature_name: str | None = None,
|
|
79
80
|
mlp_params: dict | None = None,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Zhao Z, Zhang H, Tang H, et al. EulerNet: Efficient and Effective Feature Interaction Modeling with Euler's Formula. (SIGIR 2021)
|
|
@@ -40,6 +40,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
40
40
|
from nextrec.basic.layers import LR, EmbeddingLayer
|
|
41
41
|
from nextrec.basic.heads import TaskHead
|
|
42
42
|
from nextrec.basic.model import BaseModel
|
|
43
|
+
from nextrec.utils.types import TaskTypeInput
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
class EulerInteractionLayer(nn.Module):
|
|
@@ -200,7 +201,7 @@ class EulerNet(BaseModel):
|
|
|
200
201
|
sparse_features: list[SparseFeature] | None = None,
|
|
201
202
|
sequence_features: list[SequenceFeature] | None = None,
|
|
202
203
|
target: str | list[str] | None = None,
|
|
203
|
-
task:
|
|
204
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
204
205
|
num_layers: int = 2,
|
|
205
206
|
num_orders: int = 8,
|
|
206
207
|
use_implicit: bool = True,
|
nextrec/models/ranking/ffm.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 19/12/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Juan Y, Zhuang Y, Chin W-S, et al. Field-aware Factorization Machines for CTR Prediction[C]//RecSys. 2016: 43-50.
|
|
@@ -45,6 +45,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
45
45
|
from nextrec.basic.layers import AveragePooling, InputMask, SumPooling
|
|
46
46
|
from nextrec.basic.heads import TaskHead
|
|
47
47
|
from nextrec.basic.model import BaseModel
|
|
48
|
+
from nextrec.utils.types import TaskTypeInput
|
|
48
49
|
from nextrec.utils.torch_utils import get_initializer
|
|
49
50
|
|
|
50
51
|
|
|
@@ -63,7 +64,7 @@ class FFM(BaseModel):
|
|
|
63
64
|
sparse_features: list[SparseFeature] | None = None,
|
|
64
65
|
sequence_features: list[SequenceFeature] | None = None,
|
|
65
66
|
target: str | list[str] | None = None,
|
|
66
|
-
task:
|
|
67
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
67
68
|
**kwargs,
|
|
68
69
|
):
|
|
69
70
|
dense_features = dense_features or []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Huang T, Zhang Z, Zhang B, et al. FiBiNET: Combining feature importance and bilinear feature interaction for click-through rate prediction[C]//RecSys. 2019: 169-177.
|
|
@@ -52,6 +52,7 @@ from nextrec.basic.layers import (
|
|
|
52
52
|
)
|
|
53
53
|
from nextrec.basic.heads import TaskHead
|
|
54
54
|
from nextrec.basic.model import BaseModel
|
|
55
|
+
from nextrec.utils.types import TaskTypeInput
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
class FiBiNET(BaseModel):
|
|
@@ -69,7 +70,7 @@ class FiBiNET(BaseModel):
|
|
|
69
70
|
sparse_features: list[SparseFeature] | None = None,
|
|
70
71
|
sequence_features: list[SequenceFeature] | None = None,
|
|
71
72
|
target: str | list[str] | None = None,
|
|
72
|
-
task:
|
|
73
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
73
74
|
mlp_params: dict | None = None,
|
|
74
75
|
interaction_combo: Literal[
|
|
75
76
|
"01", "11", "10", "00"
|
nextrec/models/ranking/fm.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Rendle S. Factorization machines[C]//ICDM. 2010: 995-1000.
|
|
@@ -43,6 +43,7 @@ from nextrec.basic.layers import FM as FMInteraction
|
|
|
43
43
|
from nextrec.basic.heads import TaskHead
|
|
44
44
|
from nextrec.basic.layers import LR, EmbeddingLayer
|
|
45
45
|
from nextrec.basic.model import BaseModel
|
|
46
|
+
from nextrec.utils.types import TaskTypeInput
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
class FM(BaseModel):
|
|
@@ -60,7 +61,7 @@ class FM(BaseModel):
|
|
|
60
61
|
sparse_features: list[SparseFeature] | None = None,
|
|
61
62
|
sequence_features: list[SequenceFeature] | None = None,
|
|
62
63
|
target: str | list[str] | None = None,
|
|
63
|
-
task:
|
|
64
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
64
65
|
**kwargs,
|
|
65
66
|
):
|
|
66
67
|
|
nextrec/models/ranking/lr.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Hosmer D W, Lemeshow S, Sturdivant R X. Applied Logistic Regression.
|
|
@@ -42,6 +42,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
42
42
|
from nextrec.basic.layers import EmbeddingLayer, LR as LinearLayer
|
|
43
43
|
from nextrec.basic.heads import TaskHead
|
|
44
44
|
from nextrec.basic.model import BaseModel
|
|
45
|
+
from nextrec.utils.types import TaskTypeInput
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
class LR(BaseModel):
|
|
@@ -59,7 +60,7 @@ class LR(BaseModel):
|
|
|
59
60
|
sparse_features: list[SparseFeature] | None = None,
|
|
60
61
|
sequence_features: list[SequenceFeature] | None = None,
|
|
61
62
|
target: str | list[str] | None = None,
|
|
62
|
-
task:
|
|
63
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
63
64
|
**kwargs,
|
|
64
65
|
):
|
|
65
66
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Wang Z, She Q, Zhang J. MaskNet: Introducing Feature-Wise Multiplication to CTR Ranking Models by Instance-Guided Mask.
|
|
@@ -60,6 +60,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
60
60
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
61
61
|
from nextrec.basic.heads import TaskHead
|
|
62
62
|
from nextrec.basic.model import BaseModel
|
|
63
|
+
from nextrec.utils.types import TaskTypeInput
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
class InstanceGuidedMask(nn.Module):
|
|
@@ -167,7 +168,7 @@ class MaskNet(BaseModel):
|
|
|
167
168
|
sparse_features: list[SparseFeature] | None = None,
|
|
168
169
|
sequence_features: list[SequenceFeature] | None = None,
|
|
169
170
|
target: str | list[str] | None = None,
|
|
170
|
-
task:
|
|
171
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
171
172
|
architecture: Literal[
|
|
172
173
|
"serial", "parallel"
|
|
173
174
|
] = "parallel", # "serial" or "parallel"
|
nextrec/models/ranking/pnn.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Qu Y, Cai H, Ren K, et al. Product-based neural networks for user response prediction[C]//ICDM. 2016: 1149-1154. (https://arxiv.org/abs/1611.00144)
|
|
@@ -40,6 +40,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
40
40
|
from nextrec.basic.layers import MLP, EmbeddingLayer
|
|
41
41
|
from nextrec.basic.heads import TaskHead
|
|
42
42
|
from nextrec.basic.model import BaseModel
|
|
43
|
+
from nextrec.utils.types import TaskTypeInput
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
class PNN(BaseModel):
|
|
@@ -58,7 +59,7 @@ class PNN(BaseModel):
|
|
|
58
59
|
sparse_features: list[SparseFeature] | None = None,
|
|
59
60
|
sequence_features: list[SequenceFeature] | None = None,
|
|
60
61
|
target: str | list[str] | None = None,
|
|
61
|
-
task:
|
|
62
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
62
63
|
mlp_params: dict | None = None,
|
|
63
64
|
product_type: Literal[
|
|
64
65
|
"inner", "outer", "both"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Cheng H T, Koc L, Harmsen J, et al. Wide & Deep learning for recommender systems[C] //Proceedings of the 1st Workshop on Deep Learning for Recommender Systems. 2016: 7-10.
|
|
@@ -41,6 +41,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
41
41
|
from nextrec.basic.layers import LR, MLP, EmbeddingLayer
|
|
42
42
|
from nextrec.basic.heads import TaskHead
|
|
43
43
|
from nextrec.basic.model import BaseModel
|
|
44
|
+
from nextrec.utils.types import TaskTypeInput
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
class WideDeep(BaseModel):
|
|
@@ -58,7 +59,7 @@ class WideDeep(BaseModel):
|
|
|
58
59
|
sparse_features: list[SparseFeature],
|
|
59
60
|
sequence_features: list[SequenceFeature],
|
|
60
61
|
target: str | list[str] | None = None,
|
|
61
|
-
task:
|
|
62
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
62
63
|
mlp_params: dict | None = None,
|
|
63
64
|
**kwargs,
|
|
64
65
|
):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Date: create on 09/11/2025
|
|
3
|
-
Checkpoint: edit on
|
|
3
|
+
Checkpoint: edit on 01/14/2026
|
|
4
4
|
Author: Yang Zhou, zyaztec@gmail.com
|
|
5
5
|
Reference:
|
|
6
6
|
- [1] Lian J, Zhou X, Zhang F, et al. xdeepfm: Combining explicit and implicit feature interactions for recommender systems[C]//Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining. 2018: 1754-1763.
|
|
@@ -57,6 +57,7 @@ from nextrec.basic.features import DenseFeature, SequenceFeature, SparseFeature
|
|
|
57
57
|
from nextrec.basic.layers import LR, MLP, EmbeddingLayer
|
|
58
58
|
from nextrec.basic.heads import TaskHead
|
|
59
59
|
from nextrec.basic.model import BaseModel
|
|
60
|
+
from nextrec.utils.types import TaskTypeInput
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
class CIN(nn.Module):
|
|
@@ -117,7 +118,7 @@ class xDeepFM(BaseModel):
|
|
|
117
118
|
sparse_features: list[SparseFeature],
|
|
118
119
|
sequence_features: list[SequenceFeature],
|
|
119
120
|
target: str | list[str] | None = None,
|
|
120
|
-
task:
|
|
121
|
+
task: TaskTypeInput | list[TaskTypeInput] | None = None,
|
|
121
122
|
mlp_params: dict | None = None,
|
|
122
123
|
cin_size: list[int] | None = None,
|
|
123
124
|
split_half: bool = True,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tree-based models for NextRec.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from nextrec.models.tree_base.base import TreeBaseModel
|
|
6
|
+
from nextrec.models.tree_base.catboost import Catboost
|
|
7
|
+
from nextrec.models.tree_base.lightgbm import Lightgbm
|
|
8
|
+
from nextrec.models.tree_base.xgboost import Xgboost
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"TreeBaseModel",
|
|
12
|
+
"Xgboost",
|
|
13
|
+
"Lightgbm",
|
|
14
|
+
"Catboost",
|
|
15
|
+
]
|