pub struct ModelFeatures { /* private fields */ }Expand description
The ModelFeatures provides a common way of defining the layout of a model. This is
used to define the number of input features, the number of hidden layers, the number of
hidden features, and the number of output features.
Implementations§
Source§impl ModelFeatures
impl ModelFeatures
pub fn from_shape_and_size(shape: &[usize], size: usize) -> Self
Sourcepub const fn new(
input: usize,
hidden: usize,
output: usize,
layers: usize,
) -> Self
pub const fn new( input: usize, hidden: usize, output: usize, layers: usize, ) -> Self
creates a new instance of ModelFeatures for a neural network with n layers. If
the number of layers is <=1 then the ModelFormat is automatically
configured as a shallow neural network.
Sourcepub const fn deep(
input: usize,
hidden: usize,
output: usize,
layers: usize,
) -> Self
pub const fn deep( input: usize, hidden: usize, output: usize, layers: usize, ) -> Self
creates a new instance of ModelFeatures for a deep neural network, using the given
input, hidden, and output features with the given number of hidden layers
Sourcepub const fn shallow(input: usize, hidden: usize, output: usize) -> Self
pub const fn shallow(input: usize, hidden: usize, output: usize) -> Self
returns a new instance of ModelFeatures for a shallow neural network, using the
given features for the input, output, and single hidden layer
pub fn from_layout<L>(layout: L) -> Selfwhere
L: RawModelLayout,
Sourcepub const fn input_mut(&mut self) -> &mut usize
pub const fn input_mut(&mut self) -> &mut usize
returns a mutable reference to the input features for the model
Sourcepub const fn inner(&self) -> ModelFormat
pub const fn inner(&self) -> ModelFormat
returns a copy of the inner format for the model
Sourcepub const fn inner_mut(&mut self) -> &mut ModelFormat
pub const fn inner_mut(&mut self) -> &mut ModelFormat
returns a mutable reference to the inner format for the model
returns a copy of the hidden features for the model
returns a mutable reference to the hidden features for the model
Sourcepub const fn layers(&self) -> usize
pub const fn layers(&self) -> usize
returns a copy of the number of hidden layers for the model
Sourcepub const fn layers_mut(&mut self) -> &mut usize
pub const fn layers_mut(&mut self) -> &mut usize
returns a mutable reference to the number of hidden layers for the model
Sourcepub const fn output_mut(&mut self) -> &mut usize
pub const fn output_mut(&mut self) -> &mut usize
returns a mutable reference to the output features for the model
sets the hidden features for the model
Sourcepub fn set_layers(&mut self, layers: usize) -> &mut Self
pub fn set_layers(&mut self, layers: usize) -> &mut Self
sets the number of hidden layers for the model
Sourcepub fn set_output(&mut self, output: usize) -> &mut Self
pub fn set_output(&mut self, output: usize) -> &mut Self
sets the output features for the model
Sourcepub fn with_input(self, input: usize) -> Self
pub fn with_input(self, input: usize) -> Self
consumes the current instance and returns a new instance with the given input
consumes the current instance and returns a new instance with the given hidden features
Sourcepub fn with_layers(self, layers: usize) -> Self
pub fn with_layers(self, layers: usize) -> Self
consumes the current instance and returns a new instance with the given number of hidden layers
Sourcepub fn with_output(self, output: usize) -> Self
pub fn with_output(self, output: usize) -> Self
consumes the current instance and returns a new instance with the given output features
the dimension of the hidden layers; (hidden, hidden)
Sourcepub fn dim_output(&self) -> (usize, usize)
pub fn dim_output(&self) -> (usize, usize)
the dimension of the output layer; (hidden, output)
Sourcepub fn size_input(&self) -> usize
pub fn size_input(&self) -> usize
the total number of input parameters in the model
the total number of hidden parameters in the model
Sourcepub fn size_output(&self) -> usize
pub fn size_output(&self) -> usize
the total number of output parameters in the model
Trait Implementations§
Source§impl Clone for ModelFeatures
impl Clone for ModelFeatures
Source§fn clone(&self) -> ModelFeatures
fn clone(&self) -> ModelFeatures
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelFeatures
impl Debug for ModelFeatures
Source§impl Default for ModelFeatures
impl Default for ModelFeatures
Source§impl Display for ModelFeatures
impl Display for ModelFeatures
Source§impl Hash for ModelFeatures
impl Hash for ModelFeatures
Source§impl Ord for ModelFeatures
impl Ord for ModelFeatures
Source§fn cmp(&self, other: &ModelFeatures) -> Ordering
fn cmp(&self, other: &ModelFeatures) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ModelFeatures
impl PartialEq for ModelFeatures
Source§impl PartialOrd for ModelFeatures
impl PartialOrd for ModelFeatures
Source§impl RawModelLayout for ModelFeatures
impl RawModelLayout for ModelFeatures
Source§fn dim_output(&self) -> (usize, usize)
fn dim_output(&self) -> (usize, usize)
Source§fn size_input(&self) -> usize
fn size_input(&self) -> usize
Source§fn size_output(&self) -> usize
fn size_output(&self) -> usize
Source§impl RawModelLayoutMut for ModelFeatures
impl RawModelLayoutMut for ModelFeatures
Source§fn input_mut(&mut self) -> &mut usize
fn input_mut(&mut self) -> &mut usize
Source§fn layers_mut(&mut self) -> &mut usize
fn layers_mut(&mut self) -> &mut usize
Source§fn output_mut(&mut self) -> &mut usize
fn output_mut(&mut self) -> &mut usize
Source§fn set_input(&mut self, input: usize) -> &mut Self
fn set_input(&mut self, input: usize) -> &mut Self
Source§fn set_layers(&mut self, layers: usize) -> &mut Self
fn set_layers(&mut self, layers: usize) -> &mut Self
Source§fn set_output(&mut self, output: usize) -> &mut Self
fn set_output(&mut self, output: usize) -> &mut Self
impl Copy for ModelFeatures
impl Eq for ModelFeatures
impl StructuralPartialEq for ModelFeatures
Auto Trait Implementations§
impl Freeze for ModelFeatures
impl RefUnwindSafe for ModelFeatures
impl Send for ModelFeatures
impl Sync for ModelFeatures
impl Unpin for ModelFeatures
impl UnwindSafe for ModelFeatures
Blanket Implementations§
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.