Sunteți pe pagina 1din 24

UNIT-V

CLUSTER ANALYSIS?
1. Cluster: a collection of data objects
a.
Similar to one another within the same cluster
b.
Dissimilar to the objects in other clusters
2. Cluster analysis
a.
Grouping a set of data objects into clusters
3. Clustering is unsupervised classification: no predefined classes
4. Typical applications
a.
As a stand-alone tool to get insight into data distribution
b.
As a preprocessing step for other algorithms
APPLICATIONS OF CLUSTERING
1.
Pattern Recognition
2.
Spatial Data Analysis
a.
create thematic maps in GIS by clustering feature spaces
b.
detect spatial clusters and explain them in spatial data mining
3.
Image Processing
4.
Economic Science (especially market research)
5.
WWW
a.
Document classification
b.
Cluster Weblog data to discover groups of similar access patterns
6.
Marketing: Help marketers discover distinct groups in their customer bases, and then
use this knowledge to develop targeted marketing programs
7.
Land use: Identification of areas of similar land use in an earth observation
database
8.
Insurance: Identifying groups of motor insurance policy holders with a high
average claim cost
9.
City-planning: Identifying groups of houses according to their house type, value, and
geographical location
10.
Earth-quake studies: Observed earth quake epicenters should be clustered along
continent faults

REQUIREMENTS OF CLUSTERING
1.Scalability: Many clustering algorithms work well on small data sets containing
fewer than several hundred data objects; however, a large database may contain
millions of objects. Clustering on a sample of a given large data set may lead to
biased results
2.Ability to deal with different types of attributes: Many algorithms are designed to
cluster interval-based (numerical) data. However, applications may require
clustering other types of data, such as binary, categorical (nominal), and ordinal
data, or mixtures of these data types.
3.Discovery of clusters with arbitrary shape: Many clustering algorithms determine
clusters based on Euclidean or Manhattan distance measures. Algorithms based on such
distance measures tend to find spherical clusters with similar size and density.
4.Minimal requirements for domain knowledge to determine input parameters:
Many clustering algorithms require users to input certain parameters in cluster analysis
(such as the number of desired clusters). The clustering results can be quite sensitive to
input parameters.
5.Able to deal with noise and outliers: Most real-world databases contain outliers or
missing, unknown, or erroneous data. Some clustering algorithms are sensitive to such
data and may lead to clusters of poor quality
6.Insensitive to order of input records: Some clustering algorithms cannot incorporate
newly inserted data (i.e., database updates) into existing clustering structures and,
instead, must determine a new clustering from scratch. Some clustering algorithms are
sensitive to the order of input data.
7.High dimensionality: A database or a data warehouse can contain several dimensions
or attributes. Many clustering algorithms are good at handling low-dimensional data,
involving only two to three dimensions
8.Constraint-based clustering: Real-world applications may need to perform
clustering under various kinds of constraints. Suppose that your job is to choose the
locations for a given number of new automatic banking machines (ATMs) in a city.
9. Interpretability and usability: Users expect clustering results to be interpretable,
comprehensible, and usable. That is, clustering may need to be tied to specific semantic
Interpretations
and applications.

TYPES OF DATA IN CLUSTER ANALYSIS:

1.

Dissimilarity/Similarity metric: Similarity is expressed in terms of a distance


function, which is typically metric: d(i, j)
2.
There is a separate quality function that measures the goodness of a cluster.
3.
The definitions of distance functions are usually very different for interval-scaled,
boolean, categorical, ordinal and ratio variables.
4.
Weights should be associated with different variables based on applications and data
semantics.
5.
It is hard to define similar enough or good enough
a. the answer is typically highly subjective.

TYPES OF DATA IN CLUSTERING ANALYSIS


1.

Interval-scaled variables:

2.

Binary variables:

3.

Nominal, ordinal, and ratio variables:

4.

Variables of mixed types:

INTERVAL-SCALED VARIABLES
1)

Standardize data
a)

Calculate the mean absolute deviation:

