Fitting a histogram

Hi, thanks again for getting back to me.
By access to the binning i guess you mean the original data that is beiing binned, but in a real life case i do not av access to this data, Only the bin results.

I have tried changing your mixture density example slightly and am now running the following code, where the observed data is bin heights:

def mixture_density(w, mu, sd, x):
    logp =  pm.NormalMixture.dist(w,mu, sd).logp(x)
    return tt.exp(logp)

 
with m:
    w = pm.Dirichlet('w', np.ones_like(centers)*.5)
    mu = pm.Normal('mu', 0., 5., shape=centers.size)
    tau = pm.HalfCauchy('tau', 1., shape=centers.size)
    y= mixture_density(w, mu, tau, x)
    y_obs=pm.Normal('y_obs',mu=y,observed=df['y'][0])

I am sorry for not understanding what is going wrong, but do you see something that may cause this to fail? It is giving very weird results especally for the density=True cases for the binning operation.