Multi-Label Text Classification in Python¶
Multi-label classification predicts several independent tags per text, for example several risk flags on one SMS message.
Use when multiple labels can be true at the same time.
Dataset:
Config:
tasks:
- name: message_flags
type: multi_label_classification
data_path: fixtures/sample_multilabel.jsonl
text_column: text
label_column: labels
heads:
- name: flags
num_labels: 4
Predict with threshold:
python -m jenga_nlp predict \
--config examples/configs/fixture_multilabel_cpu.yaml \
--model-dir /tmp/jenganlp_fixture_multilabel_cpu \
--task-name message_flags \
--threshold 0.5 \
--text "Urgent account closure warning asking for PIN"
Lower the threshold if you want higher recall:
Next steps¶
- Configuration reference for every YAML option.
- Production inference to load the trained model once and serve predictions.
- All task types