如何在图表中找到斜率突然增加的点? [英] How do I find the point in a graph where the slope suddenly increases?

查看:156
本文介绍了如何在图表中找到斜率突然增加的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑此图片中的图表: Graph.PNG(42.7 KB)



这是一个数据系列,其值(y轴)通常随时间(x轴)增加,但沿途有非常突出的局部最大值和最小值。把它想象成一个糟糕的发型日的股票价格图。



在某些时候,下跌到当地最小值并不明显,整个图表倾斜起来。如果你绘制一条线连接每个凹陷的底部,你会看到一个清晰的点,图形突然变得更陡峭。



是否有一种能够可靠地识别该点的算法?



我的尝试:



我想过



1.通过采用滚动平均值并计算二阶导数来平滑数据。当达到阈值时,我们就有了这一点。这似乎有点受欢迎和想念



2.找到局部最小值,从这些点构建图形,然后做二阶导数。



3.从图的任一端开始构造两条趋势线。当趋势线的斜率偏离小阈值时,只需使用当前斜率向前和向后继续线。这两条线交叉的地方是我想要的点。



我猜这是一个已解决的问题,但还没有找到任何东西。

Consider the graph in this image: Graph.PNG (42.7 KB)

It's a data series whose values (y axis) generally increase over time (x axis) but with quite prominent local maxima and minima along the way. Think of it as a stock price graph on a bad hair day.

At some point the dips down to the local minima aren't as pronounced and the entire graph tilts up. If you draw a line connecting the bottoms of each dip you see a clear point where the graph suddenly goes steeper.

Is there an algorithm that can identify that point reliably?

What I have tried:

I've thought about

1. Smoothing out the data by taking a rolling average and calculating the second derivative. When that hits a threshold we have the point. This seems a bit hit and miss

2. Finding the local minima, constructing a graph from those points, and then doing the second derivative thing.

3. Constructing two trend lines starting from either end of the graph. When the slope of the trend line strays outside a small threshold just continue the line forward and backward using the current slope. Where these two lines cross is the point I want.

I'm guessing this is a solved problem but haven't been able to find anything yet.

推荐答案

我将其视为约束优化。取两条(相交的)直线。在起始点锚定一个(可能是第一个几个点的平均值,或者笔的任意刺),另一个类似于结尾。允许两个斜率变化(可能具有(0 <左斜率<右斜率)的额外约束并且最小化与原始数据的最小平方差异。我不知道我将它扔到哪个包;也许Maple类中的东西。



稍微改善思想泡泡......

让交点绕下三角。 (使得更容易确定哪一条线适合一个点);蒙特卡罗或者进行更集中的优化。甚至进行强力网格搜索。我猜测计算工作是在毫微微比特币领域。



干杯,

彼得
I'd approach it as a constrained optimisation. Take two (intersecting) straight lines. Anchor one at the start point (probably mean of the first "few" points, or an arbitrary stab of the pen), the other similarly at the end. Allow the two slopes to vary (maybe with an extra constraint of (0 < left slope < right slope) and minimise the least squares difference from your raw data. I don't know what package I'd throw it at; maybe something in the Maple class.

Refining the thought bubble somewhat...
Let the intersection point wander round the "lower triangle". (Makes it easier to decide which line to fit a point to); either Monte Carlo it or do a more focused optimisation. Or even do a brute force grid search. I'm guessing the computational effort is in the femto-bitcoin realm.

Cheers,
Peter


这篇关于如何在图表中找到斜率突然增加的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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