sf 1
n (| x1 f m f | | x2 f m f | ... | xnf m f |)
where

m f 1n (x1 f x2 f ... xnf )


Calculate the standardized measurement (z-score)

2)

xif m f
zif s
f
Using mean absolute deviation is more robust than using standard deviation

Similarity and Dissimilarity between Objects

1)

Distances are normally used to measure the similarity or


dissimilarity between two data objects
Some popular ones include: Minkowski distance:
d (i, j ) q (| x x |q | x x |q ... | x x |q )
i1
j1
i2
j2
ip
jp

where i = (xi1, xi2, , xip) and j = (xj1, xj2, , xjp) are two pdimensional data objects, and q is a positive integer
2)

If q = 1, d is Manhattan distance

d (i, j) | x x | | x x | ... | x x |
i1
j1
i2
j2
ip
jp
If q = 2, d is Euclidean distance:
2
2
2
Properties d (i, j) (| xi1 x j1 | | xi 2 x j 2 | ... | xip x jp | )
i) d(i,j) 0 Distance is a nonnegative number.
ii) d(i,i) = 0 The distance of an object to itself is 0.
iii) d(i,j) = d(j,i) The distance of an object to itself is 0.
iv) d(i,j) d(i,k) + d(k,j)

BINARY VARIABLES

A contingency table for binary data

Object j

1
Object i

sum

sum

a+b

c +d

a+c

b+d

Simple matching coefficient (invariant, if the binary variable is


symmetric):

d (i, j)

bc
a b c d

Jaccard coefficient (noninvariant if the binary variable is asymmetric):

d (i, j) b c
a bc
DISSIMILARITY BETWEEN BINARY VARIABLES

Name

Gender

Fever

Cough

Test-1

Test-2

Test-3

Test-4

Jack

Mary

Jim

1.
2.
3.

gender is a symmetric attribute


the remaining attributes are asymmetric binary
let the values Y and P be set to 1, and the value N be set to 0

d ( jack , mary ) =

0+1
=0.33
2+ 0 +1

d ( jack , jim ) =

1+1

=0.67

1 +1 + 1
d ( jim , mary ) =

1+2
1+ 1 + 2

=0.75

CATEGORICAL VARIABLES
1.

A generalization of the binary variable in that it can take more than 2 states,
a.
e.g., red, yellow, blue, green
2.
Method 1: Simple matching
a.

m: # of matches, p: total # of variables

d (i, j) p pm

3.

Method 2: use a large number of binary variables


a.

creating a new binary variable for each of the M nominal states

ORDINAL VARIABLES

An ordinal variable can be discrete or continuous


Order is important, e.g., rank
Can be treated like interval-scaled
replace xif by their rank

map the range of each variable onto [0, 1] by replacing i-th object in the f-th
variable by

rif {1,. ,M f}

zif

rif 1
M f 1

compute the dissimilarity using methods for interval-scaled variables

RATIO-SCALED VARIABLE

Ratio-scaled variable: a positive measurement on a nonlinear scale, approximately


at exponential scale,
such as AeBt or Ae-Bt

Methods:

treat them like interval-scaled variablesnot a good choice! (why?the scale


can be distorted)

apply logarithmic transformation

yif = log(xif)

treat them as continuous ordinal data treat their rank as interval-scaled

VARIABLES OF MIXED TYPES


A database may contain all the six types of variables
symmetric binary, asymmetric binary, nominal,
ordinal, interval and ratio
One may use a weighted formula to combine their
effects

pf 1 ij( f )dij( f )
d (i, j)
pf 1 ij( f )
is binary or nominal:

dij(f) = 0

if xif = xjf , or dij(f)

= 1 other wise.

is interval-based: use the normalized distance

is ordinal or ratio-scaled

compute ranks rif and

r 1
M 1
A CATEGORIZATION OF MAJOR CLUSTERING METHODS

1.

and treat zif as interval-scaled

zif

if

Partitioning algorithms: Construct various partitions and then evaluate them by


