pelinker.sampling¶
Stratified mention-frame subsampling for model-selection evaluation.
cap_mentions_per_entity(frame, *, max_mentions, negative_label, max_mentions_negative, random_state)
¶
Keep at most max_mentions rows per KB entity (seeded random subset).
When max_mentions_negative is None, rows with entity == negative_label are
never capped. Otherwise negatives use that cap.
Source code in pelinker/sampling.py
draw_selection_sample(frame, config, *, sample_index)
¶
Draw one stratified evaluation subsample for bootstrap sample_index.
Source code in pelinker/sampling.py
selection_sample_target_size(n_rows, *, clustering_sample_rows)
¶
Target row count for one selection draw: min(n_rows, clustering_sample_rows) or all rows.
Source code in pelinker/sampling.py
stratified_mention_sample(frame, *, n_target, negative_label, random_state)
¶
Stratified subsample by negative vs KB entity (preserve class proportions).
Returns frame unchanged when len(frame) <= n_target.