VAF Variance Accounted For(方差贡献率)

VAF是指方差贡献率,是一种用于衡量(评估)模型预测能力的指标。即模型的预测结果与实际结果的相关程度。
VAF越高,说明模型对实际数据的解释能力越好,模型预测结果越接近实际结果。
计算公式:
V A F = 1 − S S r e s S S t o t VAF = 1 - \frac{SS_{res}}{SS_{tot}} VAF=1SStotSSres
其中, S S r e s SS_{res} SSres表示残差平方和(residual sum of squares)
S S t o t SS_{tot} SStot表示总平方和(total sum of squares)。
S S r e s SS_{res} SSres反映了模型的预测误差, S S t o t SS_{tot} SStot反映了实际数据的变异程度。

在这里插入图片描述

def calc_vaf(y_true, y_pred):
    ss_res = np.sum(np.square(y_true - y_pred), axis=0)
    ss_tot = np.sum(np.square(y_true - np.mean(y_true, axis=0)), axis=0)
    return 1 - ss_res / ss_tot

猜你喜欢

转载自blog.csdn.net/m0_51581537/article/details/130198047