fix!: per-key queries report unknown keys instead of a plausible constant
Two accessors answered a question about a key the history had never seen with a well-formed value indistinguishable from a real answer. `log_evidence_for` filter_map'd unknown keys away. An empty target list means "no restriction" downstream, so a list of *entirely* unknown keys returned the whole-history evidence: measured on a two-cohort fixture, `log_evidence_for(["typo"])` returned exactly `log_evidence()`. On the one workload it is documented for — leave-one-out cross-validation — that is the un-held-out score, a plausible number that silently invalidates the comparison it was computed for. It now returns `Err(UnknownKey)` naming the offending position. `learning_curve` and `filtered_learning_curve` returned an empty `Vec` both for a typo'd key and for a competitor who is registered but has not played yet. They now return `Option`, so `None` is "never heard of it" and `Some(vec![])` is "known, no appearances". Tests carry a control case in each direction, so they cannot pass by everything returning the same thing. Closes #66, closes #70. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hcFjNDmHXZF8URGLku5zZ
This commit is contained in:
+7
-7
@@ -73,8 +73,8 @@ fn filtered_first_point_is_less_certain_than_smoothed() {
|
||||
|
||||
let _ = history.converge().unwrap();
|
||||
|
||||
let smoothed = history.learning_curve("a");
|
||||
let filtered = history.filtered_learning_curve("a");
|
||||
let smoothed = history.learning_curve("a").unwrap();
|
||||
let filtered = history.filtered_learning_curve("a").unwrap();
|
||||
|
||||
assert_eq!(
|
||||
smoothed.len(),
|
||||
@@ -127,7 +127,7 @@ fn filtered_curves_plural_agrees_with_singular() {
|
||||
|
||||
assert_eq!(
|
||||
curves["b"],
|
||||
history.filtered_learning_curve("b"),
|
||||
history.filtered_learning_curve("b").unwrap(),
|
||||
"the plural form must agree with the singular for the same key"
|
||||
);
|
||||
}
|
||||
@@ -182,8 +182,8 @@ fn single_slice_filtered_matches_smoothed() {
|
||||
|
||||
let _ = history.converge().unwrap();
|
||||
|
||||
let smoothed = history.learning_curve("a");
|
||||
let filtered = history.filtered_learning_curve("a");
|
||||
let smoothed = history.learning_curve("a").unwrap();
|
||||
let filtered = history.filtered_learning_curve("a").unwrap();
|
||||
|
||||
assert_eq!(smoothed.len(), 1);
|
||||
assert_eq!(filtered.len(), 1);
|
||||
@@ -231,8 +231,8 @@ fn filtered_curves_do_not_depend_on_ingestion_order() {
|
||||
}
|
||||
let _ = incremental.converge().unwrap();
|
||||
|
||||
let from_batched = batched.filtered_learning_curve("a");
|
||||
let from_incremental = incremental.filtered_learning_curve("a");
|
||||
let from_batched = batched.filtered_learning_curve("a").unwrap();
|
||||
let from_incremental = incremental.filtered_learning_curve("a").unwrap();
|
||||
|
||||
assert_eq!(from_batched.len(), from_incremental.len());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user