graphclust.vq.NeuralGas#

class graphclust.vq.NeuralGas(n_nodes=50, *, max_iter=None, eps=(0.3, 0.05), lam=None, init='range', random_state=None)[source]#

Bases: BaseTopologyLearner

Neural gas vector quantization (Martinetz and Schulten 1991).

In each iteration a random sample \(\mathbf{x}\) is drawn, the nodes are ranked by their distance to it (\(r_j=0\) for the nearest) and all of them move towards the sample,

\[\mathbf{w}_j \leftarrow \mathbf{w}_j + \varepsilon(t)\,e^{-r_j/\lambda(t)}(\mathbf{x}-\mathbf{w}_j),\]

with exponentially decreasing step size \(\varepsilon\) and neighborhood range \(\lambda\). The rank-based soft competition makes neural gas far less sensitive to its initialization than k-means. Neural gas itself learns no graph; TopologyRepresentingNetwork adds one.

Parameters:
n_nodesint, default=50
max_iterint, optional

Number of adaptation steps \(t_{\max}\) (default 200 * n_nodes).

eps(float, float), default=(0.3, 0.05)

Initial and final step size.

lam(float, float), optional

Initial and final neighborhood range (default (0.2 * n_nodes, 0.01)).

init{“range”, “sample”} or ndarray, default=”range”
random_stateint, RandomState or None