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