记录一下the elbow method,今天看文章时看到了一个elbow method,特此记录一下,因为之前我写文章,经常会遇到需要设定阈值的情况,阈值的确定其实是不难,但是这个过程容易引入主观性,一旦引入主观性审稿人就会批你了,而elbow method其实就是一种敏感性分析,然后在敏感性分析过程中尽可能客观,简单而使用。
1. The elbow method in clustering
这个其实不是文章中提到的elbow method,而是查了下wiki,wiki上是这么说的:
In cluster analysis, the elbow method is a heuristic used in determining the number of clusters in a data set. The method consists of plotting the explained variation as a function of the number of clusters, and picking the elbow of the curve as the number of clusters to use. The same method can be used to choose the number of parameters in other data-driven models, such as the number of principal components to describe a data set.下图的红点就是elbow,也就是该点之后上升缓慢了,这个其实还是有很强主观性的,下面在记录下一篇文章里给出的elbow method。
2.The elbow method given in paper
下面第一张图是作者提出的一个指标,该指标记录了经济活动的活跃程度,现在要识别灾难(异常事件)的发生时间,很自然的想到,设定一个阈值,比这个阈值低(高)的时候就是灾难(异常事件)发生了。第二张图就是阈值和异常事件数量的关系图,为什么会先升后降呢?因为当阈值小于0.5时,显然设定小于阈值为异常事件,当大于0.5了之后,则应当设定大于阈值为异常事件,因此是先升后降的。
接下来就开始使用the elbow method确定阈值了。分为三步:
- 绘制出随着阈值改变,识别出的异常事件数量变化折线图,如下面第二张图中的黑实线所示;
- 连接起点和折线图中的一点,使得连线的斜率最大,图中就是连接原点和最高点,即绘制得到黑色虚线。
- 找出使得黑色实线和黑色虚线距离最大的阈值,即图中红色线所示的横坐标就是最后确定的阈值了。