pub struct GroupingConfig {
pub medoid_min_similarity: f64,
pub min_pairwise_similarity: f64,
pub sampling_threshold: usize,
pub sample_size: usize,
pub max_component: usize,
}Expand description
Tuning for grouping. Similarities are in [0, 1]; the defaults are
provisional and calibrated against the chain corpus.
Fields§
§medoid_min_similarity: f64Smallest similarity a member may have to the medoid and stay in the group; members below it are ejected and regrouped.
min_pairwise_similarity: f64Complete-linkage floor: the smallest similarity any pair inside a reported group may have. Below it the group is split.
sampling_threshold: usizeComponent size above which medoid selection samples candidates rather than scoring every member, to avoid quadratic blow-up on huge components. The sample is deterministic and key-diverse, so repeated content cannot occupy every medoid candidate.
sample_size: usizeNumber of candidate medoids scored when a component exceeds
Self::sampling_threshold.
max_component: usizeLargest component refined as one piece. A component above this is cut into key-ordered pieces, each refined on its own. Content-identical units are never separated: one equivalence class can therefore exceed this limit by itself.
Refinement materializes the component’s pairwise similarity matrix and orders it once, so it costs O(k² log k) time and O(k²) memory. A codebase of thousands of structurally interchangeable units — generated code, or a repository built to make the scan expensive — still produces exactly that component, which is why the ceiling exists at all (AGENTS.md §2-10, §7).
Cutting costs recall, never soundness: each piece is refined by the same medoid and complete-linkage rules, so every reported group is still cohesive. What is lost is the chance that two members landing in different pieces would have grouped. The cut is by stable key, so it is deterministic, and the count of components it fired on is reported. Keeping equal-key units together prevents independently cut pieces from minting the same content-derived group and finding identifiers.
Which members the cut put apart is reported too, through
GroupingSet::severed_by_the_ceiling. A caller that carries out the
verified relations no group expresses needs it: a relation across the
cut is not one refinement weighed and declined, and carrying it out
would restate the set once per crossing — at the size that makes this
ceiling fire, that is the whole report.
Trait Implementations§
Source§impl Clone for GroupingConfig
impl Clone for GroupingConfig
Source§fn clone(&self) -> GroupingConfig
fn clone(&self) -> GroupingConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more