You are viewing the RapidMiner Studio documentation for version 9.2 - Check here for latest version

# Agglomerative Clustering (RapidMiner Studio Core)

## Synopsis

This operator performs Agglomerative clustering which is a bottom-up strategy of Hierarchical clustering. Three different strategies are supported by this operator: single-link, complete-link and average-link. The result of this operator is a hierarchical cluster model, providing distance information to plot as a dendrogram.## Description

Agglomerative clustering is a strategy of hierarchical clustering. Hierarchical clustering (also known as Connectivity based clustering) is a method of cluster analysis which seeks to build a hierarchy of clusters. Hierarchical clustering, is based on the core idea of objects being more related to nearby objects than to objects farther away. As such, these algorithms connect 'objects' (or examples, in case of an ExampleSet) to form clusters based on their distance. A cluster can be described largely by the maximum distance needed to connect parts of the cluster. At different distances, different clusters will form, which can be represented using a dendrogram, which explains where the common name 'hierarchical clustering' comes from: these algorithms do not provide a single partitioning of the data set, but instead provide an extensive hierarchy of clusters that merge with each other at certain distances. In a dendrogram, the y-axis marks the distance at which the clusters merge, while the objects are placed along the x-axis so the clusters don't mix.

Strategies for hierarchical clustering generally fall into two types:

- Agglomerative: This is a bottom-up approach: each observation starts in its own cluster, and pairs of clusters are merged as one moves up the hierarchy.
- Divisive: This is a top-down approach: all observations start in one cluster, and splits are performed recursively as one moves down the hierarchy.

Hierarchical clustering is a whole family of methods that differ by the way distances are computed. Apart from the usual choice of distance functions, the user also needs to decide on the linkage criterion to use, since a cluster consists of multiple objects, there are multiple candidates to compute the distance to. Popular choices are known as single-linkage clustering (the minimum of object distances), complete-linkage clustering (the maximum of object distances) or average-linkage clustering (also known as UPGMA, 'Unweighted Pair Group Method with Arithmetic Mean').

The algorithm forms clusters in a bottom-up manner, as follows: Initially, put each example in its own cluster. Among all current clusters, pick the two clusters with the smallest distance. Replace these two clusters with a new cluster, formed by merging the two original ones. Repeat the above two steps until there is only one remaining cluster in the pool.

Clustering is concerned with grouping together objects that are similar to each other and dissimilar to the objects belonging to other clusters. It is a technique for extracting information from unlabeled data and can be very useful in many different scenarios e.g. in a marketing application we may be interested in finding clusters of customers with similar buying behavior.

## Input

- example set (IOObject)
This input port expects an ExampleSet. It is the output of the Retrieve operator in the attached Example Process.

## Output

- cluster model (Hierachical Cluster Model)
This port delivers the hierarchical cluster model. It has information regarding the clustering performed. It explains how clusters were merged to make a hierarchy of clusters.

- example set (IOObject)
The ExampleSet that was given as input is passed without any modification to the output through this port.

## Parameters

- modeThis parameter specifies the cluster mode or the linkage criterion.
- SingleLink: In single-link hierarchical clustering, we merge in each step the two clusters whose two closest members have the smallest distance (or: the two clusters with the smallest minimum pairwise distance).
- CompleteLink: In complete-link hierarchical clustering, we merge in each step the two clusters whose merger has the smallest diameter (or: the two clusters with the smallest maximum pairwise distance).
- AverageLink: Average-link clustering is a compromise between the sensitivity of complete-link clustering to outliers and the tendency of single-link clustering to form long chains that do not correspond to the intuitive notion of clusters as compact, spherical objects.

