Closed lucassherbrook closed 6 months ago
Hello @lucassherbrook,
Could you provide a sample of your real data (x_points
, y_points
) for checking?
The result you showed on the second plot should be with smooth=0.0
(just linear regression). See in the doc: https://csaps.readthedocs.io/en/latest/tutorial.html#bounds-of-smoothing-parameter
Here is the data I inputted to csaps: spline_data.csv
It outputs linear regression for me when using any smoothing parameter (including for those outside of the [0,1] range).
The X-data nonuniformity on which the spline is built is such that the value of the smoothing parameter is in a very narrow range, close to 1.
There is the value of smooth
that is automatically calculated: 0.999999999727055
You can change the value to 0.999998
and you will see that the spline fits your data correctly.
Nevertheless, this is not very convenient. You can try to use smooth normalization to avoid the problems with X-data nonuniformity and scaling.
yi = csaps(x, y, xi, smooth=0.5, normalizedsmooth=True)
In this case the effect from the smooth parameter will be almost linear in the range from 0 to 1.
What the csaps function looks like without smooth parameter:
What the csaps function looks like with any non-default smoothing parameter, even if small: