deeplotx 0.2.18__py3-none-any.whl → 0.2.19__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.
@@ -21,8 +21,7 @@ class TextBinaryClassifierTrainer(BaseTrainer):
21
21
  def train(self, positive_texts: list[str], negative_texts: list[str],
22
22
  num_epochs: int, learning_rate: float = 2e-5, balancing_dataset: bool = True,
23
23
  train_loss_threshold: float = 0.0, valid_loss_threshold: float = 0.0,
24
- alpha: float = 1e-4, rho: float = 0.2,
25
- lambda_l1: float = 1e-4, lambda_l2: float = 1e-4) -> LogisticRegression:
24
+ alpha: float = 1e-4, rho: float = 0.2) -> LogisticRegression:
26
25
  if balancing_dataset:
27
26
  min_length = min(len(positive_texts), len(negative_texts))
28
27
  positive_texts = positive_texts[:min_length]
@@ -52,10 +51,7 @@ class TextBinaryClassifierTrainer(BaseTrainer):
52
51
  total_loss = 0.0
53
52
  for batch_texts, batch_labels in train_loader:
54
53
  outputs = self.model.forward(batch_texts)
55
- loss = loss_function(outputs, batch_labels) + self.model.elastic_net(
56
- alpha=alpha, rho=rho,
57
- lambda_l1=lambda_l1, lambda_l2=lambda_l2
58
- )
54
+ loss = loss_function(outputs, batch_labels) + self.model.elastic_net(alpha=alpha, rho=rho)
59
55
  optimizer.zero_grad()
60
56
  loss.backward()
61
57
  optimizer.step()
@@ -66,10 +62,7 @@ class TextBinaryClassifierTrainer(BaseTrainer):
66
62
  with torch.no_grad():
67
63
  self.model.eval()
68
64
  outputs = self.model.forward(batch_texts)
69
- loss = loss_function(outputs, batch_labels) + self.model.elastic_net(
70
- alpha=alpha, rho=rho,
71
- lambda_l1=lambda_l1, lambda_l2=lambda_l2
72
- )
65
+ loss = loss_function(outputs, batch_labels) + self.model.elastic_net(alpha=alpha, rho=rho)
73
66
  total_valid_loss += loss.item()
74
67
  self.model.train()
75
68
  logger.debug(f"Epoch {epoch + 1}/{num_epochs} | "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.2.18
3
+ Version: 0.2.19
4
4
  Summary: Easy-2-use long text classifier trainers.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -9,12 +9,12 @@ deeplotx/nn/logistic_regression.py,sha256=QAtZp2oyqOW8-1pJWVcahsSM83bzfA68EHObg-
9
9
  deeplotx/nn/softmax_regression.py,sha256=eUn3mVNlye9ewVdw3McPHZuKbUvvaamsUgFIJMVMgBU,487
10
10
  deeplotx/trainer/__init__.py,sha256=Fl5DR9UecQc5VtBcczU9sx_HtPNoFohpuELOh-Jrsks,77
11
11
  deeplotx/trainer/base_trainer.py,sha256=z0MeAT-rRYmjeBXt0ckt7J1itYArR0Cx02wHesXUoZE,385
12
- deeplotx/trainer/text_binary_classification_trainer.py,sha256=SEisKhDhcOoV87N0xLLVwuZrDSadcHmdoFIji-RqjT4,4375
12
+ deeplotx/trainer/text_binary_classification_trainer.py,sha256=5O-5dwVMCj5EDX9gjJwCA468OR4UozJ7V8b-JxeUB0s,4080
13
13
  deeplotx/util/__init__.py,sha256=JxqAK_WOOHcYVSTHBT1-WuBwWrPEVDTV3titeVWvNUM,74
14
14
  deeplotx/util/hash.py,sha256=wwsC6kOQvbpuvwKsNQOARd78_wePmW9i3oaUuXRUnpc,352
15
15
  deeplotx/util/read_file.py,sha256=ptzouvEQeeW8KU5BrWNJlXw-vFXVrpS9SkAUxsu6A8A,612
16
- deeplotx-0.2.18.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
17
- deeplotx-0.2.18.dist-info/METADATA,sha256=fn9tKJrvY8_JnnnpMG4N6EajaTI3HgN2iRrFodc5SE0,1573
18
- deeplotx-0.2.18.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
19
- deeplotx-0.2.18.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
20
- deeplotx-0.2.18.dist-info/RECORD,,
16
+ deeplotx-0.2.19.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
17
+ deeplotx-0.2.19.dist-info/METADATA,sha256=SLrWD0GXTXJW4I1_Wv7JXwfjJOR0e2Nz-CBDg7yd_-Y,1573
18
+ deeplotx-0.2.19.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
19
+ deeplotx-0.2.19.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
20
+ deeplotx-0.2.19.dist-info/RECORD,,