ssshow16/jpmml-evaluator — pull request #1 by zhangjiaqi (2014-12-06 07:47:24+00:00)
Title: Update NeuralNetworkEvaluator.java

replace (1d - Math.exp(-2d * z)) / (1d + Math.exp(-2d * z)) with Math.tanh(z) which is a static function in Math Class.

The (1d - Math.exp(-2d * z)) / (1d + Math.exp(-2d * z)) will return NAN when z = -512.0 . However, Math.tanh(z) will return -1.0 when (1d - Math.exp(-2d*z)) is negative infinite and return 1.0 when (1d - Math.exp(-2d*z)) is positive infinite.