pengowen123 / cge

An implementation of the CGE neural network encoding, written in Rust.
Apache License 2.0
3 stars 2 forks source link

cge

Crates.io Rust

A Rust library for creating, using, and modifying artificial neural networks using the Common Genetic Encoding (CGE). See const_cge for a similar library geared towards embedded environments and performance-critical use cases. For the creation of CGE-compatible neural networks, see the eant2 library.

Requires Rust 1.43 or later.

Features

cge is intended to be a complete solution for interacting with CGE neural networks in the direct encoding case only. It currently provides these features:

Quick Start

Add this to your Cargo.toml:

[dependencies]
cge = "0.1"

Then, to load and use an existing neural network from a file:

use cge::{Network, WithRecurrentState};

// `extra` is any user-defined data stored alongside the network
let (mut network, metadata, extra) =
    Network::<f64>::load_file::<(), _>("network.cge", WithRecurrentState(true)).unwrap();

println!("description: {:?}", metadata.description);
println!("num inputs, outputs: {}, {}", network.num_inputs(), network.num_outputs());
println!("{:?}", network.evaluate(&[1.0, 2.0]).unwrap());

network.clear_state();

println!("{:?}", network.evaluate(&[2.0, 0.0]).unwrap());

For more information, see the documentation and examples.

Contributing

Contributions are welcome! You can contribute by reporting any bugs or issues you have with the library, adding documentation, fixing bugs, or adding features.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

License

Licensed under either of

Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.