profqu_neat

Crates.ioprofqu_neat
lib.rsprofqu_neat
version0.1.1
sourcesrc
created_at2023-01-18 20:56:33.315264
updated_at2023-01-18 21:04:45.594185
descriptionA library that implements the NEAT algorithm
homepage
repositoryhttps://github.com/ProfessorQu/profqu_neat
max_upload_size
id762051
size96,281
(ProfessorQu)

documentation

README

profqu_neat

A crate that implements the NEAT algorithm Created according to a tutorial from Finn Eggers. I tried to implement NEAT from the official github repository, but I couldn't figure out how to do it, so I used Finn's implementation.

Then I looked on Youtube and found Finn Eggers and his tutorial really helped me with creating this library.

Doesn't allow recurrent connections in the networks.

Examples

use profqu_neat::Neat;

// Load config and create new Neat
Neat::load_config_from_file("src/config.txt");
let mut neat = Neat::new(10, 1, 1000);

// Create inputs
let input: Vec<f32> = vec![rand::random(); 10];

// Try to evolve the clients
for _iteration in 0..200 {
    for mut client in neat.iter_clients() {
        let fitness = client.calculate(&input)[0];
        client.fitness = fitness;
    }
    neat.evolve();
}

/// Get the best client
let best = neat.best_client().expect("Failed to get client");

/// Print all the data
neat.print_species();
println!("Best: {best:?}");

assert!(best.fitness > 0.8);
Commit count: 62

cargo fmt