pytyche.analysis.PolicyTreeResult

class pytyche.analysis.PolicyTreeResult(tree, segments, allocation_map, stability_scores, observed)[source]

Bases: object

Policy-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 DiscoveredSegment per 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:
__init__(tree, segments, allocation_map, stability_scores, observed)
Parameters:
Return type:

None

Methods

__init__(tree, segments, allocation_map, ...)

Attributes