Data Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining



Similar documents
Data Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining

Data Mining Cluster Analysis: Basic Concepts and Algorithms. Clustering Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining

K-Means Cluster Analysis. Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 1

For supervised classification we have a variety of measures to evaluate how good our model is Accuracy, precision, recall

Example: Document Clustering. Clustering: Definition. Notion of a Cluster can be Ambiguous. Types of Clusterings. Hierarchical Clustering

Cluster Analysis: Basic Concepts and Algorithms

Data Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining

Data Mining Clustering (2) Sheets are based on the those provided by Tan, Steinbach, and Kumar. Introduction to Data Mining

DATA MINING CLUSTER ANALYSIS: BASIC CONCEPTS

Data Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining

Cluster Analysis Overview. Data Mining Techniques: Cluster Analysis. What is Cluster Analysis? What is Cluster Analysis?

Clustering. Adrian Groza. Department of Computer Science Technical University of Cluj-Napoca

Clustering. Data Mining. Abraham Otero. Data Mining. Agenda

Cluster Analysis: Basic Concepts and Algorithms

Data Mining Cluster Analysis: Advanced Concepts and Algorithms. Lecture Notes for Chapter 9. Introduction to Data Mining

Cluster Analysis: Advanced Concepts

Clustering UE 141 Spring 2013

Data Mining Cluster Analysis: Advanced Concepts and Algorithms. Lecture Notes for Chapter 9. Introduction to Data Mining

Cluster Analysis. Alison Merikangas Data Analysis Seminar 18 November 2009

Unsupervised learning: Clustering

Data Mining. Cluster Analysis: Advanced Concepts and Algorithms

Clustering. Clustering. What is Clustering? What is Clustering? What is Clustering? Types of Data in Cluster Analysis

Cluster Analysis. Isabel M. Rodrigues. Lisboa, Instituto Superior Técnico

An Introduction to Cluster Analysis for Data Mining

Clustering. Danilo Croce Web Mining & Retrieval a.a. 2015/201 16/03/2016

Client Based Power Iteration Clustering Algorithm to Reduce Dimensionality in Big Data

Chapter 7. Cluster Analysis

Cluster Analysis: Basic Concepts and Methods

Clustering & Visualization

Neural Networks Lesson 5 - Cluster Analysis

How To Cluster

SoSe 2014: M-TANI: Big Data Analytics

CLUSTER ANALYSIS FOR SEGMENTATION

Data Mining Project Report. Document Clustering. Meryem Uzun-Per

Clustering Artificial Intelligence Henry Lin. Organizing data into clusters such that there is

Chapter ML:XI (continued)

Territorial Analysis for Ratemaking. Philip Begher, Dario Biasini, Filip Branitchev, David Graham, Erik McCracken, Rachel Rogers and Alex Takacs

Solving Quadratic Equations by Graphing. Consider an equation of the form. y ax 2 bx c a 0. In an equation of the form

Distances, Clustering, and Classification. Heatmaps

Cluster analysis Cosmin Lazar. COMO Lab VUB

A Survey of Clustering Techniques

A comparison of various clustering methods and algorithms in data mining

Social Media Mining. Data Mining Essentials

. Learn the number of classes and the structure of each class using similarity between unlabeled training patterns

Information Retrieval and Web Search Engines

Summary Data Mining & Process Mining (1BM46) Content. Made by S.P.T. Ariesen

Concept of Cluster Analysis

Medical Information Management & Mining. You Chen Jan,15, 2013 You.chen@vanderbilt.edu

Cluster Analysis using R

Comparison and Analysis of Various Clustering Methods in Data mining On Education data set Using the weak tool

OUTLIER ANALYSIS. Data Mining 1

PERFORMANCE ANALYSIS OF CLUSTERING ALGORITHMS IN DATA MINING IN WEKA

Unsupervised Learning and Data Mining. Unsupervised Learning and Data Mining. Clustering. Supervised Learning. Supervised Learning

2 Basic Concepts and Techniques of Cluster Analysis

There are a number of different methods that can be used to carry out a cluster analysis; these methods can be classified as follows:

Hierarchical Cluster Analysis Some Basics and Algorithms

