deeplotx 0.3.1__tar.gz → 0.4.1__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.1 → deeplotx-0.4.1}/PKG-INFO +2 -2
  2. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/nn/__init__.py +2 -0
  3. deeplotx-0.4.1/deeplotx/nn/auto_regression.py +9 -0
  4. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/nn/base_neural_network.py +1 -1
  5. deeplotx-0.4.1/deeplotx/nn/recursive_sequential.py +30 -0
  6. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx.egg-info/PKG-INFO +2 -2
  7. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx.egg-info/SOURCES.txt +2 -0
  8. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx.egg-info/requires.txt +1 -1
  9. {deeplotx-0.3.1 → deeplotx-0.4.1}/pyproject.toml +2 -2
  10. {deeplotx-0.3.1 → deeplotx-0.4.1}/LICENSE +0 -0
  11. {deeplotx-0.3.1 → deeplotx-0.4.1}/README.md +0 -0
  12. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/__init__.py +0 -0
  13. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/encoder/__init__.py +0 -0
  14. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/encoder/bert_encoder.py +0 -0
  15. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/encoder/long_text_encoder.py +0 -0
  16. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/encoder/longformer_encoder.py +0 -0
  17. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/nn/linear_regression.py +0 -0
  18. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/nn/logistic_regression.py +0 -0
  19. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/nn/softmax_regression.py +0 -0
  20. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/similarity/__init__.py +0 -0
  21. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/similarity/distribution.py +0 -0
  22. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/similarity/set.py +0 -0
  23. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/similarity/vector.py +0 -0
  24. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/trainer/__init__.py +0 -0
  25. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/trainer/base_trainer.py +0 -0
  26. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/trainer/text_binary_classification_trainer.py +0 -0
  27. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/util/__init__.py +0 -0
  28. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/util/hash.py +0 -0
  29. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx/util/read_file.py +0 -0
  30. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx.egg-info/dependency_links.txt +0 -0
  31. {deeplotx-0.3.1 → deeplotx-0.4.1}/deeplotx.egg-info/top_level.txt +0 -0
  32. {deeplotx-0.3.1 → deeplotx-0.4.1}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.3.1
3
+ Version: 0.4.1
4
4
  Summary: Easy-2-use long text classifier trainers.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
8
- Requires-Dist: huggingface-hub[hf-xet]>=0.30.2
8
+ Requires-Dist: hf-xet>=1.0.5
9
9
  Requires-Dist: jupyter>=1.1.1
10
10
  Requires-Dist: numpy>=2.2.5
11
11
  Requires-Dist: python-dotenv>=1.1.0
@@ -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,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.3.1
3
+ Version: 0.4.1
4
4
  Summary: Easy-2-use long text classifier trainers.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
8
- Requires-Dist: huggingface-hub[hf-xet]>=0.30.2
8
+ Requires-Dist: hf-xet>=1.0.5
9
9
  Requires-Dist: jupyter>=1.1.1
10
10
  Requires-Dist: numpy>=2.2.5
11
11
  Requires-Dist: python-dotenv>=1.1.0
@@ -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,4 +1,4 @@
1
- huggingface-hub[hf-xet]>=0.30.2
1
+ hf-xet>=1.0.5
2
2
  jupyter>=1.1.1
3
3
  numpy>=2.2.5
4
4
  python-dotenv>=1.1.0
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "deeplotx"
3
- version = "0.3.1"
3
+ version = "0.4.1"
4
4
  description = "Easy-2-use long text classifier trainers."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
7
7
  dependencies = [
8
- "huggingface-hub[hf-xet]>=0.30.2",
8
+ "hf-xet>=1.0.5",
9
9
  "jupyter>=1.1.1",
10
10
  "numpy>=2.2.5",
11
11
  "python-dotenv>=1.1.0",
File without changes
File without changes
File without changes
File without changes
File without changes