anomalydetection.mad() 函数
anomalydetection.mad()
是用户贡献的函数,由软件包作者维护。
anomalydetection.mad()
使用中位数绝对偏差 (MAD) 算法来检测数据集中的异常。
输入数据需要 _time
和 _value
列。输出数据按 _time
分组,并包含以下感兴趣的列
- _value:原始
_value
与计算出的 MAD 之间的差值,再除以中位数差值。 - MAD:组的中位数绝对偏差。
- level:异常指示器,设置为
anomaly
或normal
。
函数类型签名
(<-table: stream[B], ?threshold: A) => stream[{C with level: string, _value_diff_med: D, _value_diff: D, _value: D}] where A: Comparable + Equatable, B: Record, D: Comparable + Divisible + Equatable
有关更多信息,请参阅函数类型签名。
参数
threshold
异常的偏差阈值。
table
输入数据。默认为管道转发数据 (<-
)。
示例
使用 MAD 算法检测异常
import "contrib/anaisdg/anomalydetection"
import "sampledata"
sampledata.float()
|> anomalydetection.mad(threshold: 1.0)
此页面是否对您有帮助?
感谢您的反馈!