I need to copy this plot using pygam library.
I create GAM using the following code:
gam = LinearGAM(s(0, n_splines=5, spline_order=4) + s(1, n_splines=9) + f(2))
gam = gam.gridsearch(X, y, lam = lams)
Unfortunately, in my case the plots are the following:
The issue that I cannot manage to make the polygonal line in the left graph.
Note
This two graphs should be natural splines.