StandardModelConfig

Struct StandardModelConfig 

Source
pub struct StandardModelConfig<T> {
    pub batch_size: usize,
    pub epochs: usize,
    pub hyperspace: HashMap<String, T>,
}
Expand description

The StandardModelConfig struct is a standard implementation of the

Fields§

§batch_size: usize§epochs: usize§hyperspace: HashMap<String, T>

Implementations§

Source§

impl<T> StandardModelConfig<T>

Source

pub fn new() -> Self

Source

pub const fn batch_size(&self) -> usize

returns a copy of the batch size

Source

pub const fn batch_size_mut(&mut self) -> &mut usize

returns a mutable reference to the batch size

Source

pub const fn epochs(&self) -> usize

returns a copy of the epochs

Source

pub const fn epochs_mut(&mut self) -> &mut usize

returns a mutable reference to the epochs

Source

pub const fn hyperparameters(&self) -> &HashMap<String, T>

returns a reference to the hyperparameters map

Source

pub const fn hyperparameters_mut(&mut self) -> &mut HashMap<String, T>

returns a mutable reference to the hyperparameters map

Source

pub fn add_parameter<K: ToString>(&mut self, key: K, value: T) -> Option<T>

inserts a hyperparameter into the map, returning the previous value if it exists

Source

pub fn get<Q>(&self, key: &Q) -> Option<&T>
where Q: ?Sized + Eq + Hash, String: Borrow<Q>,

gets a reference to a hyperparameter by key, returning None if it does not exist

Source

pub fn parameter<Q: ToString>( &mut self, key: Q, ) -> Entry<'_, String, T, DefaultHashBuilder>

returns an entry for the hyperparameter, allowing for insertion or modification

Source

pub fn remove_hyperparameter<Q>(&mut self, key: &Q) -> Option<T>
where Q: ?Sized + Hash + Eq, String: Borrow<Q>,

removes a hyperparameter from the map, returning the value if it exists

Source

pub fn set_batch_size(&mut self, batch_size: usize) -> &mut Self

sets the batch size, returning a mutable reference to the current instance

Source

pub fn set_epochs(&mut self, epochs: usize) -> &mut Self

sets the number of epochs, returning a mutable reference to the current instance

Source

pub fn with_batch_size(self, batch_size: usize) -> Self

consumes the current instance to create another with the given batch size

Source

pub fn with_epochs(self, epochs: usize) -> Self

consumes the current instance to create another with the given epochs

Source§

impl<T> StandardModelConfig<T>

Source

pub fn set_decay(&mut self, decay: T) -> Option<T>

sets the decay hyperparameter, returning the previous value if it exists

Source

pub fn set_learning_rate(&mut self, learning_rate: T) -> Option<T>

Source

pub fn set_momentum(&mut self, momentum: T) -> Option<T>

sets the momentum hyperparameter, returning the previous value if it exists

Source

pub fn set_weight_decay(&mut self, decay: T) -> Option<T>

sets the weight decay hyperparameter, returning the previous value if it exists

Source

pub fn learning_rate(&self) -> Option<&T>

returns a reference to the learning rate hyperparameter, if it exists

Source

pub fn momentum(&self) -> Option<&T>

returns a reference to the momentum hyperparameter, if it exists

Source

pub fn decay(&self) -> Option<&T>

returns a reference to the decay hyperparameter, if it exists

Source

pub fn weight_decay(&self) -> Option<&T>

returns a reference to the weight decay hyperparameter, if it exists

Trait Implementations§

Source§

impl<T: Clone> Clone for StandardModelConfig<T>

Source§

fn clone(&self) -> StandardModelConfig<T>

Returns a duplicate 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<T: Debug> Debug for StandardModelConfig<T>

Source§

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

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

impl<T> Default for StandardModelConfig<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> ExtendedModelConfig<T> for StandardModelConfig<T>

Source§

fn epochs(&self) -> usize

Source§

fn batch_size(&self) -> usize

Source§

fn learning_rate(&self) -> Option<&T>

Source§

fn epsilon(&self) -> Option<&T>

Source§

fn momentum(&self) -> Option<&T>

Source§

fn weight_decay(&self) -> Option<&T>

Source§

fn dropout(&self) -> Option<&T>

Source§

fn decay(&self) -> Option<&T>

Source§

fn beta(&self) -> Option<&T>

Source§

fn beta1(&self) -> Option<&T>

Source§

fn beta2(&self) -> Option<&T>

Source§

impl<T> ModelConfiguration<T> for StandardModelConfig<T>

Source§

fn get<K>(&self, key: K) -> Option<&T>
where K: AsRef<str>,

Source§

fn get_mut<K>(&mut self, key: K) -> Option<&mut T>
where K: AsRef<str>,

Source§

fn set<K>(&mut self, key: K, value: T) -> Option<T>
where K: AsRef<str>,

Source§

fn remove<K>(&mut self, key: K) -> Option<T>
where K: AsRef<str>,

Source§

fn contains<K>(&self, key: K) -> bool
where K: AsRef<str>,

Source§

fn keys(&self) -> Vec<&str>

Source§

impl<T> NetworkConfig<String, T> for StandardModelConfig<T>

Source§

type Store = HashMap<String, T>

the type of key-value store used to handle the hyperparameters of the network
Source§

fn store(&self) -> &Self::Store

returns a reference to the key-value store
Source§

fn store_mut(&mut self) -> &mut Self::Store

returns a mutable reference to the key-value store
Source§

fn get<'a>(&'a self, key: &K) -> Option<&'a V>
where Self::Store: 'a,

get a reference to a value in the store by key
Source§

fn get_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>
where Self::Store: 'a + RawStoreMut<K, V>,

returns a mutable reference to a value in the store by key
Source§

fn hyperparam<'a>( &'a mut self, key: K, ) -> <Self::Store as Store<K, V>>::Entry<'a>
where Self::Store: 'a + Store<K, V>,

returns the entry associated with the given key
Source§

impl<T> RawConfig for StandardModelConfig<T>

Source§

type Ctx = T

Source§

impl<T> Send for StandardModelConfig<T>
where T: Send,

Source§

impl<T> Sync for StandardModelConfig<T>
where T: Sync,

Auto Trait Implementations§

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> 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.