Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column of zeroes produces NaNs #27

Closed
PetrToman opened this issue Jan 13, 2012 · 1 comment
Closed

Column of zeroes produces NaNs #27

PetrToman opened this issue Jan 13, 2012 · 1 comment

Comments

@PetrToman
Copy link

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.

@jeffheaton
Copy link
Owner

Thanks for pointing that out! I fixed this on both the Java and C# side. Added calls to FixSingle value in all of the constructors. Did this to both Java and C# sides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants