Instructions to use lmoody68/leads-doctype-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use lmoody68/leads-doctype-classifier with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("lmoody68/leads-doctype-classifier", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
leads-doctype-classifier — Auxiliary Legal Document-Type Classifier
Part of L.E.A.D.S. (Legal Education & Analytical Deep-Search). This is an auxiliary metadata tagger: it predicts a legal document's type — bill, opinion, regulation, statute — from sentence embeddings.
- Features:
sentence-transformers/all-MiniLM-L6-v2embeddings (384-d, ONNX — no torch). - Head: scikit-learn
LogisticRegression(class_weight="balanced"). - Training data: the PUBLIC L.E.A.D.S. legal corpus (CourtListener opinions, govinfo statutes, Federal Register / eCFR regulations, Congress bills). No PII.
- Samples: 3137 · Features: 384-d
Metrics (honest — held-out test split + 5-fold cross-validation)
| Metric | Value |
|---|---|
| Held-out accuracy | 0.9252 |
| Held-out macro-F1 | 0.897 |
| 5-fold CV macro-F1 | 0.8091 ± 0.1075 |
| class | precision | recall | F1 | test support |
|---|---|---|---|---|
| bill | 0.929 | 0.929 | 0.929 | 14 |
| opinion | 0.673 | 0.946 | 0.787 | 37 |
| regulation | 0.945 | 0.922 | 0.933 | 334 |
| statute | 0.953 | 0.926 | 0.939 | 243 |
Classes excluded (too few samples, <20): docket (12), statistic (8)
Usage
import joblib, numpy as np
from huggingface_hub import hf_hub_download
from sentence_transformers import SentenceTransformer # or any all-MiniLM-L6-v2 encoder
clf = joblib.load(hf_hub_download("lmoody68/leads-doctype-classifier", "doctype_clf.joblib"))
enc = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
X = enc.encode(["The debt collector shall not communicate with third parties..."])
print(clf.predict(np.asarray(X)))
⚠️ Disclaimer
This model classifies document type only. It is NOT legal advice, not a model of the law, and must never be used to answer legal questions. Trained on public legal text for educational/portfolio purposes.
Auto-generated model card. Trained 2026-06-14T18:45:53+00:00.
- Downloads last month
- -