<jupyter_start><jupyter_text>Full Bayesian Model<jupyter_code>with pm.Model() as model_full:
    
    a = pm.HalfNormal(name="a", sigma=10)
    b = pm.HalfNormal(name="b", sigma=10)
    
    alpha = pm.HalfNormal(name="alpha", sigma=10)
    r = pm.HalfNormal(name="r", sigma=10)
    
    lam = pm.Gamma(name="lam", alpha=r, beta=alpha, shape=n)
    p = pm.Beta(name="p", alpha=a, beta=b, shape=n)
    
    def logp(x, t_x, T, x_zero):
        log_term_a = x*at.log(1 - p) + x*at.log(lam) - t_x*lam
        term_b_1 = -lam*(T - t_x)
        term_b_2 = at.log(p) - at.log(1 - p)
        log_term_b = at.switch(
            x_zero,
            at.logsumexp(term_b_1, term_b_2),
            term_b_1,
        )
        
        return at.sum(log_term_a) + at.sum(log_term_b)
    
    likelihood = pm.DensityDist(
        name="likelihood",
        logp=logp,
        observed={"x": x, "t_x": t_x, "T": T, "x_zero": x_zero}
    )<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16352201257861634, 'fraction_numerical': 0.015723270440251572, 'mean_word_length': 2.339160839160839, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '124881', 'license': 'Apache-2.0', 'n_tokens_mistral': 416, 'n_tokens_neox': 401, 'n_words': 67, 'path': 'notebooks/.ipynb_checkpoints/replicate-analysis-checkpoint.ipynb', 'repo_name': 'larryshamalama/customer-lifetime-value', 'size': '954'}