/neural_genalg

Implementation of neural network with genetic algorithm

Primary LanguagePython

Neural network with genetic algorithm

Implementation of neural network with genetic algorithm.

The program takes 8 parametars and they all have to be specified when running the program:

  1. --train: file to train the NN
  2. --test: file to test the NN
  3. --n: layers of neural network split with 's' eg. NN with 2 hidden layer 4 and 5 would be '4s5s'
  4. --popsize: size of population
  5. --elitism: how many parents we want to add to next generation
  6. --p: probability of mutation for elements of a chromosome
  7. --K: standard deviation in mutation fuction
  8. --iters: number of iterations to run
Example:
foo@bar:~$ python solution.py --train ./files/sine_train.txt --test ./files/sine_test.txt --nn 5s --popsize 10 --elitism 1 --p 0.1 --K 0.1 --iter 10000

It also writes out error of the best individual in a population every 2000 iterations.

The only package that is needed to run the program is numpy.