Closed
Description
Describe the issue linked to the documentation
Documentation says:
include_bias: bool, default=True
If True (default), then the last spline element inside the data range of a feature is dropped. As B-splines sum to one over the spline basis functions for each data point, they implicitly include a bias term, i.e. a column of ones. It acts as an intercept term in a linear models.
https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.SplineTransformer.html
But it seems it's exactly the opposite, with include_bias=True
I get 3 columns, with include_bias=False
I get 2 columns:
import numpy as np
from sklearn.preprocessing import SplineTransformer
X = np.arange(4).reshape(4, 1)
spline = SplineTransformer(degree=2, n_knots=2, include_bias=True)
spline.fit_transform(X)
# array([[0.5 , 0.5 , 0. ],
# [0.22222222, 0.72222222, 0.05555556],
# [0.05555556, 0.72222222, 0.22222222],
# [0. , 0.5 , 0.5 ]])
spline = SplineTransformer(degree=2, n_knots=2, include_bias=False)
spline.fit_transform(X)
# array([[0.5 , 0.5 ],
# [0.22222222, 0.72222222],
# [0.05555556, 0.72222222],
# [0. , 0.5 ]])
Suggest a potential alternative/fix
No response