-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Description
Describe the workflow you want to enable
I propose to add a SplineTransformer to preprocessing. This is similiar to PolynomialFeatures, but gives more flexibility (and numerical stability) for linear models to deal with continuous numerical features.
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import SplineTransformer
from sklearn.pipeline import make_pipeline
# get data X, y
...
model = make_pipeline(SplineTransformer(degree=3, n_knots=20,
positioning='quantile'),
LogisticRegression())
model.fit(X, y)Describe your proposed solution
Add SplineTransformer and internally use scipy for splines. Start with
- 1-dimensional b-splines
- equidistant knots
- quantile based knots
Additional context
Patsy has an implementation of those that matches the R versions.
References
Eilers, Marx "Flexible Smoothing with B-splines and Penalties" passes the scikit-learn inclusion criteria by some margin 😏
mayer79 and el-hult