Ejemplo n.º 1
0
        public static Neuron CloneFromWithSevereRandom(Neuron other, Random rnd)
        {
            double alpha = AppProperties.NetworkSevereMutationAlpha;

            return
                (new Neuron
            {
                Weights =
                    other.Weights
                    .Select(x => x * alpha + (2.0 * rnd.NextDouble() - 1.0) * (1.0 - alpha))
                    .ToArray(),

                BaseLevel = other.BaseLevel * alpha + (2.0 * rnd.NextDouble() - 1.0),

                LightSensitivity = LightSensitivityParam.CloneFromWithSevereRandom(other.LightSensitivity, rnd)
            });
        }
Ejemplo n.º 2
0
        public static Neuron CloneFromWithExpansionZeroValues(Neuron other, Random rnd, bool[] doubleVector)
        {
            double maxMutation = AppProperties.NetworkMaxRegularMutation;

            var mainValues = other.Weights;

            var newValues = other.Weights
                            .Where((v, idx) => doubleVector[idx])
                            .Select(x => (2.0 * rnd.NextDouble() - 1.0) * maxMutation);

            return
                (new Neuron
            {
                Weights = mainValues.Concat(newValues).ToArray(),
                BaseLevel = other.BaseLevel,
                LightSensitivity = LightSensitivityParam.CloneFromWithSevereRandom(other.LightSensitivity, rnd)
            });
        }
Ejemplo n.º 3
0
        public static Neuron CloneFromWithExpansion(Neuron other, Random rnd, bool[] doubleVector)
        {
            double alpha = AppProperties.NetworkSevereMutationAlpha;

            var mainValues = other.Weights;

            var newValues = other.Weights
                            .Where((v, idx) => doubleVector[idx])
                            .Select(x => x * alpha + (2.0 * rnd.NextDouble() - 1.0) * (1.0 - alpha));

            return
                (new Neuron
            {
                Weights = mainValues.Concat(newValues).ToArray(),
                BaseLevel = other.BaseLevel,
                LightSensitivity = LightSensitivityParam.CloneFromWithSevereRandom(other.LightSensitivity, rnd)
            });
        }