deeplotx 0.3.2__tar.gz → 0.4.2__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 (32) hide show
  1. {deeplotx-0.3.2 → deeplotx-0.4.2}/PKG-INFO +4 -4
  2. {deeplotx-0.3.2 → deeplotx-0.4.2}/README.md +2 -2
  3. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/__init__.py +7 -1
  4. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/nn/__init__.py +2 -0
  5. deeplotx-0.4.2/deeplotx/nn/auto_regression.py +9 -0
  6. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/nn/base_neural_network.py +1 -1
  7. deeplotx-0.4.2/deeplotx/nn/recursive_sequential.py +30 -0
  8. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx.egg-info/PKG-INFO +4 -4
  9. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx.egg-info/SOURCES.txt +2 -0
  10. {deeplotx-0.3.2 → deeplotx-0.4.2}/pyproject.toml +15 -15
  11. {deeplotx-0.3.2 → deeplotx-0.4.2}/LICENSE +0 -0
  12. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/encoder/__init__.py +0 -0
  13. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/encoder/bert_encoder.py +0 -0
  14. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/encoder/long_text_encoder.py +0 -0
  15. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/encoder/longformer_encoder.py +0 -0
  16. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/nn/linear_regression.py +0 -0
  17. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/nn/logistic_regression.py +0 -0
  18. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/nn/softmax_regression.py +0 -0
  19. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/similarity/__init__.py +0 -0
  20. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/similarity/distribution.py +0 -0
  21. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/similarity/set.py +0 -0
  22. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/similarity/vector.py +0 -0
  23. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/trainer/__init__.py +0 -0
  24. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/trainer/base_trainer.py +0 -0
  25. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/trainer/text_binary_classification_trainer.py +0 -0
  26. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/util/__init__.py +0 -0
  27. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/util/hash.py +0 -0
  28. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx/util/read_file.py +0 -0
  29. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx.egg-info/dependency_links.txt +0 -0
  30. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx.egg-info/requires.txt +0 -0
  31. {deeplotx-0.3.2 → deeplotx-0.4.2}/deeplotx.egg-info/top_level.txt +0 -0
  32. {deeplotx-0.3.2 → deeplotx-0.4.2}/setup.cfg +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.3.2
4
- Summary: Easy-2-use long text classifier trainers.
3
+ Version: 0.4.2
4
+ Summary: Easy-2-use long text NLP toolkit.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
@@ -14,7 +14,7 @@ Requires-Dist: transformers>=4.51.3
14
14
  Requires-Dist: typing-extensions>=4.13.2
15
15
  Dynamic: license-file
16
16
 
17
- # DeepLoTX: Easy2UseLongTextClassifierTrainers
17
+ # DeepLoTX: Easy2UseLongTextNLPToolkit
18
18
 
19
19
  ## Installation
20
20
 
@@ -38,7 +38,7 @@ Dynamic: license-file
38
38
 
39
39
  ## Quick Start
40
40
 
41
- To train a binary classifier for text files:
41
+ To train a binary classifier from text files:
42
42
 
43
43
  ```python
44
44
  from deeplotx.util import get_files, read_file
@@ -1,4 +1,4 @@
1
- # DeepLoTX: Easy2UseLongTextClassifierTrainers
1
+ # DeepLoTX: Easy2UseLongTextNLPToolkit
2
2
 
3
3
  ## Installation
4
4
 
@@ -22,7 +22,7 @@
22
22
 
23
23
  ## Quick Start
24
24
 
25
- To train a binary classifier for text files:
25
+ To train a binary classifier from text files:
26
26
 
27
27
  ```python
28
28
  from deeplotx.util import get_files, read_file
@@ -4,7 +4,13 @@ import os
4
4
  __ROOT__ = os.path.dirname(os.path.abspath(__file__))
5
5
 
6
6
  from .encoder import BertEncoder, LongTextEncoder, LongformerEncoder
7
- from .nn import LinearRegression, LogisticRegression, SoftmaxRegression
7
+ from .nn import (
8
+ LinearRegression,
9
+ LogisticRegression,
10
+ SoftmaxRegression,
11
+ RecursiveSequential,
12
+ AutoRegression
13
+ )
8
14
  from .trainer import TextBinaryClassifierTrainer
9
15
 
10
16
  __AUTHOR__ = '吴子豪 / Vortez Wohl'
@@ -1,3 +1,5 @@
1
1
  from .linear_regression import LinearRegression
2
2
  from .logistic_regression import LogisticRegression
3
3
  from .softmax_regression import SoftmaxRegression
4
+ from .recursive_sequential import RecursiveSequential
5
+ from .auto_regression import AutoRegression
@@ -0,0 +1,9 @@
1
+ from deeplotx.nn import RecursiveSequential
2
+
3
+
4
+ class AutoRegression(RecursiveSequential):
5
+ def __init__(self, feature_dim: int, hidden_dim: int | None = None,
6
+ recursive_layers: int = 2, model_name: str | None = None):
7
+ super().__init__(input_dim=feature_dim, output_dim=feature_dim,
8
+ hidden_dim=hidden_dim, recursive_layers=recursive_layers,
9
+ model_name=model_name)
@@ -31,7 +31,7 @@ class BaseNeuralNetwork(nn.Module):
31
31
  return alpha * (rho * self.l1(_lambda=1.) + (1 - rho) * self.l2(_lambda=1.))
