graphclust.vq.GrowingNeuralGas#

class graphclust.vq.GrowingNeuralGas(max_nodes=100, *, max_iter=None, eps_b=0.05, eps_n=0.006, max_age=50, lambda_=100, alpha=0.5, d=0.995, init='sample', random_state=None)[source]#

Bases: BaseTopologyLearner

Growing neural gas (GNG; Fritzke 1995).

Starts with two nodes and grows: the winner \(s_1\) of each drawn sample accumulates the squared error, moves towards the sample with step \(\varepsilon_b\), its graph neighbors with \(\varepsilon_n\); \(s_1\) and the second nearest node \(s_2\) are linked (age 0), edges older than max_age are deleted together with the nodes left isolated, and every lambda_ steps a new node is inserted halfway between the node \(q\) with the largest error and its neighbor \(f\) with the largest error. Errors decay by alpha at insertion and by d in every step. Training stops after max_iter steps or when max_nodes is reached.