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.
- {nextrec-0.2.4 → nextrec-0.2.6}/.gitignore +1 -4
- {nextrec-0.2.4 → nextrec-0.2.6}/PKG-INFO +2 -2
- {nextrec-0.2.4 → nextrec-0.2.6}/README.md +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/README_zh.md +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/conf.py +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/index.md +2 -2
- nextrec-0.2.6/nextrec/__version__.py +1 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/features.py +5 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/layers.py +3 -7
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/model.py +495 -664
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/data/data_utils.py +44 -12
- nextrec-0.2.6/nextrec/data/dataloader.py +312 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/data/preprocessor.py +93 -214
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/__init__.py +0 -1
- nextrec-0.2.6/nextrec/loss/loss_utils.py +94 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/esmm.py +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/masknet.py +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/__init__.py +4 -1
- nextrec-0.2.6/nextrec/utils/common.py +16 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/pyproject.toml +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/test/test_layers.py +21 -4
- {nextrec-0.2.4 → nextrec-0.2.6}/test/test_losses.py +12 -1
- nextrec-0.2.6/test/test_preprocessor.py +106 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/test_ranking_models.py +119 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/example_match_dssm.py +6 -9
- {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/example_multitask.py +6 -9
- {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/example_ranking_din.py +2 -3
- {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/movielen_match_dssm.py +1 -1
- {nextrec-0.2.4 → nextrec-0.2.6}/tutorials/movielen_ranking_deepfm.py +3 -9
- nextrec-0.2.4/nextrec/__version__.py +0 -1
- nextrec-0.2.4/nextrec/data/dataloader.py +0 -513
- nextrec-0.2.4/nextrec/loss/loss_utils.py +0 -163
- nextrec-0.2.4/test/test_data_preprocessor.py +0 -606
- nextrec-0.2.4/test/test_dataloader.py +0 -461
- {nextrec-0.2.4 → nextrec-0.2.6}/.github/workflows/publish.yml +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/.github/workflows/tests.yml +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/.readthedocs.yaml +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/CODE_OF_CONDUCT.md +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/CONTRIBUTING.md +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/LICENSE +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/MANIFEST.in +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/dataset/match_task.csv +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/dataset/movielens_100k.csv +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/dataset/multitask_task.csv +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/dataset/ranking_task.csv +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/Makefile +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/make.bat +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/modules.rst +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.basic.rst +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.data.rst +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.loss.rst +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.rst +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/nextrec.utils.rst +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/docs/rtd/requirements.txt +0 -0
- {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
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/__init__.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/__init__.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/activation.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/callback.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/loggers.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/metrics.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/basic/session.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/data/__init__.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/listwise.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/pairwise.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/loss/pointwise.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/generative/hstu.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/generative/tiger.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/__init__.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/dssm.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/dssm_v2.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/mind.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/sdm.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/match/youtube_dnn.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/mmoe.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/ple.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/multi_task/share_bottom.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/__init__.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/afm.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/autoint.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/dcn.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/deepfm.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/dien.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/din.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/fibinet.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/fm.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/pnn.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/widedeep.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/models/ranking/xdeepfm.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/embedding.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/initializer.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/nextrec/utils/optimizer.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/pytest.ini +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/requirements.txt +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/__init__.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/conftest.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/run_tests.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/test_match_models.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/test_multitask_models.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test/test_utils.py +0 -0
- {nextrec-0.2.4 → nextrec-0.2.6}/test_requirements.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nextrec
|
|
3
|
-
Version: 0.2.
|
|
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
|

|
|
62
62
|

|
|
63
63
|

|
|
64
|
-

|
|
65
65
|
|
|
66
66
|
English | [中文版](README_zh.md)
|
|
67
67
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|

|
|
6
6
|

|
|
7
7
|

|
|
8
|
-

|
|
9
9
|
|
|
10
10
|
English | [中文版](README_zh.md)
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|

|
|
6
6
|

|
|
7
7
|

|
|
8
|
-

|
|
9
9
|
|
|
10
10
|
[English Version](README.md) | 中文版
|
|
11
11
|
|
|
@@ -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.
|
|
130
|
-
model.
|
|
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
|
|
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
|
|
130
|
+
if task in ['binary','multiclass']:
|
|
135
131
|
return torch.sigmoid
|
|
136
|
-
if task in
|
|
132
|
+
if task in ['regression']:
|
|
137
133
|
return lambda x: x
|
|
138
|
-
if task in
|
|
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
|
|