峰值预测性能指标PPTS(Peak percentage of threshold statistic)

一、指标解释

我在研究论文的时候观察到了一个性能指标,叫做PPTS(Peak percentage of threshold statistic),翻译过来是:阈值统计的峰值百分比。这篇论文中给出的定义为:
computes the average absolute relative error of predictands of the top γ% streamflow data.The lower the PPTS,the better the capability to forecast peak flow. Note that the recorded streamflow values are arranged in descending order to compute the PPTS and that the threshold level γ denotes the percentage of data selected from the beginning of the arranged data sequence. The parameter G is the number of values above the threshold level γ.
计算公式为:
可以看到,这个公式与平均相对误差非常相似
可以从公式看到,这个PPTS其实就是 一个 平均绝对百分比误差(Mean Absolute Percentage Error,MAPE),但是是将原来的流量序列进行一个降序排列,选择top γ%的数据进行MAPE的计算。

二、计算设计

我利用这个概念自己设计了一个PPTS的计算

  1. 得到y_true(原始流量)的最大值y_max,与最小值y_min。
  2. 设置delta=y_max-y_min。
  3. 设置一个百分比γ,设阈值为Gamma,Gamma=y_min+p*delta
  4. 利用eff=np.where(y_true>Gamma)得到满足y_true>Gamma的元素所在的矩阵位置。
  5. 对满足条件的流量值计算相对误差的绝对值。
  6. 最后求取平均值即可

三、代码如下

// An highlighted block
def PPTS(y_true, y_pred):
    """
    参数:
    y_true -- 测试集目标真实值
    y_pred -- 测试集目标预测值

    返回:
    mape -- MAPE 评价指标
    """
    p=0.01
    y_max=np.max(y_true)
    y_min=np.min(y_true)
    delta=y_max-y_min
    Gamma = y_min+p*delta
    mape=0
    label= np.where(y_true > Gamma)
    eff=label[0]
    l=len(eff)
    for i,a in enumerate(eff):
        mape = mape+(np.abs((y_true[a,:] - y_pred[a,:]) / y_true[a,:]) * 100)

    ppts = mape/ l
    return ppts

四、小结

自己设计的这个指标与论文中的PPTS还是有一些不同的,它其实是计算了top(1-γ)的MAPE,不过同样能评估模型对峰值的计算性能了。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值