问题
I have the data as shown below. I want to find a CUBIC SPLINE curve that fits the entire data set (link to sample data).
Things I've tried so far:
I've gone through scipy's Cubic Spline Functions, but all of them are only able to give results at a single time only, whereas I want a single curve for the entire time range.
I plotted a graph by taking an average of the spline coefficients generated by scipy.interpolate.splrep for a 4 number of knots, but the results were not good and didn't solve my purpose.
Things that can help me:
An idea about how to optimize the number and position of knots for a better fit
If not that, then if someone can help me find the exact polynomial coefficients for the Cubic Splines for a given number of knots.
If someone can suggest a complete way to solve this problem.
回答1:
I made a 3D scatterplot of the data, converting the timestamps to "elapsed time in seconds" from the first timestamp, the image is below. It appears to me that the data has a sort of 3D equivalent of an outlier, here shown as an entire line of data that is considerably below most of the other data. This will make creating a 3D surface fit of any kind difficult.
来源:https://stackoverflow.com/questions/56421854/python-cubic-spline-regression-for-a-time-series-data