Python:时间序列数据的三次样条回归 [英] Python: Cubic Spline Regression for a time series data

查看:516
本文介绍了Python:时间序列数据的三次样条回归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下数据。我想找到适合整个数据集的CUBIC SPLINE曲线(

I have the data as shown below. I want to find a CUBIC SPLINE curve that fits the entire data set (

到目前为止我已经尝试过的事情:

Things I've tried so far:


  1. 我经历了scipy的三次样条函数,但是所有这些函数只能在单个时间给出结果,而我希望在整个时间范围内只有一条曲线。

  1. 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.

我通过绘制scipy.interpolate.splrep生成的4个结的样条系数的平均值来绘制图形,但结果并不理想并且没有解决我的目的。

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.

可以帮助我的事情:


  1. 关于如何优化结的数量和位置以使其更合适的想法

  1. 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.


推荐答案

我制作了一个3D散点图数据,将时间戳从第一个时间戳转换为经过的时间(以秒为单位),该图像如下。在我看来,该数据在某种程度上相当于离群值的3D,此处显示为整行数据,远低于大多数其他数据。这将使创建任何类型的3D表面拟合变得困难。

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.

这篇关于Python:时间序列数据的三次样条回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