/// <summary> /// Genetic mutation for auxiliary argument data. /// </summary> public void MutateAuxArgs(double[] auxArgs, IRandomSource rng, ZigguratGaussianDistribution gaussianSampler, double connectionWeightRange) { // Mutate centre. // Add Gaussian distribution sample and clamp result to +-connectionWeightRange. double tmp = auxArgs[0] + gaussianSampler.Sample(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.Sample(0, _auxArgsMutationSigmaRadius); if (tmp < 0.0) { auxArgs[1] = 0.0; } else if (tmp > 1.0) { auxArgs[1] = 1.0; } else { auxArgs[1] = tmp; } }
public FunctionBenchmarks() { // Create some random Gaussian values as the inputs to the activation functions. ZigguratGaussianDistribution gaussian = new ZigguratGaussianDistribution(0); for (int i = 0; i < _x.Length; i++) { _x[i] = gaussian.Sample(0, 2.0); _f[i] = (float)gaussian.Sample(0, 2.0); } }
public BenchmarksVectorizedDouble() { // Create some random Gaussian values as the inputs to the activation functions. var gaussian = new ZigguratGaussianDistribution(0); for (int i = 0; i < _x.Length; i++) { _x[i] = gaussian.Sample(0, 2.0); } }