#[non_exhaustive]pub enum ActivationFunction {
Sigmoid,
Tanh,
ReLU,
BinaryStep,
Identity,
}Expand description
The function a layer applies to each neuron’s weighted sum.
Every layer of a crate::NeuralNetwork has its own, so hidden layers and the
output layer can differ: a common choice is ReLU or
Tanh for hidden layers, with Tanh for outputs in
[-1, 1], Sigmoid for outputs in [0, 1], or
Identity for unbounded outputs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Sigmoid
1 / (1 + e^-x), in (0, 1).
Tanh
tanh(x), in (-1, 1).
ReLU
max(x, 0).
BinaryStep
1 for x >= 0, else 0.
Identity
x, unchanged.
Implementations§
Trait Implementations§
Source§impl Clone for ActivationFunction
impl Clone for ActivationFunction
impl Copy for ActivationFunction
Source§impl Debug for ActivationFunction
impl Debug for ActivationFunction
Source§impl Default for ActivationFunction
impl Default for ActivationFunction
Source§impl<'de> Deserialize<'de> for ActivationFunction
impl<'de> Deserialize<'de> for ActivationFunction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ActivationFunction
Source§impl Hash for ActivationFunction
impl Hash for ActivationFunction
Source§impl PartialEq for ActivationFunction
impl PartialEq for ActivationFunction
Source§impl Serialize for ActivationFunction
impl Serialize for ActivationFunction
impl StructuralPartialEq for ActivationFunction
Auto Trait Implementations§
impl Freeze for ActivationFunction
impl RefUnwindSafe for ActivationFunction
impl Send for ActivationFunction
impl Sync for ActivationFunction
impl Unpin for ActivationFunction
impl UnsafeUnpin for ActivationFunction
impl UnwindSafe for ActivationFunction
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.