You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using SplineTransformer as part of a larger feature preprocessing pipeline that ends in a linear model, e.g. Ridge, I'd like the splines to get a penalty on the (first) differences of the coefficients instead of the usual L2 penalty:
alpha*sum(squared_norm(np.diff(coef)))
instead of
alpha*sum(squared_norm(coef))
The reason is that such a penalty penalizes the curvature (integral over square of second derivatives of splines) and therefore has better interpolation and smoothness properties.
The B-splines would then be called P-splines, see Eilers & Marx "Flexible smoothing with B-splines and penalties" https://doi.org/10.1214/ss/1038425655
Properties (see Chapter 5):
P-splines show no boundary effects, as many types of kernel smoothers do.
P-splines can fit polynomial data exactly (with polynomial degree=k, a P-spline with k+1 difference penalty or higher)
P-splines can conserve moments of the data. For a GLM with canonical link with P-splines of degree k+1 and a penalty of order k+1, or higher, it holds that sum_i x_i^k y_true_i = sum_i x_i^k y_predict_i.
=> 1st order P-splines conserve zero, first and 2nd momentum on training data.
Describe your proposed solution
I see 2 solutions:
Somehow (SLEP006 ?) pass the information that those columns are B-splines and should get a different penalty to the final linear regressor.
Add an additional option to SplineTransformer, like diff=True, that triggers to return np.diff(X) instead of X. The usual L2 penalty of, e.g. Ridge, is then equivalent to L2 of the difference of coefficients of the original X.
Out of curiosity, I would be interested in seeing a case where a ridge penalty on diff spline features yields a significantly different outcomes to using the original features. That would help me get a clearer picture of the inductive bias of such a reparametrization of spline linear models.
Activity
ogrisel commentedon Sep 27, 2021
you mean instead of:
right?
Solution 2 seems like a low maintenance solution.
Out of curiosity, I would be interested in seeing a case where a ridge penalty on diff spline features yields a significantly different outcomes to using the original features. That would help me get a clearer picture of the inductive bias of such a reparametrization of spline linear models.
lorentzenchr commentedon Sep 27, 2021
Yes, I'll correct that.