32
32
 
33
33
  @abstractmethod
34
- def forward(self, x) -> torch.Tensor: ...
34
+ def forward(self, *args, **kwargs) -> torch.Tensor: ...
35
35
 
36
36
  def predict(self, x) -> torch.Tensor:
37
37
  __train = self.training
@@ -0,0 +1,30 @@
1
+ from typing_extensions import override
2
+
3
+ import torch
4
+ from torch import nn
5
+
6
+ from deeplotx.nn.base_neural_network import BaseNeuralNetwork
7
+ from deeplotx.nn import LinearRegression
8
+
9
+
10
+ class RecursiveSequential(BaseNeuralNetwork):
11
+ def __init__(self, input_dim: int, output_dim: int,
12
+ hidden_dim: int | None = None, recursive_layers: int = 2,
13
+ model_name: str | None = None):
14
+ super().__init__(model_name=model_name)
15
+ if hidden_dim is None:
16
+ hidden_dim = input_dim
17
+ self.lstm = nn.LSTM(input_size=input_dim, hidden_size=hidden_dim,
18
+ num_layers=recursive_layers, batch_first=True,
19
+ bias=True, bidirectional=True)
20
+ self.regressive_head = LinearRegression(input_dim=hidden_dim * 2, output_dim=output_dim)
21
+
22
+ def initial_state(self, batch_size: int = 1) -> tuple[torch.Tensor, torch.Tensor]:
23
+ zeros = torch.zeros(self.lstm.num_layers * 2, batch_size, self.lstm.hidden_size)
24
+ return zeros, zeros
25
+
26
+ @override
27
+ def forward(self, x, state: tuple[torch.Tensor, torch.Tensor]) -> tuple[torch.Tensor, tuple[torch.Tensor, torch.Tensor]]:
28
+ x, (hidden_state, cell_state) = self.lstm(x, state)
29
+ x = self.regressive_head(x[:, -1, :])
30
+ return x, (hidden_state, cell_state)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.3.2
4
- Summary: Easy-2-use long text classifier trainers.
3
+ Version: 0.4.2
4
+ Summary: Easy-2-use long text NLP toolkit.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
@@ -14,7 +14,7 @@ Requires-Dist: transformers>=4.51.3
14
14
  Requires-Dist: typing-extensions>=4.13.2
15
15
  Dynamic: license-file
16
16
 
17
- # DeepLoTX: Easy2UseLongTextClassifierTrainers
17
+ # DeepLoTX: Easy2UseLongTextNLPToolkit
18
18
 
19
19
  ## Installation
20
20
 
@@ -38,7 +38,7 @@ Dynamic: license-file
38
38
 
39
39
  ## Quick Start
40
40
 
41
- To train a binary classifier for text files:
41
+ To train a binary classifier from text files:
42
42
 
43
43
  ```python
44
44
  from deeplotx.util import get_files, read_file
@@ -12,9 +12,11 @@ deeplotx/encoder/bert_encoder.py
12
12
  deeplotx/encoder/long_text_encoder.py
13
13
  deeplotx/encoder/longformer_encoder.py
14
14
  deeplotx/nn/__init__.py
15
+ deeplotx/nn/auto_regression.py
15
16
  deeplotx/nn/base_neural_network.py
16
17
  deeplotx/nn/linear_regression.py
17
18
  deeplotx/nn/logistic_regression.py
19
+ deeplotx/nn/recursive_sequential.py
18
20
  deeplotx/nn/softmax_regression.py
19
21
  deeplotx/similarity/__init__.py
20
22
  deeplotx/similarity/distribution.py
@@ -1,15 +1,15 @@
1
- [project]
2
- name = "deeplotx"
3
- version = "0.3.2"
4
- description = "Easy-2-use long text classifier trainers."
5
- readme = "README.md"
6
- requires-python = ">=3.10"
7
- dependencies = [
8
- "hf-xet>=1.0.5",
9
- "jupyter>=1.1.1",
10
- "numpy>=2.2.5",
11
- "python-dotenv>=1.1.0",
12
- "torch>=2.7.0",
13
- "transformers>=4.51.3",
14
- "typing-extensions>=4.13.2",
15
- ]
1
+ [project]
2
+ name = "deeplotx"
3
+ version = "0.4.2"
4
+ description = "Easy-2-use long text NLP toolkit."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "hf-xet>=1.0.5",
9
+ "jupyter>=1.1.1",
10
+ "numpy>=2.2.5",
11
+ "python-dotenv>=1.1.0",
12
+ "torch>=2.7.0",
13
+ "transformers>=4.51.3",
14
+ "typing-extensions>=4.13.2",
15
+ ]
File without changes
File without changes
File without changes