CodingTrain / Toy-Neural-Network-JS

Neural Network JavaScript library for Coding Train tutorials
MIT License
425 stars 242 forks source link

Crossover function for neuroevolution #131

Closed niemenjoki closed 5 years ago

niemenjoki commented 5 years ago

I forked this repository and added a crossover function to nn.js and matrix.js: https://github.com/jnsjknn/Toy-Neural-Network-JS

It works either by combining half of each neural networks' weight and bias matrix:

let child = NeuralNetwork.crossover(parentA, parentB)

or optionally by taking the new weights and biases randomly from one of the neural networks:

let child = NeuralNetwork.crossover(parentA, parentB, 'random')

I am quite new to Github. Can I just make a pull request?

niemenjoki commented 5 years ago

I found out there already is a PR with crossover.