encog/encog-dotnet-core — Issue #27: Column of zeroes produces NaNs
Author: PetrToman
Created: 2012-01-13 08:42:59+00:00
State: open

Hi,
if there is a column of zeroes in the input data, which is to be normalized, the output becomes all NaNs (Not a number). This is because of zero division in Encog.Util.Arrayutil.NormalizedField.Normalize() method:

public double Normalize(double v)
{
return ((v - _actualLow)/(_actualHigh - _actualLow)) // if _actualHigh and _actualLow are both zero -> NaN
*(_normalizedHigh - _normalizedLow)
+ _normalizedLow;
}

There is already FixSingleValue() method, which would fix this problem, but it is not used (at all). The same applies for Java code.