knot locations for s(X) / interpretation of `lam`
Opened this issue · 0 comments
Reading the code I notice the knots in pygam.utils.b_spline_basis
are equi-spaced rather than being selected from quantiles as e.g. gam::bs/ns
in R. Is this just because the penalty matrix is easier to compute? Would it be hard to change?
Also wanted to confirm that using e.g. lam=0.6
and coefficients B for that term corresponds to a penalty of 0.6 1/2\int_{edge_knots[0]}^{edge_knots[1]} f_B''(x)^2 ; dx with a loss 1/2|Y-f_B(X)|^2_2. Here, f_B is the function represented by coefficients B. Doesn't seem explicitly stated anywhere in docs and there are several ways to parameterize smoothness so wanted to be clear I understood how it's parameterized.
For l
and f
I guess then the penalties are 0.6/2 |B|^2_2 for corresponding coefficients B, same loss.
Related question: why not use scipy.interpolate.splev
to evaluate the basis?