GithubHelp home page GithubHelp logo

vyraun / tf-genetic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vanhooser/tf-genetic

0.0 3.0 0.0 10 KB

Evolutionary Neural Networks backed by TensorFlow and pure Python

License: MIT License

Python 100.00%

tf-genetic's Introduction

TF-Genetic

###Evolutionary Neural Networks, backed by TensorFlow and pure Python

Based on the work of Maul et al in this paper

Net

Description

This package speeds up the evolution of activation function structure in neural networks. Nets can sometimes become even more accurate to their problem domain when activation functions within each layer are mixed together and not uniformly applied to all neurons.

This package allows for easy simulation of an arbitrary number of layers/neurons/activation functions to find an optimal arrangement.

Dependencies

Structure

.
├── LICENSE
├── README.md
└── src
    ├── Chromosome.py
    ├── GeneticNetwork.py
    ├── TFGenetic.py
    └── tests.py

Thirty Seconds to TF-Genetic

  • Import dependencies
import tensorflow as tf
import numpy as np
import TFGenetic as gen
  • Define valid activation functions the genetic algorithm will evolve
validActivationFunctions = [tf.nn.sigmoid, tf.nn.tanh, tf.nn.relu, tf.nn.softsign]
  • Initialize a genetic algorithm population and describe the initial structure of the population dimensions. Here with the Iris dataset, the network is a 4 -> x -> 1 network type
g = gen.GeneticPool(
 			populationSize = 10, 
			tournamentSize = 4,
			memberDimensions = [4, 10, 5, 1], 
			validActivationFunctions = validActivationFunctions
			)
g.generatePopulation()
  • For number of generations specified, cycle and generate new individuals
numGenerations = 100
for _ in range(numGenerations):
	g.cycle()
	g.generation()
g.plotEvolution()

tf-genetic's People

Contributors

vanhooser avatar

Watchers

James Cloos avatar Vikas Raunak 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.