I want to calculate H_s in my model using E. I have obtained a model that predicts H_s using a Gaussian process, but when I try to sample E and obtain the corresponding H_s, I fail. My code is the following:
with pm.Model() as model2:
ene_Mn_eg = df_Mn_eg['ene'].to_numpy()
hyb_Mn_eg = df_Mn_eg['hyb'].to_numpy()
lower_e = np.min(ene_Mn_eg)
upper_e = np.max(ene_Mn_eg)
E = []
H_s =[]
# E = pm.Uniform(f'E_{4}', lower=lower_e, upper = upper_e,shape=4)
# with model:
for i in range(4):
E.append(pm.Uniform(f'E_{i}', lower=lower_e, upper = upper_e))
mu, var = gp.predict(E[i], point=trace[-1], diag=True)
std = np.sqrt(var)
mu_H_s = mu
H_s.append(pm.Normal(f'H_s_{i}',mu = mu_H_s, sigma=std))
mu = hybridization_function(ene_Mn_eg, E, H_s)
idata = pm.sample_prior_predictive()
idata.extend(pm.sample())
IndexError: too many indices for array
Obviously, the shape of E is not directly usable for calculations, but I don’t know how to convert it, I can’t find the appropriate code.
I am looking forward to your reply. Thank you very much.