pub struct SurfaceNetwork<T = f32> { /* private fields */ }Expand description
A neural network capable of dynamic configuration. Essentially, each network is designed to materialize the surface of a 2-simplex (triad) using barycentric coordinates to define three critical points. These critical points define the minimum number of hidden layers within the network and serve as goalposts that guide the learning process. The remaining points continue this trend, simply mapping each extra hidden layer to another position within space. The verticies of the simplex are used to inform the input layer and in finding the centroid of the facet. The centroid defines the output layer of the facet, serving as the final piece in a pseudo sink-source dyanamic.
Implementations§
Source§impl<A> SurfaceNetwork<A>where
A: FromPrimitive + ScalarOperand,
impl<A> SurfaceNetwork<A>where
A: FromPrimitive + ScalarOperand,
Sourcepub fn add_critical_point(&mut self, kind: PointKind) -> &mut Selfwhere
A: Float,
pub fn add_critical_point(&mut self, kind: PointKind) -> &mut Selfwhere
A: Float,
Add a new critical point to configure part of the network’s hidden layer
Sourcepub fn predict<X, Y>(&self, input: &X) -> Result<Y, NeuralError>where
SurfaceModel<A>: Predict<X, Output = Y>,
pub fn predict<X, Y>(&self, input: &X) -> Result<Y, NeuralError>where
SurfaceModel<A>: Predict<X, Output = Y>,
forward propogate the given input through the network
Sourcepub fn train<X, Y, Z>(
&mut self,
input: &X,
expected: &Y,
) -> Result<Z, NeuralError>where
A: Float + FromPrimitive + NumAssign + ScalarOperand + FftNum,
SurfaceModel<A>: Train<X, Y, Output = Z>,
pub fn train<X, Y, Z>(
&mut self,
input: &X,
expected: &Y,
) -> Result<Z, NeuralError>where
A: Float + FromPrimitive + NumAssign + ScalarOperand + FftNum,
SurfaceModel<A>: Train<X, Y, Output = Z>,
perform a single backpropagation step on qualifing datasets
Sourcepub fn get_centroid(&self) -> Option<[A; 2]>where
A: Float + FromPrimitive,
pub fn get_centroid(&self) -> Option<[A; 2]>where
A: Float + FromPrimitive,
get the position of the centroid w.r.t the headspace
Sourcepub fn get_position(&self, cp_index: usize) -> Option<[A; 3]>
pub fn get_position(&self, cp_index: usize) -> Option<[A; 3]>
returns the position of a particular hidden layer w.r.t. the current headspace
Sourcepub fn init(self) -> Selfwhere
SurfaceModel<A>: Init,
pub fn init(self) -> Selfwhere
SurfaceModel<A>: Init,
initialize the network
Sourcepub fn init_inplace(&mut self) -> &mut Selfwhere
SurfaceModel<A>: InitInplace,
pub fn init_inplace(&mut self) -> &mut Selfwhere
SurfaceModel<A>: InitInplace,
initialize the network in-place
Sourcepub fn predict_with_confidence<X, Y>(
&self,
input: &X,
) -> Result<(Y, <SurfaceModel<A> as PredictWithConfidence<X>>::Confidence), NeuralError>where
SurfaceModel<A>: PredictWithConfidence<X, Output = Y>,
pub fn predict_with_confidence<X, Y>(
&self,
input: &X,
) -> Result<(Y, <SurfaceModel<A> as PredictWithConfidence<X>>::Confidence), NeuralError>where
SurfaceModel<A>: PredictWithConfidence<X, Output = Y>,
returns the model’s prediction with a confidence value
Sourcepub fn reconfigure(&mut self, next: Triad)where
A: Float,
pub fn reconfigure(&mut self, next: Triad)where
A: Float,
reconfigure the network with respect to the given triad; the method is typically called after applying a transformation to the headspace
Sourcepub fn transfer_knowledge_from(&mut self, other: &Self, adaptation_rate: A)
pub fn transfer_knowledge_from(&mut self, other: &Self, adaptation_rate: A)
Transfer knowledge from another surface network
Sourcepub fn transform(&mut self, transform: LPR) -> SurfaceResult<()>where
A: Float,
pub fn transform(&mut self, transform: LPR) -> SurfaceResult<()>where
A: Float,
applies the given LPR transformation to the headspace of the network before applying the neccessary adjusments to the architecture.
Sourcepub fn walk<I>(&mut self, iter: I) -> SurfaceResult<()>
pub fn walk<I>(&mut self, iter: I) -> SurfaceResult<()>
Walk the network through a series of transformations
Source§impl<T> SurfaceNetwork<T>
impl<T> SurfaceNetwork<T>
Sourcepub fn new(headspace: Triad) -> Selfwhere
T: Float + FromPrimitive,
pub fn new(headspace: Triad) -> Selfwhere
T: Float + FromPrimitive,
Create a new surface network for the given triad
Sourcepub const fn headspace(&self) -> Triad
pub const fn headspace(&self) -> Triad
returns an immutable reference to the network’s headspace
Sourcepub fn headspace_mut(&mut self) -> &mut Triad
pub fn headspace_mut(&mut self) -> &mut Triad
returns a mutable reference to the network’s headspace
Sourcepub const fn model(&self) -> &SurfaceModel<T>
pub const fn model(&self) -> &SurfaceModel<T>
returns an immutable reference to the network’s surface
Sourcepub fn model_mut(&mut self) -> &mut SurfaceModel<T>
pub fn model_mut(&mut self) -> &mut SurfaceModel<T>
returns a mutable reference to the network’s surface
Sourcepub const fn points(&self) -> &Vec<Point<T>>
pub const fn points(&self) -> &Vec<Point<T>>
returns an immutable reference to the network’s critical points
Sourcepub fn points_mut(&mut self) -> &mut Vec<Point<T>>
pub fn points_mut(&mut self) -> &mut Vec<Point<T>>
returns a mutable reference to the network’s critical points
Sourcepub const fn input(&self) -> &Params<T>
pub const fn input(&self) -> &Params<T>
returns an immutable reference to the network’s primary weights
Sourcepub fn input_mut(&mut self) -> &mut Params<T>
pub fn input_mut(&mut self) -> &mut Params<T>
returns a mutable reference to the network’s primary weights
Sourcepub const fn input_bias(&self) -> &Array1<T>
pub const fn input_bias(&self) -> &Array1<T>
returns an immutable reference to the model’s input layer bias
Sourcepub fn input_bias_mut(&mut self) -> &mut Array1<T>
pub fn input_bias_mut(&mut self) -> &mut Array1<T>
returns a mutable reference to the model’s input layer bias
Sourcepub const fn input_weights(&self) -> &Array2<T>
pub const fn input_weights(&self) -> &Array2<T>
returns an immutable reference to the model’s input layer weights
Sourcepub fn input_weights_mut(&mut self) -> &mut Array2<T>
pub fn input_weights_mut(&mut self) -> &mut Array2<T>
returns a mutable reference to the model’s input layer weights
returns an immutable reference to the model’s hidden layers
returns a mutable reference to the model’s hidden layers
Sourcepub const fn output(&self) -> &Params<T>
pub const fn output(&self) -> &Params<T>
returns an immutable reference to the network’s secondary weights
Sourcepub fn output_mut(&mut self) -> &mut Params<T>
pub fn output_mut(&mut self) -> &mut Params<T>
returns a mutable reference to the network’s secondary weights
Sourcepub const fn output_bias(&self) -> &Array1<T>
pub const fn output_bias(&self) -> &Array1<T>
returns an immutable reference to the model’s output layer bias
Sourcepub fn output_bias_mut(&mut self) -> &mut Array1<T>
pub fn output_bias_mut(&mut self) -> &mut Array1<T>
returns a mutable reference to the model’s output layer bias
Sourcepub const fn output_weights(&self) -> &Array2<T>
pub const fn output_weights(&self) -> &Array2<T>
returns an immutable reference to the model’s output layer weights
Sourcepub fn output_weights_mut(&mut self) -> &mut Array2<T>
pub fn output_weights_mut(&mut self) -> &mut Array2<T>
returns a mutable reference to the model’s output layer weights
pub fn extend_surface<I>(&mut self, iter: I)where
I: IntoIterator<Item = Point<T>>,
Sourcepub fn set_points<I>(&mut self, iter: I)where
I: IntoIterator<Item = Point<T>>,
pub fn set_points<I>(&mut self, iter: I)where
I: IntoIterator<Item = Point<T>>,
set the critical points of the network
Sourcepub fn with_attention(self) -> Selfwhere
T: FromPrimitive,
pub fn with_attention(self) -> Selfwhere
T: FromPrimitive,
enable the attention mechanism in the model
Sourcepub fn with_points<I>(self, iter: I) -> Selfwhere
I: IntoIterator<Item = Point<T>>,
pub fn with_points<I>(self, iter: I) -> Selfwhere
I: IntoIterator<Item = Point<T>>,
consumes the current instance and returns another with the given points
Trait Implementations§
Source§impl<T: Clone> Clone for SurfaceNetwork<T>
impl<T: Clone> Clone for SurfaceNetwork<T>
Source§fn clone(&self) -> SurfaceNetwork<T>
fn clone(&self) -> SurfaceNetwork<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for SurfaceNetwork<T>
impl<T: Debug> Debug for SurfaceNetwork<T>
Source§impl<A, X, Y> Forward<X> for SurfaceNetwork<A>where
A: Float + FromPrimitive + NumAssign + ScalarOperand,
SurfaceModel<A>: Forward<X, Output = Y>,
impl<A, X, Y> Forward<X> for SurfaceNetwork<A>where
A: Float + FromPrimitive + NumAssign + ScalarOperand,
SurfaceModel<A>: Forward<X, Output = Y>,
type Output = Y
Source§fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
Source§impl<T> PartialEq for SurfaceNetwork<T>
impl<T> PartialEq for SurfaceNetwork<T>
Source§impl<A, X, Y, Z> Train<X, Y> for SurfaceNetwork<A>where
A: Float + FromPrimitive + NumAssign + ScalarOperand,
SurfaceModel<A>: Train<X, Y, Output = Z>,
impl<A, X, Y, Z> Train<X, Y> for SurfaceNetwork<A>where
A: Float + FromPrimitive + NumAssign + ScalarOperand,
SurfaceModel<A>: Train<X, Y, Output = Z>,
Auto Trait Implementations§
impl<T> Freeze for SurfaceNetwork<T>where
T: Freeze,
impl<T> RefUnwindSafe for SurfaceNetwork<T>where
T: RefUnwindSafe,
impl<T> Send for SurfaceNetwork<T>where
T: Send,
impl<T> Sync for SurfaceNetwork<T>where
T: Sync,
impl<T> Unpin for SurfaceNetwork<T>where
T: Unpin,
impl<T> UnwindSafe for SurfaceNetwork<T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more