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) }); }
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) }); }
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) }); }