pytyche.analysis.recommendation_summary¶
- pytyche.analysis.recommendation_summary(posterior, treatment, segment=None, *, thresholds=None, min_practical_effect=0.02)[source]¶
Act-now SHIP / CONTINUE / STOP recommendation for one treatment.
The act-now risk assessment for treatment vs control: what committing to either side costs in expectation, how confident the posterior is, and what one more round of data is worth. The treatment’s metric-native contrast draws are reduced to a per-draw mean lift over the scope’s visitors, then summarized under the legacy
compare.variantsdecision rule (SHIP iff the expected loss and both probability gates clear their thresholds; else STOP on harm; else STOP on futility; else CONTINUE).v0.2 raw scope: probabilities and expected losses are computed from the raw draws even on a calibrated posterior — interval corrections land where intervals are built, never here.
- Parameters:
posterior (
HurdleBCFResult|ContinuousBCFResult|BinaryBCFResult) – One of the three posterior result types, carrying observed data (raises otherwise).treatment (
str) – Treatment variant name; selects contrast columnobserved.treatment_names.index(treatment).segment (
DiscoveredSegment|None) –Nonecomputes the global snapshot (per-draw mean over ALL visitors); aDiscoveredSegmentrestricts the mean to its rule’s members.thresholds (
DecisionThresholds|None) – Decision thresholds;DecisionThresholds()defaults whenNone.min_practical_effect (
float) – Minimum meaningful lift forprobability_better/probability_harmful.
- Return type:
- Returns:
RecommendationSummarywith the decision, its decision-theoretic evidence, the thresholds used, andexpected_value_of_one_more_roundalways populated (never NaN; closed-form preposterior EVSI documented indocs/concepts/decision-theoretic-inputs.md).- Raises:
ValueError – When
posterior.observedisNone; when treatment is not one of the observed treatment names; or when the segment’s rule matches zero visitors.TypeError – When posterior is not an accepted result type.