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

patsy like formula creation #249

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

patsy like formula creation #249

wants to merge 7 commits into from

Conversation

arose13
Copy link
Contributor

@arose13 arose13 commented Jul 10, 2019

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
Copy link

codecov bot commented Jul 10, 2019

Codecov Report

Merging #249 into master will decrease coverage by 0.26%.
The diff coverage is 82.6%.

Impacted file tree graph

@@            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%> (ø) ⬆️
pygam/tests/test_terms.py 100% <100%> (ø) ⬆️
pygam/terms.py 92.62% <78.57%> (-1.59%) ⬇️

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.

@arose13
Copy link
Contributor Author

arose13 commented Jul 10, 2019

I have no idea why the last commit "Merge branch 'master' into master" dropped my code coverage so substantially.

@dswah
Copy link
Owner

dswah commented Jul 15, 2019

@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)

@arose13
Copy link
Contributor Author

arose13 commented Jul 15, 2019

@dswah Thanks and that's very cool. I am okay with the change in license.

@silviobe
Copy link

I think this is a very nice feature!

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

Successfully merging this pull request may close these issues.

None yet

3 participants