核密度估计(Kernel Density Estimation)在概率论中用来估计未知的密度函数,属于非参数检验方法之一。
核密度估计函数采用平滑的峰值函数来拟合观察到的数据点,从而对真实的概率分布曲线进行模拟。
- 函数格式
select kernel_density_estimation(bigint stamp, double value, varchar kernelType)
- 参数说明
参数 说明 stamp UnixTime 时间戳数据,单位为秒。 value 对应的观测数值。 kernelType - box:矩形。
- epanechnikov:Epanechnikov 曲线。
- gaussian:高斯曲线。
- 输出结果
显示项 说明 unixtime 对应原始数据的时间数据。 real 对应的观测数值。 pdf 对应的每个观测点的概率值。 - 示例
- 代码示例:
* | select date_trunc('second', cast(t1[1] as bigint)) as time, t1[2] as real, t1[3] as pdf from ( select kernel_density_estimation(time, num, 'gaussian') as res from ( select __time__ - __time__ % 10 as time, COUNT(*) * 1.0 as num from log group by time order by time) ), unnest(res) as t(t1) limit 1000
- 结果示例:
- 代码示例:
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家
阿里云企业补贴进行中: 马上申请
腾讯云限时活动1折起,即将结束: 马上收藏
同尘科技为腾讯云授权服务中心。
购买腾讯云产品享受折上折,更有现金返利:同意关联,立享优惠
转转请注明出处:https://www.yunxiaoer.com/161755.html