CoolFace
Modelpublic

bravo-pena/ig-classifier-1.0

sourceHugging Facemitupdated 3mo agoView on Hugging Face
0likes
Model Card

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:

HeadTarget
TYPE7 root classes (AGG, BOU, CHO, INF, PAY, POS, SCO)
TAXONterminal leaves observed in training (64 of 71)
has_linkbinary: does this AIM participate in a link?
link_typone-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

FilePurpose
paso2_baseline.joblibPickled Paso2Baseline (sklearn 1.9, ~27 MB)
meta.jsonTraining 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

bash
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
python
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):

MetricValue
TYPE macro-F10.580
TAXON depth-1 macro-F1 (fused)0.587
TAXON terminal-leaf macro-F1 (fused)0.187
has_link F10.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 (the LINK column 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 segments with 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.