Bimodal posterior distribution

Is there a particular reason why you need distributions on either side of the road? Could you re-parameterize the problem so that you have a parametric position on the road (say going from 0 to 1) and then post-process the data (or use pymc.Deterministic variables) to get the two possible locations?

i.e.

with pm.Model( ) as cps_model:
    alpha = pm.Gamma('alpha', mu=10000, sigma=100)
    beta = pm.Gamma('beta', mu=100, sigma=10)

    act = pm.Gamma("act", alpha=alpha, beta=beta, initval=1000)
    bkg = pm.Normal("bkg", mu=MEAN_BKG_CPS, sigma=BKG_STD, initval=MEAN_BKG_CPS)

    p = pm.Uniform("s", lower=0, upper=1)

    count_rate = get_expected_count( p, act, bkg )

    positions = pm.Deterministic("angle1", tensor_calc_positions(p) )

    likelihood = pm.Poisson( "likelihood", mu=count_rate, observed=cps )

where get_expected_count takes in the parametric position, the source properties, and the background (I assume from your variable names) and gives an expected count rate, tensor_calc_positions takes in the parametric position p and returns the possible source locations, and likelihood compares the modeled count rate to the observed?

Like I mentioned, you could even do the position calculation as a post-processing step on the output trace and then the only implementation is getting the count from the parametric position.

1 Like