Class BIRCH
- java.lang.Object
-
- smile.clustering.BIRCH
-
- All Implemented Interfaces:
- java.io.Serializable, Clustering<double[]>
public class BIRCH extends java.lang.Object implements Clustering<double[]>, java.io.Serializable
Balanced Iterative Reducing and Clustering using Hierarchies. BIRCH performs hierarchical clustering over particularly large datasets. An advantage of BIRCH is its ability to incrementally and dynamically cluster incoming, multi-dimensional metric data points in an attempt to produce the high quality clustering for a given set of resources (memory and time constraints).BIRCH has several advantages. For example, each clustering decision is made without scanning all data points and currently existing clusters. It exploits the observation that data space is not usually uniformly occupied and not every data point is equally important. It makes full use of available memory to derive the finest possible sub-clusters while minimizing I/O costs. It is also an incremental method that does not require the whole data set in advance.
This implementation produces a clustering in three steps. First step builds a CF (clustering feature) tree by a single scan of database. The second step clusters the leaves of CF tree by hierarchical clustering. Then the user can use the learned model to cluster input data in the final step. In total, we scan the database twice.
References
- Tian Zhang, Raghu Ramakrishnan, and Miron Livny. BIRCH: An Efficient Data Clustering Method for Very Large Databases. SIGMOD, 1996.
- See Also:
HierarchicalClustering,KMeans, Serialized Form
-
-
Field Summary
-
Fields inherited from interface smile.clustering.Clustering
OUTLIER
-
-
Constructor Summary
Constructors Constructor and Description BIRCH(int d, int B, double T)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(double[] x)Add a data point into CF tree.double[][]centroids()Returns the representatives of clusters.intdimension()Returns the dimensionality of data.intgetBrachingFactor()Returns the branching factor, which is the maximum number of children nodes.doublegetMaxRadius()Returns the maximum radius of a sub-cluster.intpartition(int k)Clustering leaves of CF tree into k clusters.intpartition(int k, int minPts)Clustering leaves of CF tree into k clusters.intpredict(double[] x)Cluster a new instance to the nearest CF leaf.
-
-
-
Constructor Detail
-
BIRCH
public BIRCH(int d, int B, double T)Constructor.- Parameters:
d- the dimensionality of data.B- the branching factor. Maximum number of children nodes.T- the maximum radius of a sub-cluster.
-
-
Method Detail
-
add
public void add(double[] x)
Add a data point into CF tree.
-
getBrachingFactor
public int getBrachingFactor()
Returns the branching factor, which is the maximum number of children nodes.
-
getMaxRadius
public double getMaxRadius()
Returns the maximum radius of a sub-cluster.
-
dimension
public int dimension()
Returns the dimensionality of data.
-
partition
public int partition(int k)
Clustering leaves of CF tree into k clusters.- Parameters:
k- the number of clusters.- Returns:
- the number of non-outlier leaves.
-
partition
public int partition(int k, int minPts)Clustering leaves of CF tree into k clusters.- Parameters:
k- the number of clusters.minPts- a CF leaf 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 CF leaf. After building the CF tree, the user should callpartition(int)method first to clustering leaves. Then they call this method to clustering new data.- Specified by:
predictin interfaceClustering<double[]>- Parameters:
x- a new instance.- Returns:
- the cluster label, which is the label of nearest CF leaf.
Note that it may be
Clustering.OUTLIER.
-
centroids
public double[][] centroids()
Returns the representatives of clusters.- Returns:
- the representatives of clusters
-
-
DataMelt 3.0 © DataMelt by jWork.ORG