Suppose $x$ is an approximation of $y$. This paper proposes using $\frac{|x-y|}{1+|y|}$, named Hyb Error, to measure the error. This metric equals half the harmonic mean of absolute error and relative error, effectively combining their advantages while mitigating their limitations. For example, Hyb Error approaches absolute error as $|y|$ approaches 0, thereby avoiding the exaggeration of relative error, and approaches relative error as $|y|$ approaches infinity, thereby avoiding the exaggeration of absolute error. The Hyb Error of $\epsilon$ is equivalent to $|x-y|=\epsilon+\epsilon |y|$, which implies $\mathrm{isclose}(x,y,\epsilon,\epsilon)=\mathrm{True}$, where ``isclose'' is a common floating-point equality check function in numerical libraries. For sequences, this property makes the Maximum Element-wise Hyb Error (MEHE) a pragmatic error metric that reflects the most significant error and equals the decision boundary of the ``isclose'' function.
翻译:设 $x$ 为 $y$ 的近似值。本文提出使用 $\frac{|x-y|}{1+|y|}$(命名为 Hyb Error)来度量误差。该指标等于绝对误差与相对误差的调和平均数之半,有效结合了二者的优势并抑制了各自的局限性。例如,当 $|y|$ 趋近于0时,Hyb Error 趋近于绝对误差,从而避免相对误差的放大效应;当 $|y|$ 趋近于无穷大时,Hyb Error 趋近于相对误差,从而避免绝对误差的放大效应。Hyb Error 的 $\epsilon$ 阈值等价于 $|x-y|=\epsilon+\epsilon |y|$,这意味着 $\mathrm{isclose}(x,y,\epsilon,\epsilon)=\mathrm{True}$,其中 “isclose” 是数值库中常见的浮点数相等性检查函数。对于序列而言,该性质使得最大元素级 Hyb Error (MEHE) 成为一种实用的误差度量指标,既能反映最显著误差,又与 “isclose” 函数的决策边界保持一致。