pyGAM
pyGAM copied to clipboard
patsy like formula creation
I've been using this for my own work and I feel the average joe and jane would like that they can use this package like more like the R package. This is because of the term list method currently used only allows Numpy column indices.
Now you can you import from_formula()
and use it like the following.
LinearGAM(from_formula('y ~ *', df))
LinearGAM(from_formula('y ~ l(mode) + price + day_of_year + c(location)', df))
c
is just like R and statsmodels and allows you to declare a column as a factor
l
, s
allows you to unambiguously declare terms as linear or spline terms (respectively)
NOTES
- I haven't added in
col_a * col_b
yet. - I deliberately have not allowed adding the other kwargs because at that point it would probably make more sense to use the old solution. If anything I'll modify that solution to get the index from the column name (since that is the most annoying and error-prone).
Codecov Report
Merging #249 into master will decrease coverage by
0.26%
. The diff coverage is82.6%
.
@@ Coverage Diff @@
## master #249 +/- ##
==========================================
- Coverage 95.18% 94.91% -0.27%
==========================================
Files 22 22
Lines 3178 3246 +68
==========================================
+ Hits 3025 3081 +56
- Misses 153 165 +12
Impacted Files | Coverage Δ | |
---|---|---|
pygam/__init__.py | 100% <100%> (ø) |
:arrow_up: |
pygam/tests/test_terms.py | 100% <100%> (ø) |
:arrow_up: |
pygam/terms.py | 92.62% <78.57%> (-1.59%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b5c6c55...2513555. Read the comment docs.
I have no idea why the last commit "Merge branch 'master'
into master
" dropped my code coverage so substantially.
@arose13 this is awesome! thank you very much!
However, we have recently changed the license to Apache 2.0 to allow proprietary use of the library, which means downstream users would NOT need to release the source-code of their application when they use pyGAM.
The previous GPLv3 license is quite strict, and the hope is that a more passive license will encourage (proprietary) contributors to keep improving this library.
Please let me know if you are ok with this change. Thanks, Danny
Current License: Apache 2.0 (tldr: any use and modifications are allowed, with any license, with or without release source-code. all modifications must be explicitly stated.)
Old license for reference: GPLv3 (tldr: any modifications and downstream applications must be made open-source and released with the same license)
@dswah Thanks and that's very cool. I am okay with the change in license.
I think this is a very nice feature!