-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
bambi.interpret.prediction fails for polynomial regression models #772
Comments
@tjburch thanks for reporting the issue. Just want to mention the error I get is This is related to formulae. For every argument passed in the function call, formulae creates a representation of that object (i.e. an instance of some The problem is that Bambi is looking for the name of the argument value @GStechschulte I see you self-assigned this to you. The solution that I found is using the following covariates.append([arg.name for arg in component.call.args if isinstance(arg, LazyVariable)]) in here bambi/bambi/interpret/utils.py Lines 239 to 240 in 1a3cf8a
where I haven't tested this exhaustively and I think this solution won't work for cases such as "y ~ fun1(x, fun2(z))" as it will never reach the name |
@tomicapretto thanks for the comment. I also get the same error as you. I was working on this over the weekend and came to roughly the same solution as you. Once I add tests, I will open a PR 👍🏼 |
Perfect, thanks! For context, I've been doing some polynomial regression in brms lately so I thought I'd check out how it works in Bambi with formulae, started putting together some examples so hopefully when this is resolved I'll have a shiny new notebook to contribute. |
Sounds great @tjburch looking forward! |
When doing polynomial regression, the
interpret.prediction
method can't seem to handle polynomial terms within the formula. A MWE:Gives the following error:
AttributeError: 'LazyOperator' object has no attribute 'name'
The same thing also happens if you do
y ~ I{x**2} + x
as the formula.The text was updated successfully, but these errors were encountered: