public override DecisionNetDNA <T> mutate() { DecisionNetDNA <T> mutated = Clone(); mutated.m_weights = MatrixCalc.elementwiseRandomMultiply(m_weights, m_mutation_multiplier); mutated.m_weights = MatrixCalc.columnNormalize(mutated.m_weights); return(mutated); }
public override NeuralNetDNA <T> mutate() { NeuralNetDNA <T> mutated = Clone(); for (int i = 0; i < m_weights.Length; i++) { bool test = BoolCalc.random(); Range <float> mut = test ? m_mutation_multiplier : new Range <float>(-m_mutation_multiplier.Min, -m_mutation_multiplier.Max); mutated.m_weights[i] = MatrixCalc.elementwiseRandomMultiply(m_weights[i], mut); } return(mutated); }