some criterion
most applications adopt one of a few popular heuristic methods, such as
(1) the k-means algorithm, where each cluster is represented by the mean value of the objects
in the cluster, and
(2) the k-medoids algorithm, where each cluster is represented by one of the objects located
near the center of the cluster. These heuristic clustering methods work well for finding
spherical-shaped clusters in small to medium-sized databases.

2.

Hierarchy algorithms: Create a hierarchical decomposition of the set of data (or


objects) using some criterion.
A hierarchical method can be classified as being either agglomerative or divisive, based on
howthe hierarchical decomposition is formed. The agglomerative approach, also called the
bottom-up approach, starts with each object forming a separate group.The divisive approach,
also called the top-down approach, starts with all of the objects in the same cluster. In each
successive iteration, a cluster is split up into smaller clusters, until eventually each object is in
one cluster, or until a termination condition holds.
There are two approaches to improving the quality of hierarchical clustering: (1) perform
careful analysis of object linkages at each hierarchical partitioning, such as in Chameleon,
or (2) integrate hierarchical agglomeration and other approaches by first using a hierarchical
agglomerative algorithm to group objects into microclusters, and then performing
macroclustering on the microclusters using another clustering method such as iterative
relocation, as in BIRCH.
3.

Density-based: based on connectivity and density functions


Other clustering methods have been developed based on the notion of density. Their
general idea is to continue growing the given cluster as long as the density (number of objects
or data points) in the neighborhood exceeds some threshold; that is, for each data point
within a given cluster, the neighborhood of a given radius has to contain at least a minimum
number of points.
4.
Grid-based: based on a multiple-level granularity structure
Grid-based methods quantize the object space into a finite number of cells that form a
grid structure. All of the clustering operations are performed on the grid structure (i.e., on the
quantized space). The main advantage of this approach is its fast processing time, which is
typically independent of the number
of data objects and dependent only on the number of cells in each dimension in the quantized
space.
STING is a typical example of a grid-based method.

5.

Model-based: A model is hypothesized for each of the clusters and the idea is to find the
best fit of that model to each other

A model-based algorithm may locate clusters by constructing a density function that reflects
the spatial distribution of the data points. It also leads to a way of automatically determining
the number of
clusters based on standard statistics, taking noise or outliers into account and thus yielding
robust clustering methods.
PARTITIONING METHODS

Partitioning method: Construct a partition of a database D of n objects into a set of k


clusters
Given a k, find a partition of k clusters that optimizes the chosen partitioning criterion

Global optimal: exhaustively enumerate all partitions

Heuristic methods: k-means and k-medoids algorithms

k-means (MacQueen67): Each cluster is represented by the center of the cluster


k-medoids or PAM (Partition around medoids) (Kaufman &
Rousseeuw87): Each cluster is represented by one of the objects in
the cluster.

The K-Means Clustering Method

Given k, the k-means algorithm is implemented in four steps:

Partition objects into k nonempty subsets

Compute seed points as the centroids of the clusters of the current partition (the
centroid is the center, i.e., mean point, of the cluster)
Assign each object to the cluster with the nearest seed point
Go back to Step 2, stop when no more new assignment

Comments on the K-Means Method

Strength: Relatively efficient: O(tkn), where n is # objects, k is # clusters, and t is #


iterations. Normally, k, t << n.
2
2
Comparing: PAM: O(k(n-k) ), CLARA: O(ks + k(n-k))

Comment: Often terminates at a local optimum. The global optimum may be found
using techniques such as: deterministic annealing and genetic algorithms
Weakness
1.
Applicable only when mean is defined, then what about categorical data?
2.
Need to specify k, the number of clusters, in advance

3.

Unable to handle noisy data and outliers

4.

Not suitable to discover clusters with non-convex shapes

Variations of the K-Means Method


A few
a.

variants of the k-means which differ in

Selection of the initial k means

b. Dissimilarity calculations
c. Strategies to calculate cluster means
Handling
a.

categorical data: k-modes (Huang98)

Replacing means of clusters with modes

