public void receiveLearnedMatrix(Matrix <float> p_matrix) { if (!MatrixCalc.isSameSize(p_matrix, m_weights)) { Debug.LogError("Learned matrix must be same size as non-learned matrix"); } m_weights = MatrixCalc.shallowClone(p_matrix); }
public DecisionNet(DInput[] p_inputs, DOutput[] p_outputs, Matrix <float> p_weights) { if (!MatrixCalc.isSize(p_weights, p_inputs.Length, p_outputs.Length)) { Debug.LogError("Constructing DecisionNet with wrong sized matrix"); } m_inputs = p_inputs; m_outputs = p_outputs; m_weights = MatrixCalc.shallowClone(p_weights); }
public NeuralNet(DInput[] p_inputs, DOutput[] p_outputs, Matrix <float>[] p_weights) { m_inputs = p_inputs; m_outputs = p_outputs; m_weights = new Matrix <float> [p_weights.Length]; for (int i = 0; i < p_weights.Length; i++) { m_weights[i] = MatrixCalc.shallowClone(p_weights[i]); } }
public DecisionNetDNA(int p_id, DInputFactory <T>[] p_inputs, DOutputFactory <T>[] p_outputs, Matrix <float> p_weights, Range <float> p_mutation_multiplier) { if (!MatrixCalc.isSize(p_weights, p_inputs.Length, p_outputs.Length)) { Debug.LogError("DecisionNetDNA requires Matrix input size inputs by outputs"); } m_id = p_id; m_inputs = ArrayCalc.shallowClone(p_inputs); m_outputs = ArrayCalc.shallowClone(p_outputs); m_weights = MatrixCalc.shallowClone(MatrixCalc.columnNormalize(p_weights)); m_mutation_multiplier = p_mutation_multiplier; }
public NeuralNetDNA <T> Clone() { NeuralNetDNA <T> clone = new NeuralNetDNA <T>(m_id, m_inputs, m_outputs, m_mutation_multiplier); clone.m_weights = new Matrix <float> [m_weights.Length]; for (int i = 0; i < m_weights.Length; i++) { clone.m_weights[i] = MatrixCalc.shallowClone(m_weights[i]); } return(clone); }