Skip to content

Make EfficientEvaluationLoops hookable for Python callbacks - #331

Closed
tachyonicClock wants to merge 1 commit into
Waikato:masterfrom
tachyonicClock:worktree-bridge-cse_01UWboukmSQRg6DXRrEqejHh
Closed

Make EfficientEvaluationLoops hookable for Python callbacks#331
tachyonicClock wants to merge 1 commit into
Waikato:masterfrom
tachyonicClock:worktree-bridge-cse_01UWboukmSQRg6DXRrEqejHh

Conversation

@tachyonicClock

Copy link
Copy Markdown
Contributor

Summary

Makes the prequential evaluation loop hookable so CapyMOA can observe predictions, scores, and window boundaries as they happen.

  • Adds HookableEvaluationLoop with OnLabel (per-instance) and OnWindowClose (per-window) callbacks
  • Hooks receive normalized predicted probabilities; evaluators see raw votes (PrequentialResult unchanged)
  • EfficientEvaluationLoops.PrequentialEvaluation now delegates to preserve backwards compatibility
  • All tests pass; parity verified against pre-change baseline (70.8% accuracy)

Unblocks scoring-based metrics like AUC that need class probabilities.

Addresses adaptive-machine-learning/backlog#145.

Test Plan

  • HookableEvaluationLoopTest (10 tests): parity, hook firing, window buffering, zero-vote handling, null evaluators
  • EfficientEvaluationLoopsTest (existing): regression check
  • ✅ Full suite: 178 tests, 0 failures

Follow-up

moa.jar must be rebuilt and republished (moa_url in CapyMOA's invoke.yml) before Python work can use this.
Benchmarking jpype crossing cost deferred to Python-side work.

🤖 Generated with Claude Code

Add HookableEvaluationLoop, a test-then-train loop that notifies registered
callbacks (OnLabel per instance, OnWindowClose per window) so CapyMOA can
observe predictions and scores as they happen, unblocking score-based metrics
like AUC without paying the cost of the slow pure-Python path.

Hooks receive normalized predicted probabilities; evaluators still get raw
votes so PrequentialResult is unchanged. The trailing partial window is
always closed and handed to OnWindowClose hooks. Buffering only occurs when
such hooks are registered.

EfficientEvaluationLoops.PrequentialEvaluation now delegates to the new loop,
preserving its signature and behavior for backwards compatibility.

Test parity verified against pre-change baseline: 70.8% accuracy on 1000
RandomTreeGenerator instances with NaiveBayes (seed 1), 10 windows of 100.
All evaluator-related tests still pass.

Addresses adaptive-machine-learning/backlog#145.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant