Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano
Agent Success
Agent success rate when using this tile
68%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.94x
Baseline
Agent success rate without this tile
72%
Construct a probabilistic model for segmented conversion data using distributions, deterministic transforms, and a penalty potential to reflect a target overall conversion rate.
[50, 60, 40], conversions [5, 9, 4], segments ["organic", "organic", "paid"], target_overall_rate=0.1, and penalty_scale=2.0, builds a probabilistic model containing a baseline log-odds prior, a segment offset vector sized to the distinct segment identifiers, a deterministic per-row conversion rate using a logistic transform of the baseline plus the corresponding segment offset, and an observed likelihood tying conversions to exposures using the per-row rates. @testsegment_rate_<name> values for each unique segment equal to the logistic transform of the baseline plus that segment's offset, along with a deterministic overall_rate equal to the exposure-weighted average of the per-row conversion rates. @test-penalty_scale * (overall_rate - target_overall_rate) ** 2 so that large deviations from the target reduce model probability; applies even when the target rate is near 0 or 1. @test@generates
from typing import Sequence, Any
def build_response_model(
exposures: Sequence[int],
conversions: Sequence[int],
segment_ids: Sequence[str],
target_overall_rate: float,
penalty_scale: float = 2.0,
) -> Any:
"""Return a probabilistic model constructed with the dependency package. Model must contain named random variables, deterministics, and a potential penalty."""Probabilistic programming library for defining models with random variables, deterministics, and potentials.
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10