Giter VIP home page Giter VIP logo

bruceweir / neural-network-genetic-algorithm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harvitronix/neural-network-genetic-algorithm

0.0 2.0 0.0 158 KB

Evolving a neural network with a genetic algorithm.

Home Page: https://medium.com/@harvitronix/lets-evolve-a-neural-network-with-a-genetic-algorithm-code-included-8809bece164

License: MIT License

Python 72.57% Jupyter Notebook 27.21% Shell 0.22%

neural-network-genetic-algorithm's Introduction

Evolve a neural network with a genetic algorithm

This application uses a genetic algorithm to search for an optimum neural network structure.

It can currently handle Dense (Fully Connected), Conv2D, Dropout, MaxPooling and ActivityRegularization layers and branching neural network structures. It uses the Keras library to build, train and validate.

The inspiration for this project was this blog post (https://medium.com/@harvitronix/lets-evolve-a-neural-network-with-a-genetic-algorithm-code-included-8809bece164), which describes the original code from which this is forked, although it turned out that I had to rewrite pretty much the entire thing to incorporate the Convolution and other useful layers...

To run

To run the genetic algorithm:

python3 evolutionary_neural_network_generator.py

Options are viewable via the -h switch

Example usage for breeding MNIST classifiers using a population of 10 networks over 20 generations: (Note that if you don't already have MNIST installed it will be downloaded for you, which might not work if you are behind a proxy)

python3 evolutionary_neural_network_generator.py -p 10 -g 20 -d mnist

To Run the Unit Tests:

python3 tests.py

You can set your network parameter choices by editing network_layer_options.py.

You can choose whether to use the MNIST or CIFAR10 datasets. Simply set -dataset switch to either mnist or cifar10. You can also use your own datasets by using the --training_data and --test_data switches and following the data formatting instructions in the get_dataset_from_file() method in train.py, or the examples in the test_train() function in tests.py

neural-network-genetic-algorithm's People

Contributors

bruceweir avatar harvitronix avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.