nextrec 0.4.31__py3-none-any.whl → 0.4.32__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.
Files changed (46) hide show
  1. nextrec/__version__.py +1 -1
  2. nextrec/basic/model.py +48 -4
  3. nextrec/cli.py +16 -10
  4. nextrec/data/batch_utils.py +2 -2
  5. nextrec/data/preprocessor.py +53 -1
  6. nextrec/models/multi_task/[pre]aitm.py +3 -3
  7. nextrec/models/multi_task/[pre]snr_trans.py +3 -3
  8. nextrec/models/multi_task/[pre]star.py +3 -3
  9. nextrec/models/multi_task/apg.py +3 -3
  10. nextrec/models/multi_task/cross_stitch.py +3 -3
  11. nextrec/models/multi_task/escm.py +3 -3
  12. nextrec/models/multi_task/esmm.py +3 -3
  13. nextrec/models/multi_task/hmoe.py +3 -3
  14. nextrec/models/multi_task/mmoe.py +3 -3
  15. nextrec/models/multi_task/pepnet.py +4 -4
  16. nextrec/models/multi_task/ple.py +3 -3
  17. nextrec/models/multi_task/poso.py +3 -3
  18. nextrec/models/multi_task/share_bottom.py +3 -3
  19. nextrec/models/ranking/afm.py +3 -2
  20. nextrec/models/ranking/autoint.py +3 -2
  21. nextrec/models/ranking/dcn.py +3 -2
  22. nextrec/models/ranking/dcn_v2.py +3 -2
  23. nextrec/models/ranking/deepfm.py +3 -2
  24. nextrec/models/ranking/dien.py +3 -2
  25. nextrec/models/ranking/din.py +3 -2
  26. nextrec/models/ranking/eulernet.py +3 -2
  27. nextrec/models/ranking/ffm.py +3 -2
  28. nextrec/models/ranking/fibinet.py +3 -2
  29. nextrec/models/ranking/fm.py +3 -2
  30. nextrec/models/ranking/lr.py +3 -2
  31. nextrec/models/ranking/masknet.py +3 -2
  32. nextrec/models/ranking/pnn.py +3 -2
  33. nextrec/models/ranking/widedeep.py +3 -2
  34. nextrec/models/ranking/xdeepfm.py +3 -2
  35. nextrec/models/tree_base/__init__.py +15 -0
  36. nextrec/models/tree_base/base.py +693 -0
  37. nextrec/models/tree_base/catboost.py +97 -0
  38. nextrec/models/tree_base/lightgbm.py +69 -0
  39. nextrec/models/tree_base/xgboost.py +61 -0
  40. nextrec/utils/config.py +1 -0
  41. nextrec/utils/types.py +2 -0
  42. {nextrec-0.4.31.dist-info → nextrec-0.4.32.dist-info}/METADATA +5 -5
  43. {nextrec-0.4.31.dist-info → nextrec-0.4.32.dist-info}/RECORD +46 -41
  44. {nextrec-0.4.31.dist-info → nextrec-0.4.32.dist-info}/licenses/LICENSE +1 -1
  45. {nextrec-0.4.31.dist-info → nextrec-0.4.32.dist-info}/WHEEL +0 -0
  46. {nextrec-0.4.31.dist-info → nextrec-0.4.32.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 23/12/2025
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: str | list[str] | None = None,
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",
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Date: create on 27/10/2025
3
- Checkpoint: edit on 23/12/2025
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: str | list[str] | None = None,
66
+ task: TaskTypeInput | list[TaskTypeInput] | None = None,
66
67
  mlp_params: dict | None = None,
67
68
  **kwargs,
68
69
  ):
@@ -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 09/12/2025
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: str | list[str] | None = None,
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,
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Date: create on 09/11/2025
3
- Checkpoint: edit on 09/12/2025
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: str | list[str] | None = None,
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 23/12/2025
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: str | list[str] | None = None,
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,
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Date: create on 19/12/2025
3
- Checkpoint: edit on 23/12/2025
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: str | list[str] | None = None,
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 09/12/2025
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: str | list[str] | None = None,
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"
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Date: create on 09/11/2025
3
- Checkpoint: edit on 23/12/2025
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: str | list[str] | None = None,
64
+ task: TaskTypeInput | list[TaskTypeInput] | None = None,
64
65
  **kwargs,
65
66
  ):
66
67
 
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Date: create on 09/11/2025
3
- Checkpoint: edit on 23/12/2025
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: str | list[str] | None = None,
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 23/12/2025
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: str | list[str] | None = None,
171
+ task: TaskTypeInput | list[TaskTypeInput] | None = None,
171
172
  architecture: Literal[
172
173
  "serial", "parallel"
173
174
  ] = "parallel", # "serial" or "parallel"
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Date: create on 09/11/2025
3
- Checkpoint: edit on 23/12/2025
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: str | list[str] | None = None,
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 23/12/2025
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: str | list[str] | None = None,
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 23/12/2025
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: str | list[str] | None = None,
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
+ ]