Struct OutputLayer

Source
pub struct OutputLayer<A: Activation, Neurons: NL<Input>, Input: AL> { /* private fields */ }
Expand description

The final layer of a Network.

Implementations§

Source§

impl<A: Activation, Neurons: NL<Input>, Input: AL> OutputLayer<A, Neurons, Input>

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl<A: Clone + Activation, Neurons: Clone + NL<Input>, Input: Clone + AL> Clone for OutputLayer<A, Neurons, Input>

Source§

fn clone(&self) -> OutputLayer<A, Neurons, Input>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + Activation, Neurons: Debug + NL<Input>, Input: Debug + AL> Debug for OutputLayer<A, Neurons, Input>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, A: Activation, Neurons, Input> Deserialize<'de> for OutputLayer<A, Neurons, Input>
where Neurons: NL<Input>, Input: AL,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<A: Activation, Input: AL, Neurons: NL<Input>> Layer<Input, Neurons, Neurons, A> for OutputLayer<A, Neurons, Input>

Source§

fn calculate( &self, inputs: &GenericArray<f32, Input>, ) -> GenericArray<f32, Neurons>

runs the inputs through this and lower layers, resulting in the output
Source§

fn step( &self, inputs: &GenericArray<f32, Neurons>, ) -> GenericArray<f32, Neurons>

runs only this layers calculation, not recursing to deeper layers
Source§

fn weight( &self, inputs: &GenericArray<f32, Input>, ) -> GenericArray<f32, Neurons>

reduces the inputs to a single input per neuron using the weights. i.e. calculates the input to the activation functions for the neurons
Source§

fn _get_error( &mut self, output: GenericArray<f32, Neurons>, correct_output: &GenericArray<f32, Neurons>, _speed: f32, ) -> (GenericArray<f32, Neurons>, GenericArray<f32, Neurons>)

gets this layers error, either by comparing with correct output or by calling lower layers
Source§

fn _apply_deltas( &mut self, deltas: GenericArray<f32, Neurons>, inputs: &GenericArray<f32, Input>, speed: f32, )

modifies own weights by given deltas
Source§

fn _pre_error( &self, deltas: &GenericArray<f32, Neurons>, ) -> GenericArray<f32, Input>

calculates the previous layers errors from this layers errors and weights
Source§

fn backprop( &mut self, input: &GenericArray<f32, Input>, correct_output: &GenericArray<f32, FinalOut>, speed: f32, ) -> (GenericArray<f32, Input>, GenericArray<f32, FinalOut>)

pass in the input and the expected output. calculates the error for each neuron and corrects itself speed should be 0..1 and modifies how strongly the weights are adjusted
Source§

fn _weight_errors( &self, error: GenericArray<f32, Neurons>, weighted_inputs: &GenericArray<f32, Neurons>, ) -> GenericArray<f32, Neurons>

weights errors relative to activation. gets called by backprop, don’t call this manually
Source§

fn teach<F: FnMut(usize, f32), I: IntoIterator<Item = (GenericArray<f32, Input>, GenericArray<f32, FinalOut>)>>( &mut self, lesson: I, iterations: usize, callback: F, )
where <I as IntoIterator>::IntoIter: Clone,

Source§

impl<A: Activation, Neurons, Input> Serialize for OutputLayer<A, Neurons, Input>
where Neurons: NL<Input>, Input: AL,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<A, Neurons, Input> Freeze for OutputLayer<A, Neurons, Input>
where <Neurons as ArrayLength<GenericArray<f32, Input>>>::ArrayType: Freeze, <Neurons as ArrayLength<f32>>::ArrayType: Freeze,

§

impl<A, Neurons, Input> RefUnwindSafe for OutputLayer<A, Neurons, Input>

§

impl<A, Neurons, Input> Send for OutputLayer<A, Neurons, Input>
where A: Send,

§

impl<A, Neurons, Input> Sync for OutputLayer<A, Neurons, Input>
where A: Sync,

§

impl<A, Neurons, Input> Unpin for OutputLayer<A, Neurons, Input>
where <Neurons as ArrayLength<GenericArray<f32, Input>>>::ArrayType: Unpin, <Neurons as ArrayLength<f32>>::ArrayType: Unpin, A: Unpin,

§

impl<A, Neurons, Input> UnwindSafe for OutputLayer<A, Neurons, Input>
where <Neurons as ArrayLength<GenericArray<f32, Input>>>::ArrayType: UnwindSafe, <Neurons as ArrayLength<f32>>::ArrayType: UnwindSafe, A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

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