|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.cluster.Clusterer cc.mallet.cluster.KMeans
public class KMeans
KMeans Clusterer
Clusters the points into k clusters by minimizing the total intra-cluster
variance. It uses a given Metric
to find the distance between
Instance
s, which should have SparseVector
s in the data
field.
Field Summary | |
---|---|
static int |
EMPTY_DROP
Drop an empty cluster |
static int |
EMPTY_ERROR
Treat an empty cluster as an error condition. |
static int |
EMPTY_SINGLE
Place the single instance furthest from the previous cluster mean |
Constructor Summary | |
---|---|
KMeans(Pipe instancePipe,
int numClusters,
Metric metric)
Construct a KMeans object |
|
KMeans(Pipe instancePipe,
int numClusters,
Metric metric,
int emptyAction)
Construct a KMeans object |
Method Summary | |
---|---|
Clustering |
cluster(InstanceList instances)
Cluster instances |
java.util.ArrayList<SparseVector> |
getClusterMeans()
Return the ArrayList of cluster means after a run of the algorithm. |
Methods inherited from class cc.mallet.cluster.Clusterer |
---|
getPipe |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EMPTY_ERROR
public static final int EMPTY_DROP
public static final int EMPTY_SINGLE
Constructor Detail |
---|
public KMeans(Pipe instancePipe, int numClusters, Metric metric, int emptyAction)
instancePipe
- Pipe for the instances being clusterednumClusters
- Number of clusters to usemetric
- Metric object to measure instance distancesemptyAction
- Specify what should happen when an empty cluster occurspublic KMeans(Pipe instancePipe, int numClusters, Metric metric)
instancePipe
- Pipe for the instances being clusterednumClusters
- Number of clusters to usemetric
- Metric object to measure instance distances If an empty
cluster occurs, it is considered an error.Method Detail |
---|
public Clustering cluster(InstanceList instances)
cluster
in class Clusterer
instances
- List of instances to clusterpublic java.util.ArrayList<SparseVector> getClusterMeans()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |