Struct set_genome::Parameters[][src]

pub struct Parameters {
    pub seed: Option<u64>,
    pub structure: Structure,
    pub mutations: Vec<Mutations>,
}

This struct captures configuration about the basic ANN structure and available mutations.

It can be constructed manually or from a .toml file.

Examples

Manual:

use set_genome::{Parameters, Structure, Mutations, activations::Activation};

let parameters = Parameters {
    seed: None,
    structure: Structure {
        inputs: 25,
        inputs_connected_percent: 1.0,
        outputs: 3,
        outputs_activation: Activation::Tanh,
        weight_std_dev: 0.1,
        weight_cap: 1.0,
    },
    mutations: vec![
        Mutations::ChangeWeights {
        chance: 1.0,
        percent_perturbed: 0.5,
        },
        Mutations::ChangeActivation {
            chance: 0.05,
            activation_pool: vec![
                Activation::Linear,
                Activation::Sigmoid,
                Activation::Tanh,
                Activation::Gaussian,
                Activation::Step,
                Activation::Sine,
                Activation::Cosine,
                Activation::Inverse,
                Activation::Absolute,
                Activation::Relu,
            ],
        },
        Mutations::AddNode {
            chance: 0.005,
            activation_pool: vec![
                Activation::Linear,
                Activation::Sigmoid,
                Activation::Tanh,
                Activation::Gaussian,
                Activation::Step,
                Activation::Sine,
                Activation::Cosine,
                Activation::Inverse,
                Activation::Absolute,
                Activation::Relu,
            ],
        },
        Mutations::RemoveNode { chance: 0.001 },
        Mutations::AddConnection { chance: 0.1 },
        Mutations::AddRecurrentConnection { chance: 0.01 },
    ],
};

Write a config file like so:

[structure]
inputs = 9
outputs = 2
inputs_connected_percent = 1.0
outputs_activation = "Tanh"
weight_std_dev = 0.1
weight_cap = 1.0

[[mutations]]
type = "add_connection"
chance = 0.1

[[mutations]]
type = "add_recurrent_connection"
chance = 0.01

[[mutations]]
type = "add_node"
chance = 0.005
activation_pool = [
    "Sigmoid",
    "Tanh",
    "Relu",
    "Linear",
    "Gaussian",
    "Step",
    "Sine",
    "Cosine",
    "Inverse",
    "Absolute",
]

[[mutations]]
type = "remove_node"
chance = 0.001

[[mutations]]
type = "change_weights"
chance = 1.0
percent_perturbed = 0.5

[[mutations]]
type = "change_activation"
chance = 0.05
activation_pool = [
    "Sigmoid",
    "Tanh",
    "Relu",
    "Linear",
    "Gaussian",
    "Step",
    "Sine",
    "Cosine",
    "Inverse",
    "Absolute",
]

And then read the file:

// let parameters = Parameters::new("path/to/file");

Fields

seed: Option<u64>

Seed for the RNG.

structure: Structure

Describes basic structure of the ANN.

mutations: Vec<Mutations>

List of mutations that execute on crate::Genome::mutate_with_context

Implementations

impl Parameters[src]

pub fn new(path: &str) -> Result<Self, ConfigError>[src]

Trait Implementations

impl Clone for Parameters[src]

impl Debug for Parameters[src]

impl Default for Parameters[src]

impl<'de> Deserialize<'de> for Parameters[src]

impl Serialize for Parameters[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,