RFC 0002: Region auto-annotation from sparse labels - #7
Merged
Conversation
Lays out the same-slide propagation contract: seed labels in, per-region predicted_label/predicted_prob/entropy/abstain out, reusing the trained structure_head with temperature calibration and a prototype/k-NN sanity path on the region embedding. Reserves schema fields for cross-slide and H&E-only extensions but leaves them to a follow-up RFC.
Reviewer's Guide仅设计层面的 RFC,引入新的区域自动标注工作流,用于在同一张切片上从稀疏的专家结构标签向其他区域传播标签;在尚未增加可执行代码的前提下,定义数据契约、算法(structure_head 和 prototype/k-NN 路径)、弃权(abstain)标准、运行时/CLI 接口、质控(QC)关卡、溯源机制以及测试计划。 File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience打开你的控制面板 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideDesign-only RFC introducing a new region auto-annotation workflow that propagates sparse expert structure labels across regions on the same slide, defining the data contract, algorithms (structure_head and prototype/k-NN paths), abstain criteria, runtime/CLI surface, QC gates, provenance, and testing plan without adding executable code yet. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Implements RFC 0002 Phase 1. New stgpt.annotation.annotate_regions runs a single forward pass to collect region embeddings and structure_logits, then propagates sparse seed labels via either the trained structure_head with temperature scaling (Path A) or class prototypes on the embedding (Path B), emitting per-region predicted_label/predicted_prob/entropy/nearest_seed/abstain and a JSON report with k-fold seed cross-validation, label vocabulary, and provenance fingerprints. Adds the stgpt annotate-regions CLI, a runtime entry point, README section, and a CPU smoke test (4 cases, end-to-end against the synthetic case) that covers happy path, unknown-region rejection, runtime/cli parity, and per-class probabilities + path-agreement side files.
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
Design-only RFC for the auto-annotation workflow you described:
given sparse expert structure labels on one slide, propagate them
to unannotated regions on the same slide with confidence and
abstain semantics, reusing the trained
structure_headplus aprototype/k-NN sanity path on the region embedding.
Scope
structure_head(temperature-calibrated) andprototype_knnpaths emitted by default for comparison.H&E-only inference. Schema reserves
expression_present,source_case_id,propagation_kindso the contract does notbreak later.
Key decisions worth your eyes
region_predictions.parquetwithpredicted_label,predicted_prob,entropy,nearest_seed_*,qc_flag,classifier,evidence_id. Probabilities are gated behind--write-probabilitiesto keep the default artifact small.and a distance-to-nearest-seed quantile.
k-fold on the seeds themselves; macro-F1below 0.6 is a warning, not a fatal error.
stgpt.runtime.annotate_regionsplus CLIstgpt annotate-regions.embed-regionsis invokedtransparently if missing.
Test plan
current workflow (
region_id, structure_label, confidence)path_agreement.csvbydefault or only with
--classifier bothlow_seed_count(<5 per class) should be awarning or a fatal error in your real-data setting
tau_p=0.5,tau_h=log(K)-0.5,tau_d=p99(seed-to-seed))annotate_regions(Python +CLI) and the smoke test on the synthetic fixture
Generated by Claude Code
Summary by Sourcery
Documentation:
Original summary in English
Summary by Sourcery
Documentation: