Skip to content

Docs

Cookbook: Classification Using Confidence

Classify SEC annual reports into 75 industry groups with one Choice each, then read confidence to decide when to fall back to a broader division.
Format
Docs
Reading time
3 min
Published by
TypeSafe AI
Last verified
Sep 2026

Highlights

  • One Choice question with 75 industry-group options classifies each 10-K; a Choice works reliably up to roughly 240 options.
  • Across 60 filings a 0.9 confidence cutoff split them in half: the confident half was right 90% of the time, the other half 40%.
  • Reporting the unsure half one SIC level up (division instead of group) took that 40% to 70%, lifting useful answers from 39/60 to 48/60.
  • Answers return choice, probabilities over all 75 options, and confidence; the recipe reads confidence, not the winner's own probability.
  • The SEC file holds 444 four-digit industries that roll into 75 major groups and 10 divisions, assembled with no model calls.

Quickstart

python
CONFIDENT = 0.9

def classify(filing: dict) -> dict:
    answer = ask(filing["id"], filing["text"])
    sure = answer["confidence"] >= CONFIDENT
    return {
        "level": "group" if sure else "division",
        "label": answer["group"] if sure else division(answer["group"]),
        "confidence": answer["confidence"],
        "group": answer["group"],
    }

Watch out

The 0.9 cutoff was tuned on this 60-filing SIC sample, so recalibrate the threshold for other taxonomies or document mixes.

Questions about this entry

Short answers drawn from the linked project or page.

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai