You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,18 @@ A unified, extensible framework for text classification with categorical variabl
7
7
## 🚀 Features
8
8
9
9
-**Complex input support**: Handle text data alongside categorical variables seamlessly.
10
+
-**ValueEncoder**: Pass raw string categorical values and labels directly — no manual integer encoding required. Build a `ValueEncoder` from `DictEncoder` or sklearn `LabelEncoder` instances once, and the wrapper handles encoding at train time and label decoding after prediction automatically.
10
11
-**Unified yet highly customizable**:
11
12
- Use any tokenizer from HuggingFace or the original fastText's ngram tokenizer.
12
-
-Manipulate the components (`TextEmbedder`, `CategoricalVariableNet`, `ClassificationHead`) to easily create custom architectures - including**self-attention**. All of them are `torch.nn.Module` !
13
-
- The `TextClassificationModel` class combines these components and can be extended for custom behavior.
13
+
-Text embedding is split into two composable stages: **`TokenEmbedder`** (token → per-token vectors, with optional self-attention) and**`SentenceEmbedder`** (aggregation: mean / first / last / label attention). Combine them with `CategoricalVariableNet` and `ClassificationHead` — all are `torch.nn.Module`.
14
+
- The `TextClassificationModel` class assembles these components and can be extended for custom behavior.
14
15
-**Multiclass / multilabel classification support**: Support for both multiclass (only one label is true) and multi-label (several labels can be true) classification tasks.
15
16
-**PyTorch Lightning**: Automated training with callbacks, early stopping, and logging
16
17
-**Easy experimentation**: Simple API for training, evaluating, and predicting with minimal code:
17
18
- The `torchTextClassifiers` wrapper class orchestrates the tokenizer and the model for you
18
-
-**Additional features**: explainability using Captum
19
+
-**Explainability**:
20
+
-**Captum integration**: gradient-based token attribution via integrated gradients (`explain_with_captum=True`).
21
+
-**Label attention**: class-specific cross-attention that produces one sentence embedding per class, enabling token-level explanations for each label (`explain_with_label_attention=True`). Enable it by setting `n_heads_label_attention` in `ModelConfig`.
19
22
20
23
21
24
## 📦 Installation
@@ -57,5 +60,3 @@ See the [examples/](examples/) directory for:
57
60
## 📄 License
58
61
59
62
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Copy file name to clipboardExpand all lines: docs/source/api/components.rst
+99-27Lines changed: 99 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,22 +8,27 @@ Modular torch.nn.Module components for building custom architectures.
8
8
Text Embedding
9
9
--------------
10
10
11
-
TextEmbedder
12
-
~~~~~~~~~~~~
11
+
Text embedding is split into two composable stages:
13
12
14
-
Embeds text tokens with optional self-attention.
13
+
1. **TokenEmbedder** — maps each token to a dense vector (with optional self-attention). Output: ``(batch, seq_len, embedding_dim)``.
14
+
2. **SentenceEmbedder** — aggregates token vectors into a sentence embedding. Output: ``(batch, embedding_dim)`` or ``(batch, num_classes, embedding_dim)`` with label attention.
0 commit comments