diffsvg.pp.compute_interior_knots#

diffsvg.pp.compute_interior_knots(n_bsplines, degree=3)#

Interior knot positions (plus the 0/1 endpoints) for a B-spline basis on [0, 1].

For patsy’s bs(x, knots=interior_knots, degree=degree, include_intercept=True) the number of resulting basis columns is len(interior_knots) + degree + 1, so n_bsplines interior knots are chosen accordingly.

Parameters:
n_bsplines

Desired number of B-spline basis functions.

degree default: 3

Degree of the B-spline (3 = cubic).

Returns:

numpy.ndarray Knot grid including the 0 and 1 endpoints, i.e. the interior knots to pass to patsy are result[1:-1].