Need an intercept term for Projection Predictive Inference?
thedarredondo opened this issue · 2 comments
Hi all,
I'm trying to write a course using the Bayesian Analysis with Python book, and I'm reusing a lot of those examples.
But I've run into trouble with kulprit, and I'm hoping I can get some help.
When I run: ppi = kpt.ProjectionPredictive(model_body,idata_body)
in Google Colab, I get the following error:
AttributeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 ppi = kpt.ProjectionPredictive(model_body,idata_body)
/usr/local/lib/python3.10/dist-packages/kulprit/reference.py in init(self, model, idata)
40 """
41 # test that the reference model has an intercept term
---> 42 if model.response_component.intercept_term is None:
43 raise UserWarning(
44 "The procedure currently requires reference models to have an intercept term."
AttributeError: 'ResponseComponent' object has no attribute 'intercept_term'
The full notebook I'm using is here: https://github.com/thedarredondo/data-science-fundamentals/blob/main/Unit6/Unit6NotesAK.ipynb
The relevant code for the issue, as far as I can tell, is:
!pip install git+https://github.com/bambinos/kulprit.git
!pip install git+https://github.com/bambinos/bambi.git
import kulprit as kpt
import bambi as bmb
import pandas as pd
body = pd.read_csv('https://raw.githubusercontent.com/thedarredondo/data-science-fundamentals/main/Data/body_fat.csv')
model_body = bmb.Model("siri ~ age + weight + height + abdomen + thigh + wrist", data=body)
idata_body = model_body.fit(idata_kwargs={'log_likelihood': True})
ppi = kpt.ProjectionPredictive(model_body,idata_body)
Bambi 0.14.0 introduces a series of internal changes that break kulprit. It will be solved after a new Kulprit release. In the meantime use kulprit with 0.13.0.
This should be solved with Kulprit 0.2.0