基于数据集的反规范化值 VB.NET

DeNormalizing Value Based on Data Set VB.NET

假设我使用以下方法将我的数据集标准化为 [1, -1]:

Public Function NormalizeData(values As Double()) As Double()
    Dim min = values.Min
    Dim max = values.Max
    Return values.Select(Function(val) 2 * (val - min) / (max - min) - 1).ToArray
End Function

我将如何根据该数据集对值进行反规范化:

Public Function DeNormalizeData(baseData As Double(), value As Double) As Double
        Dim min = baseData.Min
        Dim max = baseData.Max
        Return '??
End Function

找到你的函数的反函数:dn=denormalized, n=normalized

n= 2*((dn-min)/(max-min)) - 1两边加1

n+1=2*((dn-min)/(max-min)) 除以 2

(n+1)/2=(dn-min)/(max-min) 乘以(最大-最小)

((max-min)*(n+1))/2 = dn - min 两者都加上最小值

dn =(((max-min)*(n+1))/2)+min

你现在已经有了去规范化的功能,你可以看到你需要保存最大值和最小值。

public function DeNormalize(n as double, min as double, max as double) as double 
    return (((max-min)*(n+1))/2)+min
end function