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

Feature Request: Splines #51

Closed
aflaxman opened this issue Aug 18, 2021 · 6 comments
Closed

Feature Request: Splines #51

aflaxman opened this issue Aug 18, 2021 · 6 comments

Comments

@aflaxman
Copy link

Hi all. I would like to start with my appreciation for your work on Bambi and formulae! I think both of these are very valuable additions to the scientific python stack. I saw a thread on twitter that made me think formulae might become the new patsy, so I thought I would describe an affordance in patsy that would be really cool to add to formulae: splines: https://patsy.readthedocs.io/en/latest/spline-regression.html

I would love to be able to include bs(x) in one line, e.g.

model = bmb.Model("test_positive ~ vaccinated + bs(age,df=3) + (vaccinated+vaccinated:day|state)",
                  df, family="bernoulli")

Since this is already implemented in patsy maybe it will not be too hard to add here, as well! Thanks again for all of your work!

@tomicapretto
Copy link
Collaborator

Hi @aflaxman! Thanks for opening this issue.

Indeed, adding splines to formulae is something I've been having on top of my head for a long time now. I'll try to come back to it soon, but I can't promise anything right now.

On the other hand, it's true that patsy is not going to be developed anymore. I had a meeting with Nathaniel (from patsy) and Matthew (from formulaic) this week and we agreed that Matthew and I are going to provide patsy with life support, but the future of formula parsers in Python will continue in formulaic (not formulae).

In the meantime, Bambi will continue using formulae because it contains more of the features we want than formulaic. I'll continue supporting and adding stuff to formulae until formulaic has all we need. At that time, the idea is that Bambi transitions from formulae to formulaic without the end-user even noticing.

I'll post or link splines updates here so you can follow along 😄

@aflaxman
Copy link
Author

aflaxman commented Aug 18, 2021 via email

@tomicapretto
Copy link
Collaborator

See #52. Turns out it wasn't that hard to add b-splines here. Unfortunately there are some things that have to be sorted out in Bambi before this function works there.

@tomicapretto
Copy link
Collaborator

#52 has been merged. Do not try to use with Bambi yet, since it does not know how to work with splines yet.

@lorentzenchr
Copy link

On the other hand, it's true that patsy is not going to be developed anymore. I had a meeting with Nathaniel (from patsy) and Matthew (from formulaic) this week and we agreed that Matthew and I are going to provide patsy with life support, but the future of formula parsers in Python will continue in formulaic (not formulae).
...
At that time, the idea is that Bambi transitions from formulae to formulaic without the end-user even noticing.

@tomicapretto This is great news, which I stumbled across by change, almost worth an announcement somewhere 😄

@tomicapretto
Copy link
Collaborator

Hi, @lorentzenchr sorry for the late reply. There's now a note on Patsy README mentioning this change, see here. Maybe an announcement will come after we implement some features such as random effects in Formulaic (which is a WIP). Of course, if you have any ideas or suggestions, I'd love to know them.

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