Skip to main content

Module threshold_analysis

Module threshold_analysis 

Source
Expand description

Confidence threshold analysis for NER systems.

Analyzes how precision, recall, and F1 change at different confidence thresholds. Useful for:

  • Finding optimal operating points
  • Understanding precision-recall tradeoffs
  • Setting production thresholds

§Example

use anno_eval::eval::threshold_analysis::{ThresholdAnalyzer, PredictionWithConfidence};

let predictions = vec![
    PredictionWithConfidence::new("John", "PER", 0.95, true),
    PredictionWithConfidence::new("maybe", "PER", 0.45, false),  // Wrong
    PredictionWithConfidence::new("Google", "ORG", 0.88, true),
];

let analyzer = ThresholdAnalyzer::default();
let curve = analyzer.analyze(&predictions);

println!("Optimal threshold: {:.2} (F1: {:.1}%)",
    curve.optimal_threshold, curve.optimal_f1 * 100.0);

Structs§

PredictionWithConfidence
A prediction with confidence and correctness label.
ThresholdAnalyzer
Analyzer for confidence threshold effects.
ThresholdCurve
Full threshold analysis results.
ThresholdPoint
Metrics at a specific threshold.

Functions§

format_threshold_table
Format threshold curve as ASCII table.
interpret_curve
Interpret threshold curve quality.