Sampling Bernoulli + Exponential cannot reproduce original distribution

Yeah. That will work.

I’ve also tried this and it seems to do the job quite well:

    zero = pm.Normal.dist(
        mu=0,
        sigma=1,
    )

    lam_expense = pm.Exponential('lam_expense', lam=1.0, )
    expense = pm.Exponential.dist(
        lam=lam_expense,
    )

    w = pm.Dirichlet('w', a=np.array([1, 1]))
    components = [zero, expense]

    final_expense = pm.Mixture('final_expense', w=w, comp_dists=components, observed=df_data['expenses'])
    final_expense_sim = pm.Mixture('final_expense_sim', w=w, comp_dists=components)

The biggest problem was that I had that mess up with Gaussian output where I had expense as mu instead of just adding Gaussian noise on top of it - thanks for pointing that out.

1 Like