This package has been deprecated

    Author message:

    Renamed. Use npm install neataptic instead!


    1.0.6 • Public • Published

    Gynaptic Build Status

    Gynaptic is an architecture-free neural network library with implementations to create genetic neural networks. It gives the user the ability to create train neurol networks with evolutionary algorithms with just a few lines of code. The library is constantly updated with new mutation, crossover and selection methods. Gynaptics' main neural network code comes from the library Synaptic by Juan Cazala. Gynaptic will stay up to date with Synaptic's improvements as much as possible.

    What Gynaptic adds to Synaptic:

    • an easy-to-use genetic algorithm function
    • 7 mutation methods
    • 4 crossover methods
    • 1 selection method
    • 2 generation methods
    • 3 squashing functions
    • brain, which can contain networks, layers & neurons


    • to/fromJSON() for layers & neurons
    • merge() networks
    • disconnect() networks, layers & neurons
    • project neurons to networks, layers & vice versa
    • overall bugfixes & time improvement



    Head over to the wiki for documentation.

    For the browser, embedding this code makes life easier:

    Neuron = gynaptic.Neuron;
    Evolution = gynaptic.Evolution;
    Trainer = gynaptic.Trainer;
    Methods = gynaptic.Methods;
    Layer = gynaptic.Layer;
    Network = gynaptic.Network;
    Brain = gynaptic.Brain;
    Architect = gynaptic.Architect;


    This is an example of the creation and loop of a genetic neural network. The goal of this genetic algorithm is too create a population that will output a value that is as high as possible (=1) when inputted 0. Please note that this is just an example, and this problem is much easier to 'solve' by backpropagating.

    // Create the evolutionary algorithm
    var GNN = new Evolution({
      size: 50,
      elitism: 5,
      mutationRate: 0.05,
      networkSize = [1,4,1],
      mutationMethod: [Methods.Mutation.MODIFY_RANDOM_BIAS, Methods.Mutation.MODIFY_RANDOM_WEIGHT],
      crossOverMethod: [Methods.Crossover.UNIFORM, Crossover.AVERAGE],
      selectionMethod: [Methods.Selection.FITNESS_PROPORTIONATE],
      fitnessFunction: function(network){
         return Math.round(network.activate([0]) * 200);
    // Loop the evolution process until a certain average score is reached
    var notFinished = true;;
      if(GNN.getAverage() > 190){
        notFinished = false;

    If you want to know how to set up one of these algorithms yourself, feel free to take a look at the wiki pages! If you want to implement a genetic neural network algorithm, but don't know how, feel free to contact me at!


    Gynaptic files are hosted by rawgit, just copy this link into the <head> tag:

    <script src=""></script>

    Installing with node is also possible:

    npm install gynaptic


    If you have any suggestions, please post them at the 'Issues' button at the top of the page.


    npm i gynaptic

    DownloadsWeekly Downloads






    Last publish


    • wagenaartje