smile.vq
Class NeuralMap
- java.lang.Object
-
- smile.vq.NeuralMap
-
- All Implemented Interfaces:
- Clustering<double[]>
public class NeuralMap extends java.lang.Object implements Clustering<double[]>
NeuralMap is an efficient competitive learning algorithm inspired by growing neural gas and BIRCH. Like growing neural gas, NeuralMap has the ability to add and delete neurons with competitive Hebbian learning. Edges exist between neurons close to each other. Such edges are intended place holders for localized data distribution. Such edges also help to locate distinct clusters (those clusters are not connected by edges). NeuralMap employs Locality-Sensitive Hashing to speedup the learning while BIRCH uses balanced CF trees.- See Also:
NeuralGas,GrowingNeuralGas,BIRCH
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classNeuralMap.NeuronThe neurons in the network.
-
Field Summary
-
Fields inherited from interface smile.clustering.Clustering
OUTLIER
-
-
Constructor Summary
Constructors Constructor and Description NeuralMap(int d, double r, double epsBest, double epsNeighbor, int L, int k)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.List<NeuralMap.Neuron>neurons()Returns the set of neurons.voidpartition(int k)Clustering neurons into k clusters.intpartition(int k, int minPts)Clustering neurons into k clusters.intpredict(double[] x)Cluster a new instance to the nearest neuron.intpurge(int minPts)Removes neurons with the number of samples less than a given threshold.voidupdate(double[] x)Update the network with a new signal.
-
-
-
Constructor Detail
-
NeuralMap
public NeuralMap(int d, double r, double epsBest, double epsNeighbor, int L, int k)Constructor.- Parameters:
d- the dimensionality of signals.r- the distance radius to activate a neuron for a given signal.epsBest- the fraction to update activated neuron.epsNeighbor- the fraction to update neighbors of activated neuron.L- the number of hash tables.k- the number of random projection hash functions.
-
-
Method Detail
-
update
public void update(double[] x)
Update the network with a new signal.
-
neurons
public java.util.List<NeuralMap.Neuron> neurons()
Returns the set of neurons.
-
purge
public int purge(int minPts)
Removes neurons with the number of samples less than a given threshold. The neurons without neighbors will also be removed.- Parameters:
minPts- neurons will be removed if the number of its points is less than minPts.- Returns:
- the number of neurons after purging.
-
partition
public void partition(int k)
Clustering neurons into k clusters.- Parameters:
k- the number of clusters.
-
partition
public int partition(int k, int minPts)Clustering neurons into k clusters.- Parameters:
k- the number of clusters.minPts- a neuron will be treated as outlier if the number of its points is less than minPts.- Returns:
- the number of non-outlier leaves.
-
predict
public int predict(double[] x)
Cluster a new instance to the nearest neuron. The method partition() should be called first.- Specified by:
predictin interfaceClustering<double[]>- Parameters:
x- a new instance.- Returns:
- the cluster label of nearest neuron.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG