Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions crates/ruvllm/src/claude_flow/model_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,29 @@ impl TaskComplexityAnalyzer {
}
}

/// Returns signed calibration error.
///
/// Positive value = systematically over-predicting complexity,
/// negative value = systematically under-predicting.
/// Returns 0.0 if no feedback has been recorded.
pub fn calibration_bias(&self) -> f32 {
let with_feedback: Vec<_> = self
.accuracy_history
.iter()
.filter(|r| r.actual.is_some())
.collect();

if with_feedback.is_empty() {
return 0.0;
}

let sum: f32 = with_feedback
.iter()
.map(|r| r.predicted - r.actual.unwrap())
.sum();
sum / with_feedback.len() as f32
}

/// Get accuracy statistics
pub fn accuracy_stats(&self) -> AnalyzerStats {
let with_feedback: Vec<_> = self
Expand Down
Loading
Loading