在数据集中查找曲线 [英] Finding curves in a dataset

查看:90
本文介绍了在数据集中查找曲线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,我有一个数据集,其中包含诸如sin(x)和范围之类的函数的y个值.如何检测此数据集中的曲线(此函数中正弦函数的波峰和波谷)?

Let's say I have a dataset that contains x y values of a function such as sin(x) and a range. How do I detect the curves in this dataset (the peaks and troughs of the sin function in this)?

推荐答案

我昨天想出的一个解决方案:在数据上使用滑动窗口(我使用数据集大小的五分之一),并对局部最小值和最大值进行投票,当窗口在数据上滑动时,投票最多的地方往往是曲线的中心.为了进行进一步处理,一旦获得了这些数据,我将对这些点进行阈值处理以将其减少到几个优势点,然后执行多项式回归(至3度),将a值(以ax ^ 2 + bx + c表示)取为确定曲线的大小(如果曲线太平坦,则将其视为具有异常的直线).

A solution I figured out yesterday: Use a sliding window (I use a 5th of my dataset size) over the data, and vote for the local minima and maxima, when the window has been slid over the data the most votes tend to be the centre of the curves. For further processing, once I had this data I would threshold the points to water it down to a few strong points, and then perform polynomial regression (to 3 degrees), take the a value (in ax^2+bx+c) to determine the size of the curve (if it is too flat then just consider it a straight line with an anomaly).

我想补充一点,就是我可能并没有准确地描述问题,当我说sin(x)时,我使用的是生成曲线的示例,我的数据绝不会遵循三角函数(或任何函数) ,并且曲线将位于随机位置,从而使回归不准确.

I'd like to add that I may not have described the problem accurately, when I said sin(x) I was using an example that generated curves, my data will in no way follow a trigonomic function (or any function), and the curves will be at random places making regression inaccurate.

这可能不是完美的解决方案,但确实可以.

This may not be the perfect solution but it does work.

这篇关于在数据集中查找曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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