KAN-Tutorial icon indicating copy to clipboard operation
KAN-Tutorial copied to clipboard

Spline questions, unclarities in chapter 1

Open rumoschilling opened this issue 1 year ago • 2 comments

The first issue was that you write "Control points are user-defined, pre-specified points through which the curve must pass." From my understanding (which largely stems from Freya Holmers video), curves created by B-Splines do not neccesarily pass through the control points.

The other thing is that the graphs do not show partition of unity(i.e that the functions add up to one at every point) of B-Splines in order 2 and 3. My matplotlib skills are very basic, but I imagine that this is because the curve doesnt show the negative parts of the basis functions.

I apologize if these issues dont exist, I am a new to the topic. I hope that even if I missed a detail, other newcomers will miss these too and this will improve the clarity of the tutorial at least. Thanks for your time.

rumoschilling avatar Oct 13 '24 10:10 rumoschilling

Hi,

Thanks for the question!

  1. Thanks for pointing this out. You are right that the curve need not pass through all the control points. The order of the curve also matters.

  2. The graphs of partition need not sum to unity. This can be worked through the recursion formula.

pg2455 avatar Oct 14 '24 20:10 pg2455

I worked the recursion formula a bit by hand, and although I could not prove partition to unity, I think your code has a small bug which makes the numbers go so high. In the denominator of the first term in the recursion formula you iterate the list 1:k when it should be k:1. So instead of

value21 = (x_ - grid_[:, :-(k+1)]) / (grid_[:, 1:-k] - grid_[:, :-(k+1)]) * value1[:, :-1] it should be value21 = (x_ - grid_[:, :-(k+1)]) / (grid_[:, k:-1]- grid_[:, :-(k+1)]) * value1[:, :-1]

Your bug makes it so it basically does not normalize the term for higher degrees. If I did not miss something and this is a mistake, it is very interesting that even though this bug happened, your tutorial runs flawless and the network can learn all these toy examples with a not normalized cubic spline. Certainly something interesting.

rumoschilling avatar Nov 07 '24 17:11 rumoschilling