-
Notifications
You must be signed in to change notification settings - Fork 24
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
Spline Support like Patsy #74
Comments
Hi @petrhrobar , Formulaic already supports |
Hey There, COOL!. I was not aware of this. Is there any form of documentation covering the |
Online documentation is a weak point... but we'll get there. Currently the only documentation is the grammar documentation, which indicates that support exists: https://matthewwardrop.github.io/formulaic/concepts/grammar/#transforms. The API for these transforms is the same as patsy/R, and the inline documentation is thorough (e.g. https://github.com/matthewwardrop/formulaic/blob/main/formulaic/transforms/basis_spline.py#L37). The website documentation needs to be updated, but I already know this so I'll close this out for now :). |
Thanks for that. Just a follow-up - how to change degrees of freedom in string formula: import seaborn as sns
from formulaic import Formula, formula
df = sns.load_dataset("tips")
Formula("total_bill ~ bs(size, df = 10)").get_model_matrix(df) If I call the function itself, it works. however, having it changeable in the string is what I would like: from formulaic.transforms import basis_spline, poly
pd.DataFrame(basis_spline(df['size'], degree = 10)).values |
Hi again! The
would be achieved using:
Does this not work for you? |
Ah... I see. There's a bug in the stateful evaluation that attempts to treat the |
The issue above was due to a bug / issue in astor <0.8. I bumped the dependency, and things should work now on the master branch; soon to be 0.3.4. |
Would it be possible to also implement (apart from already implemented interactions and category variable) splines feature:
Patsy
library does this really nicely.Example
The text was updated successfully, but these errors were encountered: