Bad initial energy when running a GLM model

Struggling with odd behaviour using the GLM. It works correctly when I use from_formula, e.g.

pm.glm.GLM.from_formula('outcome ~ X1 + X2 + X3, X_and_y, family=pm.glm.families.Binomial())

but when I try and use a regular GLM construction (so that I can generate predictions as well via a theano.shared variable), I get the following error when sampling

SamplingError: Bad initial energy

Then I had a look at

for RV in logistic_model.basic_RVs: print(RV.name, RV.logp(logistic_model.test_point))

Intercept 0.0
susan_uploaded_photos -7.82669381218681
idealmoveoutdate_map -7.82669381218681
years_since_purchase -7.82669381218681
years_since_built -7.82669381218681
days_since_request -7.82669381218681
hopscotch_treatment -7.82669381218681
sd_log__ -2.764118127232014
y nan

Obviously it looks like y is the problem, but why? I confirmed that the shapes are the same (y.shape=(52916,) X.shape=(52916, 6))

Solved: from_formula appears to silently discard any rows containing null data in the features, while GLM instead fails with bad initial energy

1 Like