UNSUPERVISED MACHINE LEARNING TECHNIQUES IN GENOMICS

ARTIFICIAL INTELLIGENCE (CSCU9YE) LECTURE 6: MACHINE LEARNING 2: UNSUPERVISED LEARNING (CLUSTERING)

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining

Decision Support System Methodology Using a Visual Approach for Cluster Analysis Problems

Data Mining and Knowledge Discovery in Databases (KDD) State of the Art. Prof. Dr. T. Nouri Computer Science Department FHNW Switzerland

Performance Metrics for Graph Mining Tasks

USING THE AGGLOMERATIVE METHOD OF HIERARCHICAL CLUSTERING AS A DATA MINING TOOL IN CAPITAL MARKET 1. Vera Marinova Boncheva

A Comparative Study of clustering algorithms Using weka tools

Classification Techniques (1)

Steven M. Ho!and. Department of Geology, University of Georgia, Athens, GA

Unsupervised Data Mining (Clustering)

Machine Learning using MapReduce

A Method for Decentralized Clustering in Large Multi-Agent Systems

7.3 Parabolas. 7.3 Parabolas 505

SPECIAL PERTURBATIONS UNCORRELATED TRACK PROCESSING

Data Preprocessing. Week 2

On Clustering Validation Techniques

Time series clustering and the analysis of film style

A Study of Web Log Analysis Using Clustering Techniques

SECTION 5-1 Exponential Functions

Constrained Clustering of Territories in the Context of Car Insurance

STATISTICA. Clustering Techniques. Case Study: Defining Clusters of Shopping Center Patrons. and

Introduction to Clustering

COM CO P 5318 Da t Da a t Explora Explor t a ion and Analysis y Chapte Chapt r e 3

0.1 What is Cluster Analysis?

Clustering. Chapter Introduction to Clustering Techniques Points, Spaces, and Distances

Linköpings Universitet - ITN TNM DBSCAN. A Density-Based Spatial Clustering of Application with Noise

Statistical Databases and Registers with some datamining

Data Mining K-Clustering Problem

Personalized Hierarchical Clustering

Forschungskolleg Data Analytics Methods and Techniques

Mining Social-Network Graphs

Data Exploration Data Visualization

Graph Mining and Social Network Analysis

DHL Data Mining Project. Customer Segmentation with Clustering

Clustering Techniques: A Brief Survey of Different Clustering Algorithms

An Analysis on Density Based Clustering of Multi Dimensional Spatial Data

Visualizing non-hierarchical and hierarchical cluster analyses with clustergrams

Cross-validation for detecting and preventing overfitting

How To Perform An Ensemble Analysis

Data Mining and Visualization

Data Clustering Techniques Qualifying Oral Examination Paper

Going Big in Data Dimensionality:

LESSON EIII.E EXPONENTS AND LOGARITHMS

Transcription:

Data Mining Cluster Analsis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 Introduction to Data Mining b Tan, Steinbach, Kumar Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 What is Cluster Analsis? Finding groups of objects such that the objects in a group will be similar (or related) to one another and different from (or unrelated to) the objects in other groups Intra-cluster distances are minimized Inter-cluster distances are maimized Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Applications of Cluster Analsis Understanding Group related documents for browsing, group genes and proteins that have similar functionalit, or group stocks with similar price fluctuations 4 Discovered Clusters Applied-Matl-DOWN,Ba-Network-Down,-COM-DOWN, Cabletron-Ss-DOWN,CISCO-DOWN,HP-DOWN, DSC-Comm-DOWN,INTEL-DOWN,LSI-Logic-DOWN, Micron-Tech-DOWN,Teas-Inst-Down,Tellabs-Inc-Down, Natl-Semiconduct-DOWN,Oracl-DOWN,SGI-DOWN, Sun-DOWN Apple-Comp-DOWN,Autodesk-DOWN,DEC-DOWN, ADV-Micro-Device-DOWN,Andrew-Corp-DOWN, Computer-Assoc-DOWN,Circuit-Cit-DOWN, Compaq-DOWN, EMC-Corp-DOWN, Gen-Inst-DOWN, Motorola-DOWN,Microsoft-DOWN,Scientific-Atl-DOWN Fannie-Mae-DOWN,Fed-Home-Loan-DOWN, MBNA-Corp-DOWN,Morgan-Stanle-DOWN Baker-Hughes-UP,Dresser-Inds-UP,Halliburton-HLD-UP, Louisiana-Land-UP,Phillips-Petro-UP,Unocal-UP, Schlumberger-UP Industr Group Technolog-DOWN Technolog-DOWN Financial-DOWN Oil-UP Summarization Reduce the size of large data sets Clustering precipitation in Australia Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 What is not Cluster Analsis? Supervised classification Have class label information Simple segmentation Dividing students into different registration groups alphabeticall, b last name Results of a quer Groupings are a result of an eternal specification Graph partitioning Some mutual relevance and snerg, but areas are not identical Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4

