문제

I have methods for scaling inputs and descaling outputs of NN that I found somewhere long time ago but I am not sure if they are valid,im using encog library for NN:

public static double Scale(double X)
        {
            double fieldlow = 0;
            double fieldhigh = 1;
            double min = 1;
            double max = 2;
            //double max = 10000;
            double temp = ((X - min) / (max - min)) * (fieldhigh - fieldlow) + fieldlow;
            return temp;
        }
        public static double DeScale(double X)
        {
            double fieldlow = 0;
            double fieldhigh = 1;
            double min = 1;
            double max = 2;
            //double max = 10000;
            double temp = ((min - max) * X - fieldhigh * min + max * fieldlow) / (fieldlow - fieldhigh);
            return temp;
        }

With assumption that fieldlow and fieldhigh is range of NN input and output(I am not sure but looks like ActivationTANH's range of 0-1), min should be lowest value in data, and max higest value in data. Im curious what if you get new data with values higer then max you set? You have to rewrite this methods and start training from the beginning?

If this is wrong please point me to right direction.

도움이 되었습니까?

해결책

If I remember correctly, scaling apply not only with training data feature range, but with all possible data feature range for. That means if feature in training set have min value - 25 and max - 45, but actually can be from 1 to 1000, than scalling performs with xMin = 1, xMax = 1000 So that values can't changes

Try use this formula: scaledX = (X - minX)/(maxX - minX), where minX\maxX - min and max value per input feature

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top