pytyche.analysis.PolicyTreeResult¶
- class pytyche.analysis.PolicyTreeResult(tree, segments, allocation_map, stability_scores, observed)[source]¶
Bases:
objectPolicy-tree segmentation output.
Produced by
posterior.fit_policy_tree(...). The tree partitions feature space; treatment metadata (allocations, stability) is per-leaf data layered on top, keyed by sklearn leaf id.- tree¶
The fitted policy tree partitioning feature space (an sklearn
DecisionTreeClassifier).
- segments¶
One
DiscoveredSegmentper leaf, ordered by leaf id —segments[i].id == sorted(allocation_map.keys())[i].
- allocation_map¶
Leaf id → per-variant Thompson weight dict; each leaf’s weights sum to 1.0 within 1e-6.
- stability_scores¶
Leaf id → bootstrap-replicability score (the fraction of bootstrap tree refits in which some leaf has Jaccard overlap >= 0.5 with the leaf’s member set). Keyed exactly by the allocation_map leaves.
- observed¶
The observed data the underlying posterior was fit on (shared reference to
posterior.observed; no re-cloning).
- Parameters:
tree (
DecisionTreeClassifier)segments (
list[DiscoveredSegment])allocation_map (
dict[int,dict[str,float]])stability_scores (
dict[int,float])observed (
ObservedExperimentData)
- __init__(tree, segments, allocation_map, stability_scores, observed)¶
- Parameters:
tree (
DecisionTreeClassifier)segments (
list[DiscoveredSegment])allocation_map (
dict[int,dict[str,float]])stability_scores (
dict[int,float])observed (
ObservedExperimentData)
- Return type:
None
Methods
__init__(tree, segments, allocation_map, ...)Attributes