Notion of a Cluster can be Ambiguous How man clusters? Si Clusters Two Clusters Four Clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5 Tpes of Clusterings A clustering is a set of clusters Important distinction between hierarchical and partitional sets of clusters Partitional Clustering A division data objects into non-overlapping subsets (clusters) such that each data object is in eactl one subset Hierarchical clustering A set of nested clusters organized as a hierarchical tree Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6

Partitional Clustering Original Points A Partitional Clustering Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7 Hierarchical Clustering p p p p4 p p p p4 Traditional Hierarchical Clustering Traditional Dendrogram p p p p4 p p p p4 Non-traditional Hierarchical Clustering Non-traditional Dendrogram Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8

Other Distinctions Between Sets of Clusters Eclusive versus non-eclusive In non-eclusive clusterings, points ma belong to multiple clusters. Can represent multiple classes or border points Fuzz versus non-fuzz In fuzz clustering, a point belongs to ever cluster with some weight between and Weights must sum to Probabilistic clustering has similar characteristics Partial versus complete In some cases, we onl want to cluster some of the data Heterogeneous versus homogeneous Cluster of widel different sizes, shapes, and densities Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9 Tpes of Clusters Well-separated clusters Center-based clusters Contiguous clusters Densit-based clusters Propert or Conceptual Described b an Objective Function Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Tpes of Clusters: Well-Separated Well-Separated Clusters: A cluster is a set of points such that an point in a cluster is closer (or more similar) to ever other point in the cluster than to an point not in the cluster. well-separated clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Tpes of Clusters: Center-Based Center-based A cluster is a set of objects such that an object in a cluster is closer (more similar) to the center of a cluster, than to the center of an other cluster The center of a cluster is often a centroid, the average of all the points in the cluster, or a medoid, the most representative point of a cluster 4 center-based clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Tpes of Clusters: Contiguit-Based Contiguous Cluster (Nearest neighbor or Transitive) A cluster is a set of points such that a point in a cluster is closer (or more similar) to one or more other points in the cluster than to an point not in the cluster. 8 contiguous clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Tpes of Clusters: Densit-Based Densit-based A cluster is a dense region of points, which is separated b low-densit regions, from other regions of high densit. Used when the clusters are irregular or intertwined, and when noise and outliers are present. 6 densit-based clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4

