jsat.clustering
Class ClustererBase
- java.lang.Object
-
- jsat.clustering.ClustererBase
-
- All Implemented Interfaces:
- java.io.Serializable, Clusterer
- Direct Known Subclasses:
- DBSCAN, FLAME, KClustererBase, LSDBC, OPTICS
public abstract class ClustererBase extends java.lang.Object implements Clusterer
A base foundation that provides an implementation ofClusterer.cluster(jsat.DataSet)and#cluster(jsat.DataSet, java.util.concurrent.ExecutorService)using their int array counterparts.
By default it is assumed that a cluster does not support weighted data. If this is incorrect, you need to overwrite theClusterer.supportsWeightedData()method.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ClustererBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract Clustererclone()static java.util.List<java.util.List<DataPoint>>createClusterListFromAssignmentArray(int[] assignments, DataSet dataSet)Convenient helper method.static java.util.List<DataPoint>getDatapointsFromCluster(int c, int[] assignments, DataSet dataSet, int[] indexFrom)Gets a list of the datapoints in a data set that belong to the indicated cluster
-
-
-
Method Detail
-
createClusterListFromAssignmentArray
public static java.util.List<java.util.List<DataPoint>> createClusterListFromAssignmentArray(int[] assignments, DataSet dataSet)
Convenient helper method. A list of lists to represent a cluster may be desirable. In such a case, this method will take in an array of cluster assignments, and return a list of lists.- Parameters:
assignments- the array containing cluster assignmentsdataSet- the original data set, with data in the same order as was used to create the assignments array- Returns:
- a List of lists where each list contains the data points for one cluster, and the lists are in order by cluster id.
-
getDatapointsFromCluster
public static java.util.List<DataPoint> getDatapointsFromCluster(int c, int[] assignments, DataSet dataSet, int[] indexFrom)
Gets a list of the datapoints in a data set that belong to the indicated cluster- Parameters:
c- the cluster ID to get the datapoints forassignments- the array containing cluster assignmentsdataSet- the data set to get the points fromindexFrom- stores the index from the original dataset that the datapoint is from, such that the item at indexiin the returned list can be found in the original dataset at indexindexFrom[i]. May benull- Returns:
- a list of datapoints that were assignment to the designated cluster
-
-
DataMelt 3.0 © DataMelt by jWork.ORG