API Reference¶
This section documents the public API of the Tipping Point module.
Model Interface¶
- class tippingpoint.models.MarketingReturnCurve(beta, alpha, half_saturation_k, theta=0.0, channel_name='Generic', posterior_samples=None)[source]¶
Bases:
objectA marketing intelligence tool to determine inflection points of a media response curve.
Based on the Hill Function (Google Meridian methodology), this tool identifies the Minimal Marginal Cost Point (peak efficiency) and the Point of Diminishing Returns (profitability floor).
- adstock_spend(spend_timeline)[source]¶
Applies the model’s fitted geometric adstock decay to a timeline of spends.
- classmethod fit_bayesian(spend_array, return_array, channel_name='Generic', priors=None, n_samples=2000, chains=4, burn_in=1000, adstock_type='none', adstock_bounds=None, adstock_fixed_days=None)[source]¶
- classmethod from_historical_data(spend_array, return_array, channel_name='Generic', epochs=5000, lr=0.05, adstock_type='none', adstock_bounds=None, adstock_fixed_days=None)[source]¶
- property max_efficiency_point¶
- property max_profit_point¶
Portfolio Optimization¶
- class tippingpoint.portfolio.PortfolioAllocator(models)[source]¶
Bases:
objectOptimizes budget allocation across multiple MarketingReturnCurve models.
- allocate_budget(total_budget, channel_bounds=None)[source]¶
Finds the optimal spend distribution to maximize total return.
- Parameters:
total_budget (float) – Total budget to allocate.
channel_bounds (dict, optional) – Dictionary of (min_spend, max_spend) bounds keyed by channel_name.
- Returns:
The optimal allocation, marginal ROAS, and expected return.
- Return type:
dict
Mathematical Core¶
- tippingpoint.math.days_to_theta(days)[source]¶
Converts half-life in days/periods to geometric decay rate theta.
Formula: theta = 0.5 ** (1 / days)
- tippingpoint.math.geometric_adstock(spend, theta)[source]¶
Applies geometric adstock decay to a spend array.
Formula: S_t_adstocked = S_t + theta * S_{t-1_adstocked}
- tippingpoint.math.get_inflection_point(alpha, K)[source]¶
Calculates the inflection point where marginal return peaks (f’’(x) = 0).