scdef.tl.add_l0_lineage_aggregate_scores ¶
Add lineage-averaged clarity and effective parents for layer-0 factors only.
For each L0 factor, follows best_parent upward through layers L1 … L{n-2},
collecting clarity_score_01 and n_eff_parents from each factor along the
path (same definitions as compute_hierarchy_scores). Stores the mean
over those positions in avg_clarity and avg_n_eff_parents on the L0 row
only; other rows get NaN.
This is called automatically from compute_hierarchy_scores; it remains
public for advanced use on a pre-built per_factor frame.
This captures cases where an L0 factor maps cleanly to one L1 parent (low local
n_eff_parents) while that parent is ambiguous relative to L2, by letting
lineage averages reflect uncertainty higher in the hierarchy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
per_factor
|
DataFrame
|
per-factor scores from |
required |
layer_names
|
Sequence[str]
|
ordered model layer names ( |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Copy of |