get_spline_model
- breads.utils.get_spline_model(x_knots, x_samples, spline_degree=3)[source]
Compute a spline based linear model. If Y = [y1, y2, …] are the values of the function at the location of the node [x1,x2,…]. np.dot(M,Y) is the interpolated spline corresponding to the sampling of the x-axis (x_samples)
- Args:
- x_knots: List of nodes for the spline interpolation as np.ndarray in the same units as x_samples.
x_knots can also be a list of ndarrays/list to model discontinous functions.
x_samples: Vector of x values. ie, the sampling of the data. spline_degree: Degree of the spline interpolation (default: 3).
if np.size(x_knots) <= spline_degree, then spline_degree = np.size(x_knots)-1
- Returns:
M: Matrix of size (D,N) with D the size of x_samples and N the total number of nodes.