b. Using new dissimilarity measures to deal with categorical objects


c.

Using a frequency-based method to update modes of clusters

d.

A mixture of categorical and numerical data: k-prototype method

What is Problem of K-Means Method?


1. The k-means algorithm is sensitive to outliers !
a. Since an object with an extremely large value may substantially
distort the distribution of the data.
K-Medoids: Instead of taking the mean value of the object in a cluster as a reference

2.

point, medoids can be used, which is the most centrally located object in a cluster.
The K-Medoids Clustering Method

Find representative objects, called medoids, in clusters

PAM (Partitioning Around Medoids, 1987)


starts from an initial set of medoids and iteratively replaces one of the medoids
by one of the non-medoids if it improves the total distance of the resulting
clustering
PAM works effectively for small data sets, but does not scale well for large

data sets

CLARA (Kaufmann & Rousseeuw, 1990)

CLARANS (Ng & Han, 1994): Randomized sampling

Focusing + spatial data structure (Ester et al., 1995)

PAM (Partitioning Around Medoids) (1987)


1. PAM (Kaufman and Rousseeuw, 1987), built in Splus
2. Use real object to represent the cluster
a.

Select k representative objects arbitrarily

b.

For each pair of non-selected object h and selected object i, calculate the total
swapping cost TCih
For each pair of i and h,

c.

i.

If TCih < 0, i is replaced by h

ii. Then assign each non-selected object to the most similar


representative object
d.

repeat steps 2-3 until there is no change

What is the problem with PAM?


PAM is more robust than k-means in the presence of noise and outliers because a
medoid is less influenced by outliers or other extreme values than a mean
2.
Pam works efficiently for small data sets but does not scale well for large data
sets.
a.
O(k(n-k)2 ) for each iteration
1.

i.
3.

where n is no of data,k is no of clusters

Sampling based method, CLARA(Clustering LARge


Applications)

CLARA (Clustering Large Applications) (1990)


1.

CLARA (Kaufmann and Rousseeuw in 1990)


a. Built in statistical analysis packages, such as S+

2.

3.

It draws multiple samples of the data set, applies PAM on each sample, and gives the
best clustering as the output
Strength: deals with larger data sets than PAM

4. Weakness:
a. Efficiency depends on the sample size
b. A good clustering based on samples will not necessarily represent a good
clustering of the whole data set if the sample is biased

CLARANS (Randomized CLARA) (1994)


CLARANS (A Clustering Algorithm based on Randomized Search) (Ng and Han94)
2. CLARANS draws sample of neighbors dynamically
3. The clustering process can be presented as searching a graph where every node is a
potential solution, that is, a set of k medoids
4. If the local optimum is found, CLARANS starts with new randomly selected node in
search for a new local optimum
5. It is more efficient and scalable than both PAM and CLARA
6. Focusing techniques and spatial access structures may further improve its
performance (Ester et al.95)
1.

Hierarchical Methods
Hierarchical Clustering
Use distance matrix as clustering criteria. This method does not require the number of
clusters k as an input, but needs a termination condition

AGNES (AGglomerative NESting)


1.

Introduced in Kaufmann and Rousseeuw (1990)


Implemented in statistical analysis packages, e.g., Splus
3.
Use the Single-Link method and the dissimilarity matrix.
4.
Merge nodes that have the least dissimilarity
5.
Go on in a non-descending fashion
2.

1.

Introduced in Kaufmann and Rousseeuw (1990)

2.

Implemented in statistical analysis packages, e.g., Splus


Inverse order of AGNES

3.
4.

Eventually each node forms a cluster on its own

More on Hierarchical Clustering Methods

1. Major weakness of agglomerative clustering methods


2
a. do not scale well: time complexity of at least O(n ), where n is the number of total
objects
b. can never undo what was done previously
2. Integration of hierarchical with distance-based clustering
a. BIRCH (1996): uses CF-tree and incrementally adjusts the quality of
sub-clusters
b. CURE (1998): selects well-scattered points from the cluster and then shrinks them
towards the center of the cluster by a specified fraction
c. CHAMELEON (1999): hierarchical clustering using dynamic modeling

