Splines, Bezier Curves, and B-Splines
Splines are piecewise polynomial curves that join smoothly at knots. Bezier curves are defined by control points. B-splines generalise both and are the basis functions used in KANs and computer graphics.
Curve Representations
There are three ways to represent a curve:
- Explicit: . Easy to evaluate but may not be a function of (e.g. a circle).
- Implicit: . Works for closed curves but hard to sample points from.
- Parametric: , where is a parameter. Both and are functions of an independent variable . Most flexible. typically.
A parametric curve: , .
Bezier Curves
A Bezier curve of degree is defined by control points :
The curve passes through (at ) and (at ) but generally not through the intermediate control points. The control points act as a scaffold that shapes the curve.
Key properties:
- The curve lies within the convex hull of the control points.
- The tangent at is along , and at along .
- The curve is infinitely differentiable (smooth everywhere).
For 4 control points (, cubic Bezier): the most common form used in typography, animation, and vector graphics.
Parametric Surfaces
Extending to surfaces: where both and are parameters. Bezier surfaces use a grid of control points. The surface passes through corner control points only.
B-Splines
B-splines (Basis splines) generalise Bezier curves. They are defined by:
- A set of control points .
- A knot vector .
- A degree .
The curve is:
where are the B-spline basis functions defined recursively (de Boor’s algorithm):
Kolmogorov-Arnold Networks and B-Splines
In KANs, each edge holds a learnable function implemented as a B-spline. The activation function on each edge is:
where is a linear combination of B-spline basis functions. The coefficients are learned during training.
B-splines are used here because:
- They are locally supported: each basis function is non-zero only over a small interval. Changing one coefficient affects only a local region of the function.
- They are smooth: degree- B-splines are continuous.
- Grid extension is straightforward: add more knots to increase resolution without retraining from scratch.
Least Squares Fitting with B-Splines
Given data points , fit a B-spline by minimising the sum of squared residuals:
where is the matrix of B-spline basis function evaluations:
Each row corresponds to a data point. Each column corresponds to a basis function. The system (the normal equations) gives the least-squares solution.
Knots
Knots are the breakpoints where polynomial pieces join. Between two adjacent knots, the spline is a polynomial of degree . At knots, the pieces join with continuity constraints (how many derivatives match depends on the knot multiplicity).
- and knot values : cubic B-spline with 5 knot spans.
- Increasing knot multiplicity decreases continuity at that knot (useful for corners).
The number of basis functions equals the number of control points: (number of knots) .