nextrec 0.2.4__tar.gz → 0.2.6__tar.gz

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 (101) hide show
  1. {nextrec-0.2.4 → nextrec-0.2.6}/.gitignore +1 -4
  2. {nextrec-0.2.4 → nextrec-0.2.6}/PKG-INFO +2 -2
  3. {nextrec-0.2.4 → nextrec-0.2.6}/README.md +1 -1
  4. {nextrec-0.2.4 → nextrec-0.2.6}/README_zh.md +1 -1
  5. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/conf.py +1 -1
  6. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/index.md +2 -2
  7. nextrec-0.2.6/nextrec/__version__.py +1 -0
  8. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/features.py +5 -1
  9. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/layers.py +3 -7
  10. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/model.py +495 -664
  11. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/data/data_utils.py +44 -12
  12. nextrec-0.2.6/nextrec/data/dataloader.py +312 -0
  13. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/data/preprocessor.py +93 -214
  14. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/__init__.py +0 -1
  15. nextrec-0.2.6/nextrec/loss/loss_utils.py +94 -0
  16. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/esmm.py +1 -1
  17. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/masknet.py +1 -1
  18. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/__init__.py +4 -1
  19. nextrec-0.2.6/nextrec/utils/common.py +16 -0
  20. {nextrec-0.2.4 → nextrec-0.2.6}/pyproject.toml +1 -1
  21. {nextrec-0.2.4 → nextrec-0.2.6}/test/test_layers.py +21 -4
  22. {nextrec-0.2.4 → nextrec-0.2.6}/test/test_losses.py +12 -1
  23. nextrec-0.2.6/test/test_preprocessor.py +106 -0
  24. {nextrec-0.2.4 → nextrec-0.2.6}/test/test_ranking_models.py +119 -0
  25. {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/example_match_dssm.py +6 -9
  26. {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/example_multitask.py +6 -9
  27. {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/example_ranking_din.py +2 -3
  28. {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/movielen_match_dssm.py +1 -1
  29. {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/movielen_ranking_deepfm.py +3 -9
  30. nextrec-0.2.4/nextrec/__version__.py +0 -1
  31. nextrec-0.2.4/nextrec/data/dataloader.py +0 -513
  32. nextrec-0.2.4/nextrec/loss/loss_utils.py +0 -163
  33. nextrec-0.2.4/test/test_data_preprocessor.py +0 -606
  34. nextrec-0.2.4/test/test_dataloader.py +0 -461
  35. {nextrec-0.2.4 → nextrec-0.2.6}/.github/workflows/publish.yml +0 -0
  36. {nextrec-0.2.4 → nextrec-0.2.6}/.github/workflows/tests.yml +0 -0
  37. {nextrec-0.2.4 → nextrec-0.2.6}/.readthedocs.yaml +0 -0
  38. {nextrec-0.2.4 → nextrec-0.2.6}/CODE_OF_CONDUCT.md +0 -0
  39. {nextrec-0.2.4 → nextrec-0.2.6}/CONTRIBUTING.md +0 -0
  40. {nextrec-0.2.4 → nextrec-0.2.6}/LICENSE +0 -0
  41. {nextrec-0.2.4 → nextrec-0.2.6}/MANIFEST.in +0 -0
  42. {nextrec-0.2.4 → nextrec-0.2.6}/dataset/match_task.csv +0 -0
  43. {nextrec-0.2.4 → nextrec-0.2.6}/dataset/movielens_100k.csv +0 -0
  44. {nextrec-0.2.4 → nextrec-0.2.6}/dataset/multitask_task.csv +0 -0
  45. {nextrec-0.2.4 → nextrec-0.2.6}/dataset/ranking_task.csv +0 -0
  46. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/Makefile +0 -0
  47. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/make.bat +0 -0
  48. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/modules.rst +0 -0
  49. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.basic.rst +0 -0
  50. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.data.rst +0 -0
  51. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.loss.rst +0 -0
  52. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.rst +0 -0
  53. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.utils.rst +0 -0
  54. {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/requirements.txt +0 -0
  55. {nextrec-0.2.4 → nextrec-0.2.6}/docs/zh//345/277/253/351/200/237/344/270/212/346/211/213.md" +0 -0
  56. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/__init__.py +0 -0
  57. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/__init__.py +0 -0
  58. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/activation.py +0 -0
  59. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/callback.py +0 -0
  60. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/loggers.py +0 -0
  61. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/metrics.py +0 -0
  62. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/session.py +0 -0
  63. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/data/__init__.py +0 -0
  64. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/listwise.py +0 -0
  65. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/pairwise.py +0 -0
  66. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/pointwise.py +0 -0
  67. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/generative/hstu.py +0 -0
  68. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/generative/tiger.py +0 -0
  69. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/__init__.py +0 -0
  70. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/dssm.py +0 -0
  71. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/dssm_v2.py +0 -0
  72. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/mind.py +0 -0
  73. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/sdm.py +0 -0
  74. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/youtube_dnn.py +0 -0
  75. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/mmoe.py +0 -0
  76. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/ple.py +0 -0
  77. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/share_bottom.py +0 -0
  78. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/__init__.py +0 -0
  79. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/afm.py +0 -0
  80. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/autoint.py +0 -0
  81. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/dcn.py +0 -0
  82. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/deepfm.py +0 -0
  83. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/dien.py +0 -0
  84. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/din.py +0 -0
  85. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/fibinet.py +0 -0
  86. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/fm.py +0 -0
  87. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/pnn.py +0 -0
  88. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/widedeep.py +0 -0
  89. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/xdeepfm.py +0 -0
  90. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/embedding.py +0 -0
  91. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/initializer.py +0 -0
  92. {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/optimizer.py +0 -0
  93. {nextrec-0.2.4 → nextrec-0.2.6}/pytest.ini +0 -0
  94. {nextrec-0.2.4 → nextrec-0.2.6}/requirements.txt +0 -0
  95. {nextrec-0.2.4 → nextrec-0.2.6}/test/__init__.py +0 -0
  96. {nextrec-0.2.4 → nextrec-0.2.6}/test/conftest.py +0 -0
  97. {nextrec-0.2.4 → nextrec-0.2.6}/test/run_tests.py +0 -0
  98. {nextrec-0.2.4 → nextrec-0.2.6}/test/test_match_models.py +0 -0
  99. {nextrec-0.2.4 → nextrec-0.2.6}/test/test_multitask_models.py +0 -0
  100. {nextrec-0.2.4 → nextrec-0.2.6}/test/test_utils.py +0 -0
  101. {nextrec-0.2.4 → nextrec-0.2.6}/test_requirements.txt +0 -0
@@ -115,10 +115,7 @@ dmypy.json
115
115
  .temp/
116
116
 
117
117
  # test files
118
- local_deepfm.py
119
- local_mmoe.py
120
- online_test.py
121
- linux_train_tutorial.py
118
+ *iflytek*
122
119
 
123
120
  # DataProcessor saved files
124
121
  processor/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextrec
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: A comprehensive recommendation library with match, ranking, and multi-task learning models
5
5
  Project-URL: Homepage, https://github.com/zerolovesea/NextRec
6
6
  Project-URL: Repository, https://github.com/zerolovesea/NextRec
@@ -61,7 +61,7 @@ Description-Content-Type: text/markdown
61
61
  ![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)
62
62
  ![PyTorch](https://img.shields.io/badge/PyTorch-1.10+-ee4c2c.svg)
63
63
  ![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)
64
- ![Version](https://img.shields.io/badge/Version-0.2.4-orange.svg)
64
+ ![Version](https://img.shields.io/badge/Version-0.2.6-orange.svg)
65
65
 
66
66
  English | [中文版](README_zh.md)
67
67
 
@@ -5,7 +5,7 @@
5
5
  ![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)
6
6
  ![PyTorch](https://img.shields.io/badge/PyTorch-1.10+-ee4c2c.svg)
7
7
  ![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)
8
- ![Version](https://img.shields.io/badge/Version-0.2.4-orange.svg)
8
+ ![Version](https://img.shields.io/badge/Version-0.2.6-orange.svg)
9
9
 
10
10
  English | [中文版](README_zh.md)
11
11
 
@@ -5,7 +5,7 @@
5
5
  ![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)
6
6
  ![PyTorch](https://img.shields.io/badge/PyTorch-1.10+-ee4c2c.svg)
7
7
  ![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)
8
- ![Version](https://img.shields.io/badge/Version-0.2.4-orange.svg)
8
+ ![Version](https://img.shields.io/badge/Version-0.2.6-orange.svg)
9
9
 
10
10
  [English Version](README.md) | 中文版
11
11
 
@@ -11,7 +11,7 @@ sys.path.insert(0, str(PROJECT_ROOT / "nextrec"))
11
11
  project = "NextRec"
12
12
  copyright = "2025, Yang Zhou"
13
13
  author = "Yang Zhou"
14
- release = "0.2.4"
14
+ release = "0.2.6"
15
15
 
16
16
  extensions = [
17
17
  "myst_parser",
@@ -126,8 +126,8 @@ model.fit(
126
126
 
127
127
  scores = model.evaluate(valid_df_or_loader) # returns metric dict
128
128
  preds = model.predict(test_df_or_loader) # numpy array or dict
129
- model.save_weights("checkpoint.model")
130
- model.load_weights("checkpoint.model", map_location="cpu")
129
+ model.save_model("checkpoint.model") # default no timestamp (overwrite)
130
+ model.load_model("checkpoint.model", map_location="cpu")
131
131
  ```
132
132
 
133
133
  ## Model zoo (`nextrec.models`)
@@ -0,0 +1 @@
1
+ __version__ = "0.2.6"
@@ -93,6 +93,8 @@ class FeatureSpecMixin:
93
93
  dense_features: Sequence[DenseFeature] | None = None,
94
94
  sparse_features: Sequence[SparseFeature] | None = None,
95
95
  sequence_features: Sequence[SequenceFeature] | None = None,
96
+ target: str | Sequence[str] | None = None,
97
+ id_columns: str | Sequence[str] | None = None,
96
98
  ) -> None:
97
99
  self.dense_features: List[DenseFeature] = list(dense_features) if dense_features else []
98
100
  self.sparse_features: List[SparseFeature] = list(sparse_features) if sparse_features else []
@@ -100,8 +102,10 @@ class FeatureSpecMixin:
100
102
 
101
103
  self.all_features = self.dense_features + self.sparse_features + self.sequence_features
102
104
  self.feature_names = [feat.name for feat in self.all_features]
105
+ self.target_columns = self._normalize_to_list(target)
106
+ self.id_columns = self._normalize_to_list(id_columns)
103
107
 
104
- def _set_target_config(
108
+ def _set_target_id_config(
105
109
  self,
106
110
  target: str | Sequence[str] | None = None,
107
111
  id_columns: str | Sequence[str] | None = None,
@@ -49,10 +49,6 @@ __all__ = [
49
49
 
50
50
 
51
51
  class PredictionLayer(nn.Module):
52
- _CLASSIFICATION_TASKS = {"classification", "binary", "ctr", "ranking", "match", "matching"}
53
- _REGRESSION_TASKS = {"regression", "continuous"}
54
- _MULTICLASS_TASKS = {"multiclass", "softmax"}
55
-
56
52
  def __init__(
57
53
  self,
58
54
  task_type: Union[str, Sequence[str]] = "binary",
@@ -131,11 +127,11 @@ class PredictionLayer(nn.Module):
131
127
 
132
128
  def _get_activation(self, task_type: str):
133
129
  task = task_type.lower()
134
- if task in self._CLASSIFICATION_TASKS:
130
+ if task in ['binary','multiclass']:
135
131
  return torch.sigmoid
136
- if task in self._REGRESSION_TASKS:
132
+ if task in ['regression']:
137
133
  return lambda x: x
138
- if task in self._MULTICLASS_TASKS:
134
+ if task in ['multiclass']:
139
135
  return lambda x: torch.softmax(x, dim=-1)
140
136
  raise ValueError(f"Unsupported task_type '{task_type}'.")
141
137