- measure_typesThis parameter is used for selecting the type of measure to be used for measuring the distance between points.The following options are available:
*mixed measures*,*nominal measures*,*numerical measures*and*Bregman divergences*. Range: selection - mixed_measureThis parameter is available when the
*measure type*parameter is set to 'mixed measures'. The only available option is the 'Mixed Euclidean Distance' Range: selection - nominal_measureThis parameter is available when the
*measure type*parameter is set to 'nominal measures'. This option cannot be applied if the input ExampleSet has numerical attributes. In this case the 'numerical measure' option should be selected. Range: selection - numerical_measureThis parameter is available when the
*measure type*parameter is set to 'numerical measures'. This option cannot be applied if the input ExampleSet has nominal attributes. If the input ExampleSet has nominal attributes the 'nominal measure' option should be selected. Range: selection - divergenceThis parameter is available when the
*measure type*parameter is set to 'bregman divergences'. Range: selection - kernel_typeThis parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance'. The type of the kernel function is selected through this parameter. Following kernel types are supported:- dot: The dot kernel is defined by k(x,y)=x*y i.e.it is inner product of x and y.
- radial: The radial kernel is defined by exp(-g ||x-y||^2) where g is the gamma that is specified by the kernel gamma parameter. The adjustable parameter gamma plays a major role in the performance of the kernel, and should be carefully tuned to the problem at hand.
- polynomial: The polynomial kernel is defined by k(x,y)=(x*y+1)^d where d is the degree of the polynomial and it is specified by the kernel degree parameter. The Polynomial kernels are well suited for problems where all the training data is normalized.
- neural: The neural kernel is defined by a two layered neural net tanh(a x*y+b) where a is alpha and b is the intercept constant. These parameters can be adjusted using the kernel a and kernel b parameters. A common value for alpha is 1/N, where N is the data dimension. Note that not all choices of a and b lead to a valid kernel function.
- sigmoid: This is the sigmoid kernel. Please note that the sigmoid kernel is not valid under some parameters.
- anova: This is the anova kernel. It has adjustable parameters gamma and degree.
- epachnenikov: The Epanechnikov kernel is this function (3/4)(1-u2) for u between -1 and 1 and zero for u outside that range. It has two adjustable parameters kernel sigma1 and kernel degree.
- gaussian_combination: This is the gaussian combination kernel. It has adjustable parameters kernel sigma1, kernel sigma2 and kernel sigma3.
- multiquadric: The multiquadric kernel is defined by the square root of ||x-y||^2 + c^2. It has adjustable parameters kernel sigma1 and kernel sigma shift.

- kernel_gammaThis is the SVM kernel parameter gamma. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*radial*or*anova.*Range: real - kernel_sigma1This is the SVM kernel parameter sigma1. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*epachnenikov*,*gaussian combination*or*multiquadric.*Range: real - kernel_sigma2This is the SVM kernel parameter sigma2. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*gaussian combination*. Range: real - kernel_sigma3This is the SVM kernel parameter sigma3. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*gaussian combination*. Range: real - kernel_shiftThis is the SVM kernel parameter shift. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*multiquadric*. Range: real - kernel_degreeThis is the SVM kernel parameter degree. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*polynomial*,*anova*or*epachnenikov*. Range: real - kernel_aThis is the SVM kernel parameter a. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*neural.*Range: real - kernel_bThis is the SVM kernel parameter b. This parameter is only available when the
*numerical measure*parameter is set to 'Kernel Euclidean Distance' and the*kernel type*parameter is set to*neural.*Range: real

## Tutorial Processes

### Agglomerative Clustering of Ripley-Set data set

The 'Ripley-Set' data set is loaded using the Retrieve operator. A breakpoint is inserted at this step so that you can have a look at the ExampleSet. The Agglomerative Clustering operator is applied on this ExampleSet. Run the process and switch to the Results Workspace. Note the Graph View of the results. You can see that the algorithm has not created separate groups or clusters as other clustering algorithms (like k-means), instead the result is a hierarchy of clusters. Under the Folder View you can see members of each cluster in folder format. You can see that it is an hierarchy of folders. The Dendogram View shows the dendrogram for this clustering which shows how single-element clusters were joined step by step to make a hierarchy of clusters.