Tpes of Clusters: Conceptual Clusters Shared Propert or Conceptual Clusters Finds clusters that share some common propert or represent a particular concept.. Overlapping Circles Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5 Tpes of Clusters: Objective Function Clusters Defined b an Objective Function Finds clusters that minimize or maimize an objective function. Enumerate all possible was of dividing the points into clusters and evaluate the `goodness' of each potential set of clusters b using the given objective function. (NP Hard) Can have global or local objectives. Hierarchical clustering algorithms tpicall have local objectives Partitional algorithms tpicall have global objectives A variation of the global objective function approach is to fit the data to a parameterized model. Parameters for the model are determined from the data. Miture models assume that the data is a miture' of a number of statistical distributions. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6

Tpes of Clusters: Objective Function Map the clustering problem to a different domain and solve a related problem in that domain Proimit matri defines a weighted graph, where the nodes are the points being clustered, and the weighted edges represent the proimities between points Clustering is equivalent to breaking the graph into connected components, one for each cluster. Want to minimize the edge weight between clusters and maimize the edge weight within clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7 Characteristics of the Input Data Are Important Tpe of proimit or densit measure This is a derived measure, but central to clustering Sparseness Dictates tpe of similarit Adds to efficienc Attribute tpe Dictates tpe of similarit Tpe of Data Dictates tpe of similarit Other characteristics, e.g., autocorrelation Dimensionalit Noise and Outliers Tpe of Distribution Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8

Clustering Algorithms K-means and its variants Hierarchical clustering Densit-based clustering Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9 K-means Clustering Partitional clustering approach Each cluster is associated with a centroid (center point) Each point is assigned to the cluster with the closest centroid Number of clusters, K, must be specified The basic algorithm is ver simple Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

K-means Clustering Details Initial centroids are often chosen randoml. Clusters produced var from one run to another. The centroid is (tpicall) the mean of the points in the cluster. Closeness is measured b Euclidean distance, cosine similarit, correlation, etc. K-means will converge for common similarit measures mentioned above. Most of the convergence happens in the first few iterations. Often the stopping condition is changed to Until relativel few points change clusters Compleit is O( n * K * I * d ) n = number of points, K = number of clusters, I = number of iterations, d = number of attributes Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Two different K-means Clusterings.5.5 Original Points.5 - -.5 - -.5.5.5.5.5.5.5.5.5 - -.5 - -.5.5.5 Optimal Clustering - -.5 - -.5.5.5 Sub-optimal Clustering Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Importance of Choosing Initial Centroids Ite ration 4 56.5.5.5 - -.5 - -.5.5.5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Importance of Choosing Initial Centroids Iteration Iteration Iteration.5.5.5.5.5.5.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 Iteration 4 Iteration 5 Iteration 6.5.5.5.5.5.5.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4

Evaluating K-means Clusters Most common measure is Sum of Squared Error (SSE) For each point, the error is the distance to the nearest cluster To get SSE, we square these errors and sum them. SSE = K i= C i dist ( m, ) is a data point in cluster C i and m i is the representative point for cluster C i can show that m i corresponds to the center (mean) of the cluster Given two clusters, we can choose the one with the smallest error One eas wa to reduce SSE is to increase K, the number of clusters A good clustering with smaller K can have a lower SSE than a poor clustering with higher K i Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5 Importance of Choosing Initial Centroids Ite ration 4 5.5.5.5 - -.5 - -.5.5.5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6

Importance of Choosing Initial Centroids Iteration Iteration.5.5.5.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 Iteration Iteration 4 Iteration 5.5.5.5.5.5.5.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 - -.5 - -.5.5.5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7 Problems with Selecting Initial Points If there are K real clusters then the chance of selecting one centroid from each cluster is small. Chance is relativel small when K is large If clusters are the same size, n, then For eample, if K =, then probabilit =!/ =.6 Sometimes the initial centroids will readjust themselves in right wa, and sometimes the don t Consider an eample of five pairs of clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8

Clusters Eample 8 Ite ration 4 6 4 - -4-6 5 5 Starting with two initial centroids in one cluster of each pair of clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9 Clusters Eample 8 Iteration 8 Iteration 6 6 4 4 - - -4-4 -6-6 5 5 Iteration 8 5 5 Iteration 4 8 6 6 4 4 - - -4-4 -6-6 5 5 5 5 Starting with two initial centroids in one cluster of each pair of clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Clusters Eample 8 Ite ration 4 6 4 - -4-6 5 5 Starting with some pairs of clusters having three initial centroids, while other have onl one. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Clusters Eample 8 Iteration 8 Iteration 6 6 4 4 - - -4-4 -6-6 5 5 Iteration 8 5 5 Iteration 4 8 6 6 4 4 - - -4-4 -6-6 5 5 5 5 Starting with some pairs of clusters having three initial centroids, while other have onl one. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Solutions to Initial Centroids Problem Multiple runs Helps, but probabilit is not on our side Sample and use hierarchical clustering to determine initial centroids Select more than k initial centroids and then select among these initial centroids Select most widel separated Postprocessing Bisecting K-means Not as susceptible to initialization issues Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Handling Empt Clusters Basic K-means algorithm can ield empt clusters Several strategies Choose the point that contributes most to SSE Choose a point from the cluster with the highest SSE If there are several empt clusters, the above can be repeated several times. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4

Updating Centers Incrementall In the basic K-means algorithm, centroids are updated after all points are assigned to a centroid An alternative is to update the centroids after each assignment (incremental approach) Each assignment updates zero or two centroids More epensive Introduces an order dependenc Never get an empt cluster Can use weights to change the impact Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5 Pre-processing and Post-processing Pre-processing Normalize the data Eliminate outliers Post-processing Eliminate small clusters that ma represent outliers Split loose clusters, i.e., clusters with relativel high SSE Merge clusters that are close and that have relativel low SSE Can use these steps during the clustering process ISODATA Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6

Bisecting K-means Bisecting K-means algorithm Variant of K-means that can produce a partitional or a hierarchical clustering Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7 Bisecting K-means Eample Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8

Limitations of K-means K-means has problems when clusters are of differing Sizes Densities Non-globular shapes K-means has problems when the data contains outliers. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9 Limitations of K-means: Differing Sizes Original Points K-means ( Clusters) Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4

Limitations of K-means: Differing Densit Original Points K-means ( Clusters) Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4 Limitations of K-means: Non-globular Shapes Original Points K-means ( Clusters) Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4

Overcoming K-means Limitations Original Points K-means Clusters One solution is to use man clusters. Find parts of clusters, but need to put together. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4 Overcoming K-means Limitations Original Points K-means Clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 44

Overcoming K-means Limitations Original Points K-means Clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 45 Hierarchical Clustering Produces a set of nested clusters organized as a hierarchical tree Can be visualized as a dendrogram A tree like diagram that records the sequences of merges or splits 6 5..5. 4 4 5.5 5 4 6 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 46

Strengths of Hierarchical Clustering Do not have to assume an particular number of clusters An desired number of clusters can be obtained b cutting the dendogram at the proper level The ma correspond to meaningful taonomies Eample in biological sciences (e.g., animal kingdom, phlogen reconstruction, ) Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 47 Hierarchical Clustering Two main tpes of hierarchical clustering Agglomerative: Start with the points as individual clusters At each step, merge the closest pair of clusters until onl one cluster (or k clusters) left Divisive: Start with one, all-inclusive cluster At each step, split a cluster until each cluster contains a point (or there are k clusters) Traditional hierarchical algorithms use a similarit or distance matri Merge or split one cluster at a time Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 48

Agglomerative Clustering Algorithm More popular hierarchical clustering technique Basic algorithm is straightforward. Compute the proimit matri. Let each data point be a cluster. Repeat 4. Merge the two closest clusters 5. Update the proimit matri 6. Until onl a single cluster remains Ke operation is the computation of the proimit of two clusters Different approaches to defining the distance between clusters distinguish the different algorithms Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 49 Starting Situation Start with clusters of individual points and a proimit matri p p p p4 p5.. p p p p4 p5.... Proimit Matri Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5... p p p p4 p9 p p p

Intermediate Situation After some merging steps, we have some clusters C C C C4 C5 C C C C C4 C C4 C5 Proimit Matri C C5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5... p p p p4 p9 p p p Intermediate Situation We want to merge the two closest clusters (C and C5) and update the proimit matri. C C C C C4 C5 C C C C4 C C4 C5 Proimit Matri C C5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5... p p p p4 p9 p p p

After Merging The question is How do we update the proimit matri? C C U C5 C C4 C? C C C4 C U C5???? C? C4? Proimit Matri C U C5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 5... p p p p4 p9 p p p How to Define Inter-Cluster Similarit p p p p4 p5... Similarit? p p MIN MAX Group Average Distance Between Centroids Other methods driven b an objective function Ward s Method uses squared error p p4 p5... Proimit Matri Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 54

How to Define Inter-Cluster Similarit p p p p4 p5... p p p p4 MIN MAX Group Average Distance Between Centroids Other methods driven b an objective function Ward s Method uses squared error p5... Proimit Matri Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 55 How to Define Inter-Cluster Similarit p p p p4 p5... p p p p4 MIN MAX Group Average Distance Between Centroids Other methods driven b an objective function Ward s Method uses squared error p5... Proimit Matri Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 56

How to Define Inter-Cluster Similarit p p p p4 p5... p p p p4 MIN MAX Group Average Distance Between Centroids Other methods driven b an objective function Ward s Method uses squared error p5... Proimit Matri Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 57 How to Define Inter-Cluster Similarit p p p p p4 p5... p p p4 MIN MAX Group Average Distance Between Centroids Other methods driven b an objective function Ward s Method uses squared error p5... Proimit Matri Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 58

Cluster Similarit: MIN or Single Link Similarit of two clusters is based on the two most similar (closest) points in the different clusters Determined b one pair of points, i.e., b one link in the proimit graph. I I I I4 I5 I..9..65. I.9..7.6.5 I..7..4. I4.65.6.4..8 I5..5..8. 4 5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 59 Hierarchical Clustering: MIN 5 5 6..5. 4 4.5 6 5 4 Nested Clusters Dendrogram Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6

Strength of MIN Original Points Two Clusters Can handle non-elliptical shapes Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6 Limitations of MIN Original Points Two Clusters Sensitive to noise and outliers Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6

Cluster Similarit: MAX or Complete Linkage Similarit of two clusters is based on the two least similar (most distant) points in the different clusters Determined b all pairs of points in the two clusters I I I I4 I5 I..9..65. I.9..7.6.5 I..7..4. I4.65.6.4..8 I5..5..8. 4 5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 6 Hierarchical Clustering: MAX 5 4 5 6 4.4.5..5..5..5 6 4 5 Nested Clusters Dendrogram Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 64

Strength of MAX Original Points Two Clusters Less susceptible to noise and outliers Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 65 Limitations of MAX Original Points Two Clusters Tends to break large clusters Biased towards globular clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 66

Cluster Similarit: Group Average Proimit of two clusters is the average of pairwise proimit between points in the two clusters. proimit(pi,pj) pi Clusteri p Cluster j j proimit(clusteri,clusterj) = Cluster Cluster Need to use average connectivit for scalabilit since total proimit favors large clusters I I I I4 I5 I..9..65. I.9..7.6.5 I..7..4. I4.65.6.4..8 I5..5..8. 4 5 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 67 i j Hierarchical Clustering: Group Average 5 5 4 4 6.5..5..5 6 4 5 Nested Clusters Dendrogram Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 68

Hierarchical Clustering: Group Average Compromise between Single and Complete Link Strengths Less susceptible to noise and outliers Limitations Biased towards globular clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 69 Cluster Similarit: Ward s Method Similarit of two clusters is based on the increase in squared error when two clusters are merged Similar to group average if distance between points is distance squared Less susceptible to noise and outliers Biased towards globular clusters Hierarchical analogue of K-means Can be used to initialize K-means Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7

Hierarchical Clustering: Comparison 5 4 4 5 6 MIN MAX 5 4 5 6 4 4 5 4 5 6 Group Average Ward s Method 5 5 4 4 6 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7 Hierarchical Clustering: Time and Space requirements O(N ) space since it uses the proimit matri. N is the number of points. O(N ) time in man cases There are N steps and at each step the size, N, proimit matri must be updated and searched Compleit can be reduced to O(N log(n) ) time for some approaches Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7

Hierarchical Clustering: Problems and Limitations Once a decision is made to combine two clusters, it cannot be undone No objective function is directl minimized Different schemes have problems with one or more of the following: Sensitivit to noise and outliers Difficult handling different sized clusters and conve shapes Breaking large clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 7 MST: Divisive Hierarchical Clustering Build MST (Minimum Spanning Tree) Start with a tree that consists of an point In successive steps, look for the closest pair of points (p, q) such that one point (p) is in the current tree but the other (q) is not Add q to the tree and put an edge between p and q Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 74

MST: Divisive Hierarchical Clustering Use MST for constructing hierarch of clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 75 DBSCAN DBSCAN is a densit-based algorithm. Densit = number of points within a specified radius (Eps) A point is a core point if it has more than a specified number of points (MinPts) within Eps These are points that are at the interior of a cluster A border point has fewer than MinPts within Eps, but is in the neighborhood of a core point A noise point is an point that is not a core point or a border point. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 76

DBSCAN: Core, Border, and Noise Points Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 77 DBSCAN Algorithm Eliminate noise points Perform clustering on the remaining points Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 78

DBSCAN: Core, Border and Noise Points Original Points Point tpes: core, border and noise Eps =, MinPts = 4 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 79 When DBSCAN Works Well Original Points Clusters Resistant to Noise Can handle clusters of different shapes and sizes Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8

When DBSCAN Does NOT Work Well Original Points (MinPts=4, Eps=9.75). Varing densities High-dimensional data (MinPts=4, Eps=9.9) Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8 DBSCAN: Determining EPS and MinPts Idea is that for points in a cluster, their k th nearest neighbors are at roughl the same distance Noise points have the k th nearest neighbor at farther distance So, plot sorted distance of ever point to its k th nearest neighbor Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8

Cluster Validit For supervised classification we have a variet of measures to evaluate how good our model is Accurac, precision, recall For cluster analsis, the analogous question is how to evaluate the goodness of the resulting clusters? But clusters are in the ee of the beholder! Then wh do we want to evaluate them? To avoid finding patterns in noise To compare clustering algorithms To compare two sets of clusters To compare two clusters Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 8 Clusters found in Random Data.9.9.8.8 Random Points.7.6.5.7.6.5 DBSCAN.4.4........4.6.8..4.6.8.9.9 K-means.8.7.6.8.7.6 Complete Link.5.5.4.4........4.6.8..4.6.8 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 84

Different Aspects of Cluster Validation. Determining the clustering tendenc of a set of data, i.e., distinguishing whether non-random structure actuall eists in the data.. Comparing the results of a cluster analsis to eternall known results, e.g., to eternall given class labels.. Evaluating how well the results of a cluster analsis fit the data without reference to eternal information. - Use onl the data 4. Comparing the results of two different sets of cluster analses to determine which is better. 5. Determining the correct number of clusters. For,, and 4, we can further distinguish whether we want to evaluate the entire clustering or just individual clusters. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 85 Measures of Cluster Validit Numerical measures that are applied to judge various aspects of cluster validit, are classified into the following three tpes. Eternal Inde: Used to measure the etent to which cluster labels match eternall supplied class labels. Entrop Internal Inde: Used to measure the goodness of a clustering structure without respect to eternal information. Sum of Squared Error (SSE) Relative Inde: Used to compare two different clusterings or clusters. Often an eternal or internal inde is used for this function, e.g., SSE or entrop Sometimes these are referred to as criteria instead of indices However, sometimes criterion is the general strateg and inde is the numerical measure that implements the criterion. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 86

Measuring Cluster Validit Via Correlation Two matrices Proimit Matri Incidence Matri One row and one column for each data point An entr is if the associated pair of points belong to the same cluster An entr is if the associated pair of points belongs to different clusters Compute the correlation between the two matrices Since the matrices are smmetric, onl the correlation between n(n-) / entries needs to be calculated. High correlation indicates that points that belong to the same cluster are close to each other. Not a good measure for some densit or contiguit based clusters. Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 87 Measuring Cluster Validit Via Correlation Correlation of incidence and proimit matrices for the K-means clusterings of the following two data sets..9.8.7.6.5.4.....4.6.8.9.8.7.6.5.4.....4.6.8 Corr = -.95 Corr = -.58 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 88

Using Similarit Matri for Cluster Validation Order the similarit matri with respect to cluster labels and inspect visuall..9.8.7.6.5.4.....4.6.8 Points 4 5 6 7 8 9.9.8.7.6.5.4... 4 6 8 Similarit Points Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 89 Using Similarit Matri for Cluster Validation Clusters in random data are not so crisp.9.8.7.9.8.7 Points 4 5 6.6.5.4.6.5.4 7 8 9... 4 6 8 Similarit Points.....4.6.8 DBSCAN Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9

Using Similarit Matri for Cluster Validation Clusters in random data are not so crisp.9.8.7.9.8.7 Points 4 5 6.6.5.4.6.5.4 7 8 9... 4 6 8 Similarit Points.....4.6.8 K-means Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9 Using Similarit Matri for Cluster Validation Clusters in random data are not so crisp Points 4 5 6 7 8 9.9.8.7.6.5.4... 4 6 8 Similarit Points.9.8.7.6.5.4.....4.6.8 Complete Link Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9

Using Similarit Matri for Cluster Validation.9 6 4 5 5.8.7.6.5.4 7 5 5 5 5 5... DBSCAN Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 9 Internal Measures: SSE Clusters in more complicated figures aren t well separated Internal Inde: Used to measure the goodness of a clustering structure without respect to eternal information SSE SSE is good for comparing two clusterings or two clusters (average SSE). Can also be used to estimate the number of clusters 6 4 - -4-6 5 5 5 5 5 K Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 94 SSE 9 8 7 6 5 4

Internal Measures: SSE SSE curve for a more complicated data set 6 4 5 7 SSE of clusters found using K-means Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 95 Framework for Cluster Validit Need a framework to interpret an measure. For eample, if our measure of evaluation has the value,, is that good, fair, or poor? Statistics provide a framework for cluster validit The more atpical a clustering result is, the more likel it represents valid structure in the data Can compare the values of an inde that result from random data or clusterings to those of a clustering result. If the value of the inde is unlikel, then the cluster results are valid These approaches are more complicated and harder to understand. For comparing the results of two different sets of cluster analses, a framework is less necessar. However, there is the question of whether the difference between two inde values is significant Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 96

Statistical Framework for SSE Eample Compare SSE of.5 against three clusters in random data Histogram shows SSE of three clusters in 5 sets of random data points of size distributed over the range..8 for and values.9.8.7.6.5.4.....4.6.8 Count 5 45 4 5 5 5 5.6.8...4.6.8...4 SSE Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 97 Statistical Framework for Correlation Correlation of incidence and proimit matrices for the K-means clusterings of the following two data sets..9.8.7.6.5.4.....4.6.8.9.8.7.6.5.4.....4.6.8 Corr = -.95 Corr = -.58 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 98

Internal Measures: Cohesion and Separation Cluster Cohesion: Measures how closel related are objects in a cluster Eample: SSE Cluster Separation: Measure how distinct or wellseparated a cluster is from other clusters Eample: Squared Error Cohesion is measured b the within cluster sum of squares (SSE) WSS = ( mi ) i C Separation is measured b the between cluster sum of squares BSS = C ( m i m i i Where C i is the size of cluster i i Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 99 ) Internal Measures: Cohesion and Separation Eample: SSE BSS + WSS = constant m m 4 m 5 K= cluster: K= clusters: WSS= ( ) + ( ) + (4 ) + (5 ) = BSS= 4 ( ) Total = + = WSS= (.5) + (.5) + (4 4.5) + (5 4.5) = BSS= (.5) + (4.5 ) Total = + 9 = = = 9 Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Internal Measures: Cohesion and Separation A proimit graph based approach can also be used for cohesion and separation. Cluster cohesion is the sum of the weight of all links within a cluster. Cluster separation is the sum of the weights between nodes in the cluster and nodes outside the cluster. cohesion separation Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Internal Measures: Silhouette Coefficient Silhouette Coefficient combine ideas of both cohesion and separation, but for individual points, as well as clusters and clusterings For an individual point, i Calculate a = average distance of i to the points in its cluster Calculate b = min (average distance of i to points in another cluster) The silhouette coefficient for a point is then given b s = a/b if a < b, (or s = b/a - if a b, not the usual case) Tpicall between and. The closer to the better. a b Can calculate the Average Silhouette width for a cluster or a clustering Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4

Eternal Measures of Cluster Validit: Entrop and Purit Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 Final Comment on Cluster Validit The validation of clustering structures is the most difficult and frustrating part of cluster analsis. Without a strong effort in this direction, cluster analsis will remain a black art accessible onl to those true believers who have eperience and great courage. Algorithms for Clustering Data, Jain and Dubes Tan,Steinbach, Kumar Introduction to Data Mining 4/8/4 4