Swift-AI / Swift-AI

The Swift machine learning library.
MIT License
6.03k stars 554 forks source link

Genetic Algorithm #62

Open tanmayb123 opened 7 years ago

tanmayb123 commented 7 years ago

This probably isn't an issue for this SDK, I just added this as a "discussion"...

I've been messing around with getting Neural Networks to play games, for example, but I want to take it a step further: Would it be possible to use something like "Mendel" (an iOS SDK for Genetic Algorithms) to evolve a Neural Network using this SDK?

collinhundley commented 7 years ago

@tanmayb123 I had read this wrong originally, and thought it was a feature request for genetic algorithms, which are in fact on the to-do list.

To answer your real question: yes. GAs can be used to evolve neural networks, but they are rarely more effective than backpropagation. If you have labeled training data, and if backpropagation is ever an option, use it first. That said, some recent studies have shown that evolutionary approaches can be a viable alternative to reinforcement learning.

Hope this helps!

tanmayb123 commented 7 years ago

Thanks for the answer, @collinhundley! I really appreciate it. I've been working a bit more on this - but do you think it would be a better idea to create an example for Swift-AI that uses a Genetic Algorithm SDK developed by someone else, like Mendel, or to implement it as a feature of Swift-AI itself?

collinhundley commented 7 years ago

@tanmayb123 the plan is to provide a semi-generic GA implementation in Swift AI. Once that is completed, I'd love to see some example projects.