Instructions to use bravo-pena/ig-classifier-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use bravo-pena/ig-classifier-1.0 with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("bravo-pena/ig-classifier-1.0", "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
IG Classifier 1.0 (interim)
Paso 2 of the IS Identifier pipeline: takes the reviewable Excel produced
by bravo-pena/is-identifier-1.0
(Paso 1: segments + institutional-statement candidates) and classifies every
AIM candidate with the official Rules-taxonomy V4.0 β TYPE (7 root
classes), hierarchical TAXON (71 terminal leaves, flexible reporting depth
1β4) and canonical LINK.typ β with per-class probabilities.
β οΈ Interim model. Trained while the annotation base is still being completed. Several terminal taxa have very few examples (15/71 leaves under 10, 7 with zero at training time; the classifier covers the 64 observed leaves). It will be retrained when the base reaches β₯10 examples per leaf.
Architecture
TF-IDF (word 1β2grams + char 2β5grams over the AIM fragment, word 1β2grams over the segment) + one-hot verb-lexicon TYPE + deontic flag, feeding four logistic-regression heads:
| Head | Target |
|---|---|
| TYPE | 7 root classes (AGG, BOU, CHO, INF, PAY, POS, SCO) |
| TAXON | terminal leaves observed in training (64 of 71) |
| has_link | binary: does this AIM participate in a link? |
| link_typ | one-vs-rest over the 5 canonical link tokens |
Inference fuses TYPE into the leaf distribution
(P'(leaf) β P_taxon(leaf) Γ P_type(branch(leaf))) and derives every
reported depth from that single fused distribution by rolling probabilities
up the official tree β depths are consistent by construction.
Files
| File | Purpose |
|---|---|
paso2_baseline.joblib |
Pickled Paso2Baseline (sklearn 1.9, ~27 MB) |
meta.json |
Training metadata (classes, dataset hash, CV metric) |
Security note: the model is a joblib pickle. Load it only through the official package (github.com/bravo-pena/ig-classifier) or from this repo.
Usage
pip install git+https://github.com/bravo-pena/ig-classifier.git
ig-classifier paso1_output.xlsx # depth 4 (full detail) by default
ig-classifier paso1_output.xlsx -d 1 # rule-type level only
from ig_classifier import load_model, run_file
model, meta = load_model("bravo-pena/ig-classifier-1.0")
run_file("paso1_output.xlsx", "paso2_output.xlsx", model,
model_version="ig-classifier-1.0", depth=4)
Output Excel sheets: planilla (team-style wide: one row per segment with
specificAIM.i / TYPE.i / TAXON.i and their confidences), aims (one
row per AIM with readable top-3 probabilities such as
PAY 81% | CHO 12% | BOU 4%), schema, summary.
Validation (provisional)
5-fold cross-validation grouped by case (no document leakage), evaluated on clean-label rows only, June 2026 corrected base (6,496 AIMs):
| Metric | Value |
|---|---|
| TYPE macro-F1 | 0.580 |
| TAXON depth-1 macro-F1 (fused) | 0.587 |
| TAXON terminal-leaf macro-F1 (fused) | 0.187 |
| has_link F1 | 0.690 |
These numbers are provisional: the annotation base is still under revision and many leaves are under-supported. They will be frozen after the next retraining on the completed base.
Limitations
- Interim performance. Terminal-leaf predictions (depth 4) are suggestions to review, not final codes. Depth 1β2 aggregates are the reliable output today.
- LINK pair-matching is not implemented β the model predicts whether an
AIM participates in a link and its canonical
LINK.typ, but not which other AIM it links to (theLINKcolumn is empty). - Trained on Spanish/English community-irrigation and similar natural-resource regulations; other domains are out of distribution.
- The input must be the Paso 1 Excel (sheet
segmentswith AIM candidates); the model does not segment raw documents β that is Paso 1's job.
Taxonomy
Official Rules-taxonomy V4.0 (7 types, 71 terminal leaves), from ResilientRules/Rules-taxonomy (CC0-1.0), bundled with the package.
License
MIT (code and weights). Taxonomy: CC0-1.0.
- Downloads last month
- -
Space using bravo-pena/ig-classifier-1.0 1
Evaluation results
- TYPE macro-F1 (7 classes) on Private regulatory annotation dataset (June 2026 corrected base)self-reported0.580
- TAXON depth-1 macro-F1 (fused) on Private regulatory annotation dataset (June 2026 corrected base)self-reported0.587
- TAXON terminal-leaf macro-F1 (fused) on Private regulatory annotation dataset (June 2026 corrected base)self-reported0.187
- has_link F1 on Private regulatory annotation dataset (June 2026 corrected base)self-reported0.690