public static double squash(SQUASH_FUNC func, double val)
            {
                switch (func)
                {
                case SQUASH_FUNC.TANH:
                    return(Math.Tanh(val));

                case SQUASH_FUNC.SIGMOID:
                    return(1 / (1 + Math.Exp(-val)));

                case SQUASH_FUNC.RELU:
                    return(Math.Max(0.0, val));

                default:
                    return(Math.Tanh(val));
                }
            }
            public static double derivative_squash(SQUASH_FUNC func, double val)
            {
                switch (func)
                {
                case SQUASH_FUNC.TANH:
                    return(1 - Math.Tanh(val));

                case SQUASH_FUNC.SIGMOID:
                    return(val * (1 - val));   //(squash(func, val) * (1 - squash(func, val)));

                case SQUASH_FUNC.RELU:
                    //if (val == 0) throw new Exception();
                    return((val <= 0.0) ? 0 : 1);

                default:
                    return(1 - Math.Tanh(val));
                }
            }