/NEAT4J

Neuroevolution in Java

Primary LanguageJavaMIT LicenseMIT

NEAT4J

Build Status Codacy Badge NEAT4J's License

Javadocs

This is an architecture-free neural network library, which uses the instinct algorithm to evolve the best possible neural network.

Getting Started

Add it as Maven dependency:

<dependency>
  <groupId>com.github.raimannma</groupId>
  <artifactId>NEAT4J</artifactId>
  <version>1.14</version>
</dependency>

Or use the jar file from the latest release. How you can build your own jar file is described below.

Examples

Create a network

Network network = new Network(numInputs, numOutputs);

Learn the AND-Gate

final double[][] inputs = new double[][]{  
    new double[]{0, 0},  
    new double[]{0, 1},  
    new double[]{1, 0},  
    new double[]{1, 1},  
};  
final double[][] outputs = new double[][]{  
    new double[]{0},  
    new double[]{0},  
    new double[]{0},  
    new double[]{1},  
};  
  
final Network network = new Network(2, 1); // create minimal network

final EvolveOptions options = new EvolveOptions();  
options.setError(0.05); // set target error for evolution
// more options see here: https://raimannma.github.io/NEAT4J/com/github/raimannma/architecture/EvolveOptions.html

network.evolve(inputs, outputs, options); // evolve the network

Running the tests

git clone https://github.com/raimannma/NEAT4J.git
cd NEAT4J
mvn test

Build from source

git clone https://github.com/raimannma/NEAT4J.git
cd NEAT4J
mvn clean package

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

Manuel Raimann Initial work

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Heavily inspired by carrot