/// <summary>
        /// Genetic mutation for auxiliary argument data.
        /// </summary>
        public void MutateAuxArgs(double[] auxArgs, XorShiftRandom rng, ZigguratGaussianSampler gaussianSampler, double connectionWeightRange)
        {
            // Mutate center.
            // Add Gaussian distribution sample and clamp result to +-connectionWeightRange.
            double tmp = auxArgs[0] + gaussianSampler.NextDouble(0, _auxArgsMutationSigmaCenter);

            if (tmp < -connectionWeightRange)
            {
                auxArgs[0] = -connectionWeightRange;
            }
            else if (tmp > connectionWeightRange)
            {
                auxArgs[0] = connectionWeightRange;
            }
            else
            {
                auxArgs[0] = tmp;
            }

            // Mutate radius.
            // Add Gaussian distribution sample and clamp result to [0,1]
            tmp = auxArgs[1] + gaussianSampler.NextDouble(0, _auxArgsMutationSigmaRadius);
            if (tmp < 0.0)
            {
                auxArgs[1] = 0.0;
            }
            else if (tmp > 1.0)
            {
                auxArgs[1] = 1.0;
            }
            else
            {
                auxArgs[1] = tmp;
            }
        }
        /// <summary>   Default constructor. </summary>
        public ActivationFunctions()
        {
            // Create some random Gaussian values as the inputs to the activation functions.
            var gaussian = new ZigguratGaussianSampler(0);

            for (var i = 0; i < _x.Length; i++)
            {
                _x[i] = gaussian.NextDouble(0, 2.0);
                _f[i] = (float)gaussian.NextDouble(0, 2.0);
            }
        }
Пример #3
0
        public FunctionBenchmarks()
        {
            // Create some random gaussian values as the inputs to the activation functions.
            ZigguratGaussianSampler gaussian = new ZigguratGaussianSampler(0);

            for (int i = 0; i < _x.Length; i++)
            {
                _x[i] = gaussian.NextDouble(0, 2.0);
            }
        }