[−][src]Struct radiate::models::neat::neat::Neat
Define a network graph structure of raw pointer neurons
Fields
inputs: Vec<i32>
outputs: Vec<i32>
nodes: HashMap<i32, *mut Neuron>
edges: HashMap<i32, Edge>
Methods
impl Neat
[src]
implement the neuralnetwork
pub fn new() -> Self
[src]
create a new empty neural network graph this network is basically in charge of keeping track of the nodes in the network and their connections to each other
pub fn feed_forward(&self, data: &Vec<f64>) -> Result<Vec<f64>, Box<dyn Error>>
[src]
Feed a vec of inputs through the network, will panic! if the shapes of the values do not match or if something goes wrong within the feed forward process.
pub fn backprop(
&mut self,
data: &Vec<f64>,
targets: &Vec<f64>,
learning_rate: f64
)
[src]
&mut self,
data: &Vec<f64>,
targets: &Vec<f64>,
learning_rate: f64
)
Backpropagation algorithm, transfer the error through the network and change the weights of the edges accordinly, this is pretty straight forward due to the design of the neat graph
pub fn connect(self, num_in: i32, num_out: i32, counter: &mut Counter) -> Self
[src]
Connect the inputs of the network to the outputs of the network for the first time and return back a fully connected default network.
pub fn add_node(
&mut self,
counter: &mut Counter,
activation: Activation
) -> Option<*mut Neuron>
[src]
&mut self,
counter: &mut Counter,
activation: Activation
) -> Option<*mut Neuron>
Add a node to the network by getting a random edge and inserting the new node inbetween that edge's source and destination nodes. The old weight is pushed forward while the new weight is randomly chosen and put between the old source node and the new node
pub fn add_edge(&mut self, counter: &mut Counter) -> Option<Edge>
[src]
add a connection to the network. Randomly get a sending node that cannot be an output and a receiving node which is not an input node, the validate that the desired connection can be made. If it can be, make the connection with a weight of .5 in order to minimally impact the network
pub fn see(&self)
[src]
Trait Implementations
impl Genome<Neat, NeatEnvironment> for Neat
[src]
iplement genome for a neat network
fn crossover(
one: &Neat,
two: &Neat,
env: &Arc<Mutex<NeatEnvironment>>,
crossover_rate: f32
) -> Option<Neat>
[src]
one: &Neat,
two: &Neat,
env: &Arc<Mutex<NeatEnvironment>>,
crossover_rate: f32
) -> Option<Neat>
fn base(env: &mut NeatEnvironment) -> Neat
[src]
fn distance(one: &Neat, two: &Neat, env: &Arc<Mutex<NeatEnvironment>>) -> f64
[src]
impl Send for Neat
[src]
These must be implemneted for the network or any type to be used within seperate threads. Because implementing the functions themselves is dangerious and unsafe and i'm not smart enough to do that from scratch, these "implmenetaions" will get rid of the error and realistically they don't need to be implemneted for the program to work
impl Sync for Neat
[src]
impl Drop for Neat
[src]
Because the tree is made out of raw mutable pointers, if those pointers are not dropped, there is a severe memory leak, like possibly gigs of ram over only a few generations depending on the size of the generation This drop implementation will recursivley drop all nodes in the tree
impl Clone for Neat
[src]
Implement clone for the neat neural network in order to facilitate proper crossover and mutation for the network
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl PartialEq<Neat> for Neat
[src]
Implement partialeq for neat because if neat itself is to be used as a problem, it must be able to compare one to another
impl Display for Neat
[src]
Simple override of display for neat to debug a little cleaner
impl Debug for Neat
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,