Skip to content
/ neat Public

A rust library implementaiton of NeuroEvolution of Augmenting Topologies

License

Notifications You must be signed in to change notification settings

jspspike/neat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neat

A rust library implementaiton of NeuroEvolution of Augmenting Topologies. NEAT is a genetic learning algorithm that generates both the network weights and topology. You can use this library to train a network on various tasks.

Snake being played by a Network trained with this library. game You can look more into this in examples/snake.rs.

Usage

[dependencies]
neat = { git = "https://github.com/jspspike/neat" }

Implement Task on the struct containing the logic for the task you want to train using NEAT. An example of this can be found here examples/snake.rs. Then use Neat to train on this task.

use neat::Neat;

let mut neat = Neat::<ImplementedTask>::default(1000, 2, 1);

// `step` will execute and train on one generation of genomes.
// It returns the network and fitness of the most fit genome in that step
let (network, fitness) = neat.step();

Finally you can use the Network to execute your task. If you have the struct that implements Task you can pass that to it directly or use the prop function to get one step. You can find an example of this in examples/run-snake.rs

use neat::Network;

let mut inputs = !vec[0.0];

loop {
    let outputs = network.prop(inputs);
    inputs = task.do_stuff(outputs);
}

Documentation

There are doc comments in the library so use cargo doc for now.

About

A rust library implementaiton of NeuroEvolution of Augmenting Topologies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages