ENH: user-provided knots (t=) in `scipy.interpolate.make_smoothing_spline`

Hi all,

gh-25862 proposes adding a t= argument to scipy.interpolate.make_smoothing_spline, so the smoothing spline can be built on a user-provided knot vector instead of placing knots at all the data sites.

Short background. Currently the function always uses knots at the data, so the basis grows with the number of data points, in other words size of the knot vector is proportional to size of the design matrix. With user knots, the same penalized objective is solved on a small fixed basis. This is useful for large datasets and matches functionality long available in R (smooth.spline with reduced knot sets, fda, mgcv). The penalty matrix is computed exactly for arbitrary knots, and the implementation is validated against several independent validators (R’s fda and smooth.spline, Julia, Octave). A companion document with the full derivation and validation is here.

In this PR, lam (the smoothing parameter) must be given explicitly when t= is passed. A follow-up PR adds automatic lam selection by generalized cross-validation (GCV) for user knots.

Comments welcome, suggestions, feedback appreciated here or on the PR.

Aadya (@aadya940)

1 Like