Package smile.vq
Class NeuralGas
java.lang.Object
smile.vq.NeuralGas
- All Implemented Interfaces:
Serializable
,VectorQuantizer
Neural Gas soft competitive learning algorithm. Neural Gas is inspired
by the Self-Organizing Map (SOM) for finding optimal data representations
based on feature vectors. The algorithm was coined "Neural Gas" because of
the dynamics of the feature vectors during the adaptation process, which
distribute themselves like a gas within the data space. Although it is
mainly applied where data compression or vector quantization is an issue,
it is also used for cluster analysis as a robustly converging alternative
to k-means. A prominent extension is the Growing Neural Gas.
Compared to SOM, Neural Gas has no topology of a fixed dimensionality (in fact, no topology at all). For each input signal during learning, Neural Gas sorts the neurons of the network according to the distance of their reference vectors to the input signal. Based on this "rank order", neurons are adapted based on the adaptation strength that are decreased according to a fixed schedule.
The adaptation step of the Neural Gas can be interpreted as gradient descent on a cost function. By adapting not only the closest feature vector but all of them with a step size decreasing with increasing distance order, compared to k-means, a much more robust convergence of the algorithm can be achieved.
References
- Thomas Martinetz and Klaus Schulten. A "neural gas" network learns topologies. Artificial Neural Networks, 397-402, 1991.
- T. Martinetz, S. Berkovich, and K. Schulten. "Neural-gas" Network for Vector Quantization and its Application to Time-Series Prediction. IEEE Trans. on Neural Networks, 4(4):558-569, 1993.
- T. Martinetz and K. Schulten. Topology representing networks. Neural Networks, 7(3):507-522, 1994.
- See Also:
-
Field Summary
Fields inherited from interface smile.vq.VectorQuantizer
OUTLIER
-
Constructor Summary
ConstructorDescriptionNeuralGas
(double[][] neurons, TimeFunction alpha, TimeFunction theta, TimeFunction lifetime) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionnetwork()
Returns the network of neurons.double[][]
neurons()
Returns the neurons.double[]
quantize
(double[] x) Quantize a new observation.static double[][]
seed
(int k, double[][] samples) Selects random samples as initial neurons of Neural Gas.void
update
(double[] x) Update the codebook with a new observation.
-
Constructor Details
-
NeuralGas
Constructor.- Parameters:
neurons
- the initial neurons.alpha
- the learning rate function.theta
- the neighborhood function.lifetime
- the neuron connection lifetime, usually the number of iterations for one or two epochs.
-
-
Method Details
-
seed
public static double[][] seed(int k, double[][] samples) Selects random samples as initial neurons of Neural Gas.- Parameters:
k
- the number of neurons.samples
- some samples to select initial weight vectors.- Returns:
- the initial neurons.
-
neurons
public double[][] neurons()Returns the neurons.- Returns:
- the neurons.
-
network
Returns the network of neurons.- Returns:
- the network of neurons.
-
update
public void update(double[] x) Description copied from interface:VectorQuantizer
Update the codebook with a new observation.- Specified by:
update
in interfaceVectorQuantizer
- Parameters:
x
- a new observation.
-
quantize
public double[] quantize(double[] x) Description copied from interface:VectorQuantizer
Quantize a new observation. Returns Optional.empty if the observation is noise.- Specified by:
quantize
in interfaceVectorQuantizer
- Parameters:
x
- a new observation.- Returns:
- the quantized vector.
-