Closed hadjipantelis closed 8 months ago
Hi @hadjipantelis
Thanks for reporting the problem and also all the suggestions. This is not a problem with Bambi itself, but a problem with the formula parsing library, which we develop too.
formulae has a bunch of built in functions that aim to simplify how you transform the data. Right now, when you call something, it first looks in the scope where the model is being constructed. If there's something with that name in there, it uses that thing. This is what is happening in your example.
This behaviour allows you to override builtin functions. For example, formulae has a scale()
function, that you can override if you write your own scale()
function. If we force you to always use the builtin versions in formulae, then you lose this feature.
I think a nice fix would be to raise a warning when there's such a name conflict, but still use the builtin function. That would guide you to write a function with a name that does not conflict with the name of the builtin function in formulae.
I'll try to fix this issue for the next release.
@tomicapretto Seems like a reasonable thing to do. I can see it was a decision choice (up to a certain extent) but yeah, a warning message will likely be helpful. (I suspected as such about formulae
and that's why I reported its version too.)
Thank you for the clarification. Feel free to close this issue at your convenience.
Let's keep this open until we have a fix. It may be helpful if someone else has the same problem.
Fixed in https://github.com/bambinos/formulae/pull/109 and available in formulae >= 0.5.3
Hello and thank you for your work in
bambi
, it is great.I noticed that when a variable
p
exists in the workspace,bambi
parsing fails if it needs to also use thep(x, n)
function for the response term. Model instantiation will try to use the variablep
already in the workpace. Please see a minimal example below.The full error is:
I am using the latest
bambi
/formulae
.Again, thank you for your work on
bambi
. This bug has a relatively easy work-around so it is not a show-stopper but I guess it would be better if it didn't exist. :smile:PS: You might want to invest in having a minimal issues template for your git-repo, helps with the structure, makes it clear what information is needed, etc.