Open Fei0823 opened 3 months ago
I also have this problem with this tutorial code like you show and try to use only 8 B-basis (G-k=8) instead of (G+k=14) in formula and code after 1st cell, i got result which do not use ALL coefficients, but first 8. It is interesting what exactly coefficients have we use with B-basis?
In https://scikit-learn.org/stable/auto_examples/linear_model/plot_polynomial_interpolation.html we can read that there is also k = 3 "technical knots" from each side of fitted interval. I suppose here something like that and 6 knots are technical, so 8+6=14 and 14 means with additional tech knots I try to check this and get coefficients in 3 variants: from 0, from 3 and from 6. And best fit was "shift 3):
Is it possible to use spline coefficients for KAN model activation in way compatible with scipy.interpolate.BSplin? :
G = ... k = 3 grid = torch.linspace(-1,1,steps=G+1)[None,:] ... coef = model.act_fun[0].coef
and than use coef and grid something like that:
from scipy.interpolate import BSpline spline_output = BSpline(grid, coef, k)
the grid parameter has changed a lot. So the current API_3_grid can't work. I'll have an update soon.
when i run this section of codes, thr following error arise. Then, i chaged model.act_fun[0].coef[0].shape[0] to model.act_fun[0].coef[0].shape[1], it equals to G+k. However, the following error occurs