public static LightSensitivityParam CloneFrom(LightSensitivityParam other, Random rnd) { double maxMutation = AppProperties.NetworkMaxRegularMutation; return (new LightSensitivityParam { Sensetive = other.Sensetive, Direction = other.Direction + (2.0 * rnd.NextDouble() - 1.0) * maxMutation, Width = Math.Max(0.001, other.Width + (2.0 * rnd.NextDouble() - 1.0) * maxMutation) }); }
public Neuron(int size, Random rnd) { Weights = new double[size]; BaseLevel = 0.0; for (int i = 0; i < size; ++i) { Weights[i] = 0.0; } LightSensitivity = new LightSensitivityParam(); }
public static LightSensitivityParam CloneFromWithSevereRandom(LightSensitivityParam other, Random rnd) { double alpha = AppProperties.NetworkSevereMutationAlpha; double sensitivityProbability = AppProperties.LightSensetivityProbability; return (new LightSensitivityParam { Sensetive = rnd.NextDouble() < sensitivityProbability, Direction = other.Direction * alpha + (2.0 * rnd.NextDouble() - 1.0) * (1 - alpha), Width = Math.Max(0.001, Math.Abs(other.Width * alpha + (2.0 * rnd.NextDouble() - 1.0) * (1 - alpha))) }); }
public static Neuron CloneFromWithShrink(Neuron other, Random rnd, bool[] keepVector) { return (new Neuron { Weights = other.Weights .Where((v, idx) => keepVector[idx]) .ToArray(), BaseLevel = other.BaseLevel, LightSensitivity = LightSensitivityParam.CloneFrom(other.LightSensitivity, rnd) }); }
public static Neuron CloneFrom(Neuron other, Random rnd) { double maxMutation = AppProperties.NetworkMaxRegularMutation; return (new Neuron { Weights = other.Weights .Select(x => x + (2.0 * rnd.NextDouble() - 1.0) * maxMutation) .ToArray(), BaseLevel = other.BaseLevel + (2.0 * rnd.NextDouble() - 1.0) * maxMutation, LightSensitivity = LightSensitivityParam.CloneFrom(other.LightSensitivity, rnd) }); }
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) }); }