nextrec 0.1.3__py3-none-any.whl → 0.1.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.
Files changed (48) hide show
  1. nextrec/__init__.py +4 -4
  2. nextrec/__version__.py +1 -1
  3. nextrec/basic/activation.py +9 -10
  4. nextrec/basic/callback.py +0 -1
  5. nextrec/basic/dataloader.py +127 -168
  6. nextrec/basic/features.py +27 -24
  7. nextrec/basic/layers.py +159 -328
  8. nextrec/basic/loggers.py +37 -50
  9. nextrec/basic/metrics.py +147 -255
  10. nextrec/basic/model.py +462 -817
  11. nextrec/data/__init__.py +5 -5
  12. nextrec/data/data_utils.py +12 -16
  13. nextrec/data/preprocessor.py +252 -276
  14. nextrec/loss/__init__.py +12 -12
  15. nextrec/loss/loss_utils.py +22 -30
  16. nextrec/loss/match_losses.py +83 -116
  17. nextrec/models/match/__init__.py +5 -5
  18. nextrec/models/match/dssm.py +61 -70
  19. nextrec/models/match/dssm_v2.py +51 -61
  20. nextrec/models/match/mind.py +71 -89
  21. nextrec/models/match/sdm.py +81 -93
  22. nextrec/models/match/youtube_dnn.py +53 -62
  23. nextrec/models/multi_task/esmm.py +43 -49
  24. nextrec/models/multi_task/mmoe.py +56 -65
  25. nextrec/models/multi_task/ple.py +65 -92
  26. nextrec/models/multi_task/share_bottom.py +42 -48
  27. nextrec/models/ranking/__init__.py +7 -7
  28. nextrec/models/ranking/afm.py +30 -39
  29. nextrec/models/ranking/autoint.py +57 -70
  30. nextrec/models/ranking/dcn.py +35 -43
  31. nextrec/models/ranking/deepfm.py +28 -34
  32. nextrec/models/ranking/dien.py +79 -115
  33. nextrec/models/ranking/din.py +60 -84
  34. nextrec/models/ranking/fibinet.py +35 -51
  35. nextrec/models/ranking/fm.py +26 -28
  36. nextrec/models/ranking/masknet.py +31 -31
  37. nextrec/models/ranking/pnn.py +31 -30
  38. nextrec/models/ranking/widedeep.py +31 -36
  39. nextrec/models/ranking/xdeepfm.py +39 -46
  40. nextrec/utils/__init__.py +9 -9
  41. nextrec/utils/embedding.py +1 -1
  42. nextrec/utils/initializer.py +15 -23
  43. nextrec/utils/optimizer.py +10 -14
  44. {nextrec-0.1.3.dist-info → nextrec-0.1.7.dist-info}/METADATA +16 -7
  45. nextrec-0.1.7.dist-info/RECORD +51 -0
  46. nextrec-0.1.3.dist-info/RECORD +0 -51
  47. {nextrec-0.1.3.dist-info → nextrec-0.1.7.dist-info}/WHEEL +0 -0
  48. {nextrec-0.1.3.dist-info → nextrec-0.1.7.dist-info}/licenses/LICENSE +0 -0
nextrec/basic/features.py CHANGED
@@ -9,26 +9,28 @@ Author:
9
9
  from typing import Optional
10
10
  from nextrec.utils import get_auto_embedding_dim
11
11
 
12
-
13
12
  class BaseFeature(object):
14
13
  def __repr__(self):
15
- params = {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
14
+ params = {
15
+ k: v
16
+ for k, v in self.__dict__.items()
17
+ if not k.startswith("_")
18
+ }
16
19
  param_str = ", ".join(f"{k}={v!r}" for k, v in params.items())
17
20
  return f"{self.__class__.__name__}({param_str})"
18
21
 
19
-
20
22
  class SequenceFeature(BaseFeature):
21
23
  def __init__(
22
24
  self,
23
25
  name: str,
24
26
  vocab_size: int,
25
27
  max_len: int = 20,
26
- embedding_name: str = "",
28
+ embedding_name: str = '',
27
29
  embedding_dim: Optional[int] = 4,
28
30
  combiner: str = "mean",
29
31
  padding_idx: Optional[int] = None,
30
- init_type: str = "normal",
31
- init_params: dict | None = None,
32
+ init_type: str='normal',
33
+ init_params: dict|None = None,
32
34
  l1_reg: float = 0.0,
33
35
  l2_reg: float = 1e-5,
34
36
  trainable: bool = True,
@@ -47,23 +49,20 @@ class SequenceFeature(BaseFeature):
47
49
  self.l1_reg = l1_reg
48
50
  self.l2_reg = l2_reg
49
51
  self.trainable = trainable
50
-
51
-
52
+
52
53
  class SparseFeature(BaseFeature):
53
- def __init__(
54
- self,
55
- name: str,
56
- vocab_size: int,
57
- embedding_name: str = "",
58
- embedding_dim: int = 4,
59
- padding_idx: int | None = None,
60
- init_type: str = "normal",
61
- init_params: dict | None = None,
62
- l1_reg: float = 0.0,
63
- l2_reg: float = 1e-5,
64
- trainable: bool = True,
65
- ):
66
-
54
+ def __init__(self,
55
+ name: str,
56
+ vocab_size: int,
57
+ embedding_name: str = '',
58
+ embedding_dim: int = 4,
59
+ padding_idx: int | None = None,
60
+ init_type: str='normal',
61
+ init_params: dict|None = None,
62
+ l1_reg: float = 0.0,
63
+ l2_reg: float = 1e-5,
64
+ trainable: bool = True):
65
+
67
66
  self.name = name
68
67
  self.vocab_size = vocab_size
69
68
  self.embedding_name = embedding_name or name
@@ -76,9 +75,13 @@ class SparseFeature(BaseFeature):
76
75
  self.l2_reg = l2_reg
77
76
  self.trainable = trainable
78
77
 
79
-
80
78
  class DenseFeature(BaseFeature):
81
- def __init__(self, name: str, embedding_dim: int = 1):
79
+ def __init__(self,
80
+ name: str,
81
+ embedding_dim: int = 1):
82
82
 
83
83
  self.name = name
84
84
  self.embedding_dim = embedding_dim
85
+
86
+
87
+