Skip to main content

Classification Learning System for MoE.

Implements a feedback loop that learns from classification outcomes:

  • Tracks analyst accuracy over time
  • Dynamically adjusts analyst weights based on performance
  • Records classification history for pattern analysis
  • Enables confirmation/correction of classifications

Features:

  • SQLite-backed persistent storage
  • Analyst performance tracking
  • Dynamic weight calculation
  • Bootstrap from existing classifications

File: learning.py

Classes

LearningConfig

Configuration for the learning system.

AnalystPerformance

Performance metrics for an analyst.

ClassificationOutcome

Record of a classification and its outcome.

ClassificationLearner

Learns from historical classification outcomes.

Functions

get_learner(config)

Get or create singleton learner instance.

record_classification(document_path, predicted_type, confidence, agreement_ratio, analyst_votes, judge_decisions, approval_type, document_hash)

Record a classification for future learning.

confirm_classification(document_path, actual_type, outcome_id)

Confirm or correct a classification - triggers learning.

get_analyst_weights()

Get dynamic weights based on analyst accuracy.

get_analyst_performance(analyst)

Get performance metrics for analysts.

get_type_accuracy(analyst)

Get analyst accuracy by document type.

find_similar_by_path(document_path, limit)

Find similar documents by path pattern.

get_classification_history(document_path, limit)

Get classification history.

get_pending_confirmations(limit)

Get classifications awaiting confirmation.

get_stats()

Get learning system statistics.

bootstrap_from_frontmatter(docs_path)

Bootstrap learning from documents with existing type metadata.

Usage

python learning.py