public class NeuralGas extends java.lang.Object implements VectorQuantizer
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.
KMeans
,
GrowingNeuralGas
,
SOM
,
Serialized FormOUTLIER
Constructor and Description |
---|
NeuralGas(double[][] neurons,
smile.math.TimeFunction alpha,
smile.math.TimeFunction theta,
int lifetime)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
smile.graph.Graph |
network()
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.
|
public NeuralGas(double[][] neurons, smile.math.TimeFunction alpha, smile.math.TimeFunction theta, int lifetime)
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.public static double[][] seed(int k, double[][] samples)
k
- the number of neurons.samples
- some samples to select initial weight vectors.public double[][] neurons()
public smile.graph.Graph network()
public void update(double[] x)
VectorQuantizer
update
in interface VectorQuantizer
public double[] quantize(double[] x)
VectorQuantizer
quantize
in interface VectorQuantizer
x
- a new observation.