ENH/TST: GAM model with terms with different spline bases

Open
#6,202 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Read the GenericSmoother and AdditiveSmoother code in statsmodels/gam/smooth_basis.py, then inspect the GenericSmoother example in statsmodels/gam/tests/test_gam.py. Determine how separate univariate smoothers could support different spline bases and a simpler API. Done means GAM can combine those terms with a test covering the mixed-basis case.

Written by the indexing model from the issue text.

Description

comp-gam topic-penalization type-enh

this came up in a mailing list discussion
https://groups.google.com/d/msg/pystatsmodels/8exUYkwiky0/Jof0JpJJCwAJ
quoted:


BTW the GLMGam(smoother=) takes a single smoother instance rather than an array - is it possible to use say a BSpline for x0 and PeriodicSpline for x1?

Theoretically yes, but I think I never tried that, so there are likely some problems.
The generic multiple spline class should take a list of individual, univariate splines

possibly GenericSmoothers(AdditiveGamSmoother)
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/gam/smooth_basis.py#L797

but that would require construction of the univariate smoothers by the user, see the specific BSpline and Cyclic spline smoother classes.

enhancement issue for this would be useful. This needs a simpler API.

The AdditiveSmoother class is just holding the list of all individual, univariate smoothers and delegating to those, AFAIR.


There is one basic unit test example with GenericSmoother
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/gam/tests/test_gam.py#L291

Dominant language
Python
Stars
11.6k
Forks
3.6k
Avg merge
7h 37m
Merged PRs (30d)
96

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from statsmodels/statsmodels

All issues in statsmodels/statsmodels

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.