Better offline analysis: pass-aware training & segmented metrics - #29
Open
voorhs wants to merge 7 commits into
Open
Better offline analysis: pass-aware training & segmented metrics#29voorhs wants to merge 7 commits into
voorhs wants to merge 7 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
passed+ raw evaluator scores) into tool-suggest samples so it's available downstream.--train-on-passed-only), and per-fold metrics are segmented into all / passed / failed buckets so we can compare predictability of successful vs unsuccessful runs.batch-jsonl-table --segment={all,passed,failed,compare}view that stacks the segments side-by-side.Details
samples.py— carry success infoattributes->'scores'from eachcase: …span through the CTE chain.Sample.datanow includespassed: bool(computed the same way assrc/report/file_writing.py:_parse_case_row— all evaluator values ≈ 1.0, withPASSED_EPS = 1e-9) and the rawscoresdict.samples.py's SQL still dedupes to the latest evaluate root percase_name, sopassedreflects that latest run.offline_eval.py— pass-aware training--train-on-passed-onlyflag onOfflineEvalCommonArgs(inherited by bothmainandbatch-redo-repos)._prepare_foldsvalidates every sample carriesdata['passed']when the flag is on — hard error pointing to re-exporting viasamples.py(older repos are not silently fallback'd).passed=Truesamples; test set is untouched. Folds whose train split becomes empty are skipped, recorded as a syntheticFoldResultwitherror="skipped: no passing train samples (...)"so the existingerror is None and n_test_samples_scored > 0filter at downstream summaries handles them naturally.New metrics
0.0in multilabel).H(p)/log₂(K);0→ single class,1→ uniform) to spot fold-level imbalance.sklearn.metrics.average_precision_score(..., average='macro'); score derivation is1/(1+rank)becausefull_ranked_tool_idsonly exposes ids. Restricted to labels iny_trueso each per-class AP is well-defined.Segmented reporting (all / passed / failed)
FoldResultgainsmetrics_passed,metrics_failed,n_test_passed,n_test_failed(all defaulted, so existing call sites still work).evaluate_foldpartitions scored test samples bydata['passed']and aggregates each bucket via shared_aggregate_for_itemshelper. Empty buckets →None.repo_suggester_summarynow carriesmean_over_folds,mean_over_folds_passed,mean_over_folds_failed.batch-jsonl-tableadds--segment={all,passed,failed,compare}. The pivot column set now also surfacesbalanced_accuracyandmAP.comparestacks the three segments under headings so you can read predictability of successful vs unsuccessful runs side-by-side.passedchange will show em-dash cells inpassed/failedsegments — intentional rather than silent fallback.Test plan
uv run samples.py --experiment <known-passing-exp>and confirmSample.datacarriespassedandscores.uv run offline_eval.py --repo <new-repo>.jsonlbaseline still produces the samemean_over_foldsnumbers as before for theallsegment.uv run offline_eval.py --repo <new-repo>.jsonl --train-on-passed-onlyruns successfully; verify the warning "Fold N: no passing samples …; skipping fold." appears only when expected.uv run offline_eval.py --repo <old-repo>.jsonl --train-on-passed-onlyraisesValueErrormentioning re-export.uv run offline_eval.py batch-redo-reposwritesmean_over_folds_passed/mean_over_folds_failedkeys perrepo_suggester_summary.uv run offline_eval.py batch-jsonl-table <jsonl> --segment compareprints three stacked sections.uv run offline_eval.py batch-jsonl-table <jsonl> --segment passedand--segment failedeach print one table.balanced_accuracy,class_entropy_normalized,mean_average_precisionare in a reasonable range on a known repo.🤖 Generated with Claude Code