pub struct GrowingNeuralGas {
pub lr_winner: f64,
pub lr_neighbor: f64,
pub max_age: usize,
pub insert_interval: usize,
pub alpha: f64,
pub beta: f64,
pub max_units: usize,
pub max_steps: usize,
pub seed: u64,
}Expand description
Growing Neural Gas — adaptive topology competitive learning.
The GNG starts with two prototype units and grows by inserting new nodes
between the highest-error nodes. Edges age and are removed when their age
exceeds max_age. No a priori unit count is needed.
Reference: Fritzke (1995).
Fields§
§lr_winner: f64Learning rate for the winner unit. Default 0.1.
lr_neighbor: f64Learning rate for topological neighbours. Default 0.01.
max_age: usizeMaximum edge age before removal. Default 50.
insert_interval: usizeSteps between node insertions. Default 100.
alpha: f64Error reduction factor applied to nodes after insertion. Default 0.5.
beta: f64Global error decay per step. Default 0.995.
max_units: usizeUpper bound on the number of units. Default 200.
max_steps: usizeTotal training steps. Default 5000.
seed: u64RNG seed. Default 42.
Implementations§
Source§impl GrowingNeuralGas
impl GrowingNeuralGas
Sourcepub fn new(
lr_winner: f64,
lr_neighbor: f64,
max_age: usize,
insert_interval: usize,
alpha: f64,
beta: f64,
max_units: usize,
max_steps: usize,
seed: u64,
) -> Self
pub fn new( lr_winner: f64, lr_neighbor: f64, max_age: usize, insert_interval: usize, alpha: f64, beta: f64, max_units: usize, max_steps: usize, seed: u64, ) -> Self
Create a new GNG with all hyperparameters specified.
Sourcepub fn fit(&self, data: ArrayView2<'_, f64>) -> Result<GrowingNeuralGasModel>
pub fn fit(&self, data: ArrayView2<'_, f64>) -> Result<GrowingNeuralGasModel>
Fit the GNG model to data.
§Arguments
data– Data matrix(n_samples, n_features).
§Returns
A GrowingNeuralGasModel with the learned topology and assignments.
Trait Implementations§
Source§impl Clone for GrowingNeuralGas
impl Clone for GrowingNeuralGas
Source§fn clone(&self) -> GrowingNeuralGas
fn clone(&self) -> GrowingNeuralGas
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrowingNeuralGas
impl Debug for GrowingNeuralGas
Auto Trait Implementations§
impl Freeze for GrowingNeuralGas
impl RefUnwindSafe for GrowingNeuralGas
impl Send for GrowingNeuralGas
impl Sync for GrowingNeuralGas
impl Unpin for GrowingNeuralGas
impl UnsafeUnpin for GrowingNeuralGas
impl UnwindSafe for GrowingNeuralGas
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable 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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.