Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserWarning: Incompatible model and inference data. #61

Open
lucabol opened this issue Apr 30, 2024 · 4 comments
Open

UserWarning: Incompatible model and inference data. #61

lucabol opened this issue Apr 30, 2024 · 4 comments

Comments

@lucabol
Copy link

lucabol commented Apr 30, 2024

Hi,
Beginner here. I tried to reduce my model to as few variables as possible, and follow the Quickstart, but still getting this error. Not sure how to debug.

ppi = kpt.ProjectionPredictive(model, idata)

Repro is here: https://github.com/lucabol/divs/blob/master/Analysis.ipynb

Full error below

UserWarning                               Traceback (most recent call last)
Cell In[6], [line 3](vscode-notebook-cell:?execution_count=6&line=3)
      [1](vscode-notebook-cell:?execution_count=6&line=1) #idata.to_netcdf("kptidata1.nc")
      [2](vscode-notebook-cell:?execution_count=6&line=2) #idata = az.from_netcdf("kptidata1.nc")
----> [3](vscode-notebook-cell:?execution_count=6&line=3) ppi = kpt.ProjectionPredictive(model, idata)
      [4](vscode-notebook-cell:?execution_count=6&line=4) ppi.search()

File ~/miniconda3/envs/bap3/lib/python3.11/site-packages/kulprit/reference.py:62, in ProjectionPredictive.__init__(self, model, idata)
     [60](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/lucabol/dev/divs/~/miniconda3/envs/bap3/lib/python3.11/site-packages/kulprit/reference.py:60) # test compatibility between model and idata
     [61](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/lucabol/dev/divs/~/miniconda3/envs/bap3/lib/python3.11/site-packages/kulprit/reference.py:61) if not check_model_idata_compatability(model=model, idata=idata):
---> [62](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/lucabol/dev/divs/~/miniconda3/envs/bap3/lib/python3.11/site-packages/kulprit/reference.py:62)     raise UserWarning("Incompatible model and inference data.")
     [64](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/lucabol/dev/divs/~/miniconda3/envs/bap3/lib/python3.11/site-packages/kulprit/reference.py:64) # log reference model and inference data
     [65](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/lucabol/dev/divs/~/miniconda3/envs/bap3/lib/python3.11/site-packages/kulprit/reference.py:65) self.model = model

UserWarning: Incompatible model and inference data.
@aloctavodia
Copy link
Collaborator

Hi @lucabol, thanks for reporting the issue and providing an example. I am on vacations and away from my laptop. I will be able to check this next week, when I come back.

@lucabol
Copy link
Author

lucabol commented May 1, 2024

No problem. Take your time. I think it is likely something crazy I did as I am new to all of this.

@tomicapretto
Copy link
Collaborator

Having a look at your notebook cell count it looks like you ran ppi = kpt.ProjectionPredictive(model, idata) before running idata = model.fit(idata_kwargs={'log_likelihood': True}). What happens if you restart the notebook and run from top to bottom?

@lucabol
Copy link
Author

lucabol commented May 2, 2024

I am not sure why github puts those numbers beside the blocks. In VsCode the code blocks are numbered in increasing order (as you see it in the files).

In any case, I had rerun it block by block making sure I run model.fit first, and still see the same problem.

I also run it in JupyterLab. It shows the correct cell count and gives the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants