public OneLayerNeuralNet(OneLayerNeuralNet pattern) { this.wages = new float[pattern.wages.GetLength(0), pattern.wages.GetLength(1)]; Array.Copy(pattern.wages, this.wages, pattern.wages.GetLength(0) * pattern.wages.GetLength(1)); this.biasesInOutputLayer = new float[pattern.biasesInOutputLayer.Length]; Array.Copy(pattern.biasesInOutputLayer, this.biasesInOutputLayer, pattern.biasesInOutputLayer.Length); }
public INeuralNet Crossover(INeuralNet other) { if (other is OneLayerNeuralNet == false) { throw new ApplicationException("'other' should be of type COneLayerNeuralNet to be able to crossover with COneLayerNeuralNet."); } var child = new OneLayerNeuralNet(this.wages.GetLength(0), this.wages.GetLength(1)); child.wages = CrossoverHelper.Crossover(this.wages, (other as OneLayerNeuralNet).wages); child.biasesInOutputLayer = CrossoverHelper.Crossover(this.biasesInOutputLayer, (other as OneLayerNeuralNet).biasesInOutputLayer); return(child); }