Open rohanbabbar04 opened 2 months ago
I have added the initial selection of which variables will enter the free_rvs, priors, and bounds.(this includes the partially dependent variables)..
Now,the next will be to calculate the initial guess followed by compiling the model. For the compile model step will there be any changes done to compile_logp
for this case, bcoz once I go to minimize in optimize_pymc_model
, I am getting an array of ones for the partial variable(which definitely cannot be true).
I can check this tomorrow. In the meantime maybe @ricardoV94 has some tips to offer.
For the compile model step will there be any changes done to compile_logp for this case, bcoz once I go to minimize in optimize_pymc_model, I am getting an array of ones for the partial variable(which definitely cannot be true).
Do you have some code I can look at where you are seeing the odd pattern (and even better, what you expected it to be)?
Thanks @ricardoV94 for looking into this... One issue we are trying to work on is calculating the prior for partially dependent vars.
# One such example
import pymc as pm
import pandas as pd
import preliz as pz
cs_data = pd.read_csv('testdata/chemical_shifts_theo_exp.csv')
diff = cs_data.theo - cs_data.exp
cat_encode = pd.Categorical(cs_data['aa'])
idx = cat_encode.codes
coords = {"aa": cat_encode.categories}
with pm.Model(coords=coords) as model:
# hyper_priors
a = pm.Normal("a", mu=1, sigma=10)
z = pm.HalfNormal("z", sigma=10)
x = pm.Normal("x", mu=a, sigma=10, dims="aa") # Need to calculate for this, we don't do this right now
y = pm.Normal("y", mu=x[idx], sigma=z, observed=diff)
target = pz.Normal(mu=40, sigma=7)
prior, new_prior, pymc_string = pz.ppe(model, target)
print(prior)
print(pymc_string)
Currently we get an output which is(we need to find the prior for x as well...
with pm.Model() as model:
a = pm.Normal("a", mu=40.01,sigma=0.17)
z = pm.HalfNormal("z", sigma=7.0)
Before preliz was finding priors for the hyper-parameters but not intermediate parameters?
Currently preliz can find the values for intermediate parameters if the intermediate parameters fully depend on other RVs. If the dependence is partial, like for x = pm.Normal("x", mu=a, sigma=10, dims="aa")
, the PreliZ is nor working as expected.
I can check this tomorrow. In the meantime maybe @ricardoV94 has some tips to offer.
Hey @aloctavodia , did you get time to see this one...
Description
Checklist