BIRCH (1996)
Birch: Balanced Iterative Reducing and Clustering using Hierarchies, by Zhang,
Ramakrishnan, Livny (SIGMOD96)
Incrementally construct a CF (Clustering Feature) tree, a hierarchical data structure
for multiphase clustering
Phase 1: scan DB to build an initial in-memory CF tree (a multi-level
compression of the data that tries to preserve the inherent clustering structure of
the data)
Phase 2: use an arbitrary clustering algorithm to cluster the leaf nodes of the CF-tree
Scales linearly: finds a good clustering with a single scan and improves the quality
with a few additional scans
Weakness: handles only numeric data, and sensitive to the order of the data record.
Clustering Feature Vector

CF-Tree in BIRCH
Clustering feature:

summary of the statistics for a given subcluster: the 0-th, 1st and 2nd moments of
the subcluster from the statistical point of view.

registers crucial measurements for computing cluster and utilizes storage efficiently
A CF tree is a height-balanced tree that stores the clustering features for a
hierarchical clustering

A nonleaf node in a tree has descendants or children

The nonleaf nodes store sums of the CFs of their children

A CF tree has two parameters

Branching factor: specify the maximum number of children.

threshold: max diameter of sub-clusters stored at the leaf nodes

ROCK: Robust Clustering using linKs,


1.
2.

Use links to measure similarity/proximity


Not distance based

ROCK (RObust Clustering using linKs) is a hierarchical clustering algorithm that


explores the concept of links (the number of common neighbors between two objects)
for data with categorical attributes.
ROCK takes a more global approach to clustering by considering the neighborhoods
of individual pairs of points.
More formally, two points, pi and pj, are neighbors if sim(pi, pj) _ q, where sim is a
similarity function and q is a user-specified threshold.
The number of links between pi and pj is defined as the number of common
neighbors between pi and pj.

ROCKs concepts of neighbors and links are illustrated in the following example,
where the similarity between two points or transactions, Ti and Tj, is defined with
the Jaccard coefficient as
Chameleon: A Hierarchical Clustering Algorithm
Using Dynamic Modeling
Chameleon is a hierarchical clustering algorithm that uses dynamic modeling to
determine the similarity between pairs of clusters. It was derived based on the
observed weaknesses of two hierarchical clustering algorithms: ROCK and CURE.
ROCK and related schemes emphasize cluster interconnectivity while ignoring
information regarding cluster proximity. CURE and related schemes consider cluster
proximity yet ignore cluster Interconnectivity.
1.

2.

Two clusters are merged only if the interconnectivity and closeness (proximity)
between two clusters are high relative to the internal interconnectivity of the
clusters and closeness of items within the clusters
Cure ignores information about interconnectivity of the objects, Rock ignores
information about the closeness of two clusters

two-phase algorithm:

1.
2.

Use a graph partitioning algorithm: cluster objects into a large number of


relatively small sub-clusters
Use an agglomerative hierarchical clustering algorithm: find the genuine clusters
by repeatedly combining these sub-clusters

DENSITY-BASED METHODS:
Clustering based on density (local cluster criterion), such as density-connected points
1.
Major features:
a.
Discover clusters of arbitrary shape
b.
Handle noise
c.
One scan
d.
Need density parameters as termination condition
2.
Several interesting studies:
a.
DBSCAN: Ester, et al. (KDD96)
b.
OPTICS: Ankerst, et al (SIGMOD99).
c.
DENCLUE: Hinneburg & D. Keim (KDD98)
d.
CLIQUE: Agrawal, et al. (SIGMOD98)
1. Core object (CO)object with at least M objects within a radius E-neighborhood
2.

Directly density reachable (DDR)x is CO, y is in xs E-neighborhood

3.

Density reachablethere exists a chain of DDR objects from x to y

4.

Density based clusterdensity connected objects maximum w.r.t. reachability

S-ar putea să vă placă și