Skip to content

Commit

Permalink
improving docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LuKks committed Dec 4, 2019
1 parent 548f031 commit a9eaf1a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ func (layer *Layer) Mutate (probability float64) {
}

// Crossover two layers merging neurons
func (layerA *Layer) Crossover (layerB *Layer, dominant float64) *Layer {
func (layer *Layer) Crossover (layerB *Layer, dominant float64) *Layer {
new := NewLayer(&Layer{
Inputs: layerA.Inputs,
Units: layerA.Units,
Activation: layerA.Activation,
Rate: layerA.Rate,
Momentum: layerA.Momentum,
Inputs: layer.Inputs,
Units: layer.Units,
Activation: layer.Activation,
Rate: layer.Rate,
Momentum: layer.Momentum,
})

for i := 0; i < layerA.Units; i++ {
new.Neurons[i] = layerA.Neurons[i].Crossover(*layerB.Neurons[i], dominant)
for i := 0; i < layer.Units; i++ {
new.Neurons[i] = layer.Neurons[i].Crossover(*layerB.Neurons[i], dominant)
}

new.Range = make([][]float64, len(layerA.Range))
copy(new.Range, layerA.Range)
new.Range = make([][]float64, len(layer.Range))
copy(new.Range, layer.Range)

return new
}
Expand Down

0 comments on commit a9eaf1a

Please sign in to comment.