Mining di Dati Web. Lezione 3 - Clustering and Classification

Similar documents
ECLT 5810 Clustering

ECLT 5810 Clustering

Cluster Analysis. CSE634 Data Mining

Unsupervised Learning

ECLT 5810 Evaluation of Classification Quality

Using Machine Learning to Optimize Storage Systems

CHAPTER 4: CLUSTER ANALYSIS

Data mining. Classification k-nn Classifier. Piotr Paszek. (Piotr Paszek) Data mining k-nn 1 / 20

Metrics for Performance Evaluation How to evaluate the performance of a model? Methods for Performance Evaluation How to obtain reliable estimates?

K-Nearest Neighbour Classifier. Izabela Moise, Evangelos Pournaras, Dirk Helbing

Hard clustering. Each object is assigned to one and only one cluster. Hierarchical clustering is usually hard. Soft (fuzzy) clustering

Unsupervised Learning

Introduction to Artificial Intelligence

Unsupervised Learning. Presenter: Anil Sharma, PhD Scholar, IIIT-Delhi

Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri

Supervised vs. Unsupervised Learning

Getting to Know Your Data

Cluster Analysis. Mu-Chun Su. Department of Computer Science and Information Engineering National Central University 2003/3/11 1

ECG782: Multidimensional Digital Signal Processing

K- Nearest Neighbors(KNN) And Predictive Accuracy

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

Clustering. Supervised vs. Unsupervised Learning

Gene Clustering & Classification

Semi-Supervised Clustering with Partial Background Information

Clustering. Partition unlabeled examples into disjoint subsets of clusters, such that:

Unsupervised Data Mining: Clustering. Izabela Moise, Evangelos Pournaras, Dirk Helbing

10701 Machine Learning. Clustering

Chapter 3: Supervised Learning

Cluster Analysis. Angela Montanari and Laura Anderlucci

CISC 4631 Data Mining

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2017)

Evaluation Measures. Sebastian Pölsterl. April 28, Computer Aided Medical Procedures Technische Universität München

Clustering and Visualisation of Data

Machine Learning using MapReduce

International Journal of Software and Web Sciences (IJSWS)

Exploratory Analysis: Clustering

CS249: ADVANCED DATA MINING

Data Mining. Lecture 03: Nearest Neighbor Learning

INF4820, Algorithms for AI and NLP: Evaluating Classifiers Clustering

Data Mining: Models and Methods

CS7267 MACHINE LEARNING NEAREST NEIGHBOR ALGORITHM. Mingon Kang, PhD Computer Science, Kennesaw State University

Basic Data Mining Technique

Classification Algorithms in Data Mining

Artificial Intelligence. Programming Styles

CS145: INTRODUCTION TO DATA MINING

Data Mining. 3.5 Lazy Learners (Instance-Based Learners) Fall Instructor: Dr. Masoud Yaghini. Lazy Learners

Weka ( )

Machine Learning. Nonparametric methods for Classification. Eric Xing , Fall Lecture 2, September 12, 2016

TRANSACTIONAL CLUSTERING. Anna Monreale University of Pisa

INF4820 Algorithms for AI and NLP. Evaluating Classifiers Clustering

Clustering. Lecture 6, 1/24/03 ECS289A

How do we obtain reliable estimates of performance measures?

Classification Part 4

Preprocessing Short Lecture Notes cse352. Professor Anita Wasilewska

CPSC 340: Machine Learning and Data Mining

Information Retrieval and Organisation

CSE 5243 INTRO. TO DATA MINING

Today. Lecture 4: Last time. The EM algorithm. We examine clustering in a little more detail; we went over it a somewhat quickly last time

CS 2750 Machine Learning. Lecture 19. Clustering. CS 2750 Machine Learning. Clustering. Groups together similar instances in the data sample

Lecture 6: Unsupervised Machine Learning Dagmar Gromann International Center For Computational Logic

What is Unsupervised Learning?

PARALLEL CLASSIFICATION ALGORITHMS

What to come. There will be a few more topics we will cover on supervised learning

MIA - Master on Artificial Intelligence

Machine Learning (BSMC-GA 4439) Wenke Liu

Lecture 6 K- Nearest Neighbors(KNN) And Predictive Accuracy

INTRODUCTION TO MACHINE LEARNING. Measuring model performance or error

Unsupervised Learning : Clustering

INF4820 Algorithms for AI and NLP. Evaluating Classifiers Clustering

Large Scale Data Analysis Using Deep Learning

Data Mining in Bioinformatics Day 1: Classification

BBS654 Data Mining. Pinar Duygulu. Slides are adapted from Nazli Ikizler

Introduction to Clustering

CSE 7/5337: Information Retrieval and Web Search Document clustering I (IIR 16)

MIT 801. Machine Learning I. [Presented by Anna Bosman] 16 February 2018

Naïve Bayes Classification. Material borrowed from Jonathan Huang and I. H. Witten s and E. Frank s Data Mining and Jeremy Wyatt and others

Machine Learning and Bioinformatics 機器學習與生物資訊學

Lesson 3. Prof. Enza Messina

Flat Clustering. Slides are mostly from Hinrich Schütze. March 27, 2017

Unsupervised Learning Partitioning Methods

Introduction to Pattern Recognition Part II. Selim Aksoy Bilkent University Department of Computer Engineering

Information Retrieval and Web Search Engines

Introduction to Information Retrieval

How do microarrays work

Text Documents clustering using K Means Algorithm

COMP 465: Data Mining Classification Basics

CS4491/CS 7265 BIG DATA ANALYTICS

APPLICATION OF MULTIPLE RANDOM CENTROID (MRC) BASED K-MEANS CLUSTERING ALGORITHM IN INSURANCE A REVIEW ARTICLE

Feature Selection. CE-725: Statistical Pattern Recognition Sharif University of Technology Spring Soleymani

Machine Learning (BSMC-GA 4439) Wenke Liu

Machine Learning for Signal Processing Clustering. Bhiksha Raj Class Oct 2016

Clustering CS 550: Machine Learning

Introduction to Mobile Robotics

Supervised Learning: Nearest Neighbors

Overview of Clustering

Lecture on Modeling Tools for Clustering & Regression

Nearest Neighbor Classification

Overview Citation. ML Introduction. Overview Schedule. ML Intro Dataset. Introduction to Semi-Supervised Learning Review 10/4/2010

Jarek Szlichta

CHAPTER 4 K-MEANS AND UCAM CLUSTERING ALGORITHM

Transcription:

Mining di Dati Web Lezione 3 - Clustering and Classification

Introduction Clustering and classification are both learning techniques They learn functions describing data Clustering is also known as Unsupervised Learning Classification is known as Supervised Learning

Clustering From Wikipedia, Data clustering: Data clustering is a common technique for statistical data analysis, which is used in many fields, including machine learning, data mining, pattern recognition, image analysis and bioinformatics. Clustering is the classification of similar objects into different groups, or more precisely, the partitioning of a data set into subsets (clusters), so that the data in each subset (ideally) share some common trait - often proximity according to some defined distance measure

Clustering A Toy Example

Sneak a Peak at Clustering: K-Means Randomly generate k clusters and determine the cluster centers or directly generate k seed points as cluster centers Assign each point to the nearest cluster center. Recompute the new cluster centers. Repeat until some convergence criterion is met (usually that the assignment hasn't changed).

d_intra or d_inter? That is the question! d_intra is the distance among elements (points or objects, or whatever) of the same cluster. d_inter is the distance among clusters. Questions: Should we use distance or similarity? Should we care about cluster shape? Should we care about clustering? Should we care about inter cluster distance?

d_intra, d_inter dintra d inter

Distance Functions Informal definition: The distance between two points is the length of a straight line segment between them. A more formal definition: A distance between two points P and Q in a metric space is d(p,q), where d is the distance function that defines the given metric space. We can also define the distance between two sets A and B in a metric space as being the minimum (or infimum) of distances between any two points P in A and Q in B.

Distance or Similarity? In a very straightforward way we can define the Similarity function sim: SxS => [0,1] as sim(o1,o2) = 1-d(o1,o2) where o1, o2 are elements of the space S. d = 0.3 d = 0.1 sim = 0.7 sim = 0.9

What does similar (or distant) really mean? Learning (either supervised or unsupervised) is impossible without ASSUMPTIONS Watanabe s Ugly Duckling theorem S. Watanabe, (1969). Knowing and Guessing: A Quantitative Study of Inference and Information. NY: Wiley. Wolpert s No Free Lunch theorem D.H. Wolpert, (2001). The supervised learning no-free-lunch theorems. Proc. 6th Online World Conference on Soft Computing. Learning is impossible without some sort of bias.

The Ugly Duckling theorems The theorem gets its fanciful name from the following counter-intuitive statement: assuming similarity is based on the number of shared predicates, an ugly duckling is as similar to a beautiful swan A as a beautiful swan B is to A, given that A and B differ at all. It was proposed and proved by Satoshi Watanabe in 1969.

Watanabe s Theorem Let n be the cardinality of the Universal set S. We have to classify them without prior knowledge on the essence of categories. The number of different classes, i.e. the different way to group the objects into clusters, is given by the cardinality of the Power Set of S: Pow(S) =2 n Without any prior information, the most natural way to measure the similarity among two distinct objects is to count the number of classes they share. Oooops They share exactly the same number of classes, namely 2 n-2.

The Ugly Duckling and 3 Beautiful Swans S={o1,o2,o3,o4} Pow(S) = { {}, {o1}, {o2}, {o3}, {o4}, {o1, o2}, {o1, o3}, {o1, o4}, {o2, o3}, {o2, o4}, {o3, o4}, {o1, o2, o3}, {o1, o2, o4}, {o1, o3, o4}, {o2, o3, o4}, {o1, o2, o3, o4} } How many classes have in common oi, oj i<>j? o1 and o3 ===> 4 = 2 2 o1 and o4 ===> 4 = 2 2

The Ugly Duckling and 3 Beautiful Swans In binary 0000, 0001, 0010, 0100, 1000, Choose two objects Reorder the bits so that the chosen objects are represented by the first two bits. How many strings share the first two bits set to 1? 2 n-2

Wolpert s No Free Lunch Theorem For any two algorithms, A and B, there exist datasets for which algorithm A outperform algorithm B in prediction accuracy on unseen instances. Proof: Take any Boolean concept. If A outperforms B on unseen instances, reverse the labels and B will outperforms A.

No Free Lunch Theorem

So Let s Get Back to Distances In a metric space a distance is a function d:sxs=>r so that if a,b,c are elements of S: d(a,b) 0 d(a,b) = 0 iff a=b d(a,b) = d(b,a) d(a,c) d(a,b) + d(b,c) The fourth property (triangular inequality) holds only if we are in a metric space.

Minkowski s Distance Let s consider two elements of a set S described by their feature vectors: x=(x1, x2,, xn) y=(y1, y2,, yn) The Minkowski s Distance is parametric in p>1 d ( p ) n ( x,y) p = x y i i i=1 1 p

Manhattan Distance (p=1) If p = 1 the distance is called Manhattan Distance. d ( 1 ) n i=1 ( x,y) = x y i i It is also called taxicab distance because it is the distance a car would drive in a city laid out in square blocks (if there are no one-way streets).

Euclidean Distance (p=2) If p = 2 the distance is the well know Euclidean Distance. d ( 2 ) n i=1 ( x,y) 2 = x y i i

Chebyshev Distance (p=infinity) If p = infinity then we must take the limit, the distance is called Chebyshev Distance. ( d ) ( x, y) = lim p n i=1 p x i y i 1 p = = max{ x 1 y 1, x 2 y 2, x n y } n

2D Cosine Similarity It s easy to explain in 2D. Let s consider a=(x1,y1) and b=(x2,y2). a b α

Cosine Similarity Let s consider two points x, y in R n. sim(x, y) = cosα = x y x y = = n i=1 x i y i n n 2 x i 2 y i i=1 i=1

Jaccard Distance Another commonly used distance is the Jaccard Distance: d(x,y) = n i=1 n i=1 min( x,y ) i i max( x,y ) i i

Binary Jaccard Distance In the case of binary feature vector the Jaccard Distance could be simplified to: d(x, y) = x y x y

Binary Edit Distance The binary edit distance, d(x,y), from a binary vector x to a binary vector y is the minimum number of simple flips required to transform one vector to the other d(x,y) = n i=1 ( 1 x 1 y ) i x=(0,1,0,0,1,1) y=(1,1,0,1,0,1) d(x,y)=3 The binary edit distance is equivalent to the Manhattan distance (Minkowski p=1) for binary features vectors.

Now it Makes More Sense: The K-Means Randomly generate k clusters and determine the cluster centers or directly generate k seed points as cluster centers Assign each point to the nearest cluster center. Recompute the new cluster centers. Repeat until some convergence criterion is met (usually that the assignment hasn't changed).

The Curse of High Dimensionality The dimensionality is one of the main problem to face when clustering data. Roughly speaking the higher the dimensionality the lower the power of recognizing similar objects.

A Visual Representation

Sphere/Sphere Volume Ratios

Clustering in Our Universe In our Universe, i.e. the Web, there are billions of documents made of millions of different words. Suppose 100 million different words. We have 100 million dimensions. We MUST face the curse of dimensionality!

Is K-Means Still Valid? We will see different approaches to Web Clustering. Anyway, YES! K-Means is definitely still an option!

Given: Categorization/ Classification A description of an instance, x in X, where X is the instance language or instance space. E.g: how to represent text documents. A fixed set of categories C = {c1, c2,, cn} Determine: The category of x: c(x) in C, where c(x) is a categorization function whose domain is X and whose range is C.

Classification Task Input: a training set of tuples, each labeled with one class label Output: a model (classifier) that assigns a class label to each tuple based on the other attributes The model can be used to predict the class of new tuples, for which the class label is missing or unknown

What is Classification? Data classification is a two-step process first step: a model is built describing a predetermined set of data classes or concepts. second step: the model is used for classification. Each tuple is assumed to belong to a predefined class, as determined by one of the attributes, called the class label attribute. Data tuples are also referred to as samples, examples, or objects.

Train and Test The tuples (examples, samples) are divided into training set + test set Classification model is built in two steps: training - build the model from the training set test - check the accuracy of the model using test set

Train and Test Kind of models: if - then rules logical formulae decision trees Accuracy of models: the known class of test samples is matched against the class predicted by the model accuracy rate = % of test set samples correctly classified by the model

Training Step training data Age Car Type Risk 20 Combi High 18 Sports High 40 Sports High 50 Family Low 35 Minivan Low 30 Combi High 32 Family Low 40 Combi Low Classification algorithm Classifier (model) if age < 31 or Car Type =Sports then Risk = High

Test Step test data Classifier (model) Age Car Type Risk 27 Sports High 34 Family Low 66 Family High 44 Sports High Risk High Low Low High

Classification Step new data Classifier (model) Age Car Type Risk 27 Sports 34 Minivan 55 Family 34 Sports Risk High Low Low High

Classification vs. Prediction There are two forms of data analysis that can be used to extract models describing data classes or to predict future data trends: classification: predict categorical labels prediction: models continuous-valued functions

Comparing Classification Methods Predictive accuracy: this refers to the ability of the model to correctly predict the class label of new or previously unseen data Speed: this refers to the computation costs involved in generating and using the model Robustness: this is the ability of the model to make correct predictions given noisy data or data with missing values

Comparing Classification Methods Scalability: this refers to the ability to construct the model efficiently given large amount of data Interpretability: this refers to the level of understanding and insight that is provided by the model Simplicity, e.g.: decision tree size rule compactness Domain-dependent quality indicators

Problem Formulation Given records in a database with a class label - find a model for each class. Age Car Type Risk 20 Combi High 18 Sports High 40 Sports High 50 Family Low 35 Minivan Low 30 Combi High 32 Family Low 40 Combi Low High Age < 31 High Car Type is sports Low

Classifier Accuracy The accuracy of a classifier on a given test set of samples is defined as the percentage of test samples correctly classified by the classifier, and it measures the overall performance of the classifier. Note that the accuracy of the classifier is not estimated on the training dataset, since it would not be a good indicator of the future accuracy on new data. The reason is that the classifier generated from the training dataset tends to overfit the training data, and any estimate of the classifier's accuracy based on that data will be overoptimistic.

Classifier Accuracy In other words, the classifier is more accurate on the data that was used to train the classifier, but very likely it will be less accurate on independent set of data. To predict the accuracy of the classifier on new data, we need to asses its accuracy on an independent dataset that played no part in the formation of the classifier. This dataset is called the test set It is important to note that the test dataset should not to be used in any way to built the classifier.

Classifier Accuracy There are several methods for estimating classifier accuracy. The choice of a method depends on the amount of sample data available for training and testing. If there are a lot of sample data, then the following simple holdout method is usually applied. The given set of samples is randomly partitioned into two independent sets, a training set and a test set (typically, 70% of the data is used for training, and the remaining 30% is used for testing) Provided that both sets of samples are representative, the accuracy of the classifier on the test set will give a good indication of accuracy on new data.

Stratification In general, it is difficult to say whether a given set of samples is representative or not, but at least we may ensure that the random sampling of the data set is done in such a way that the class distribution of samples in both training and test set is approximately the same as that in the initial data set.

Testing in Large Datasets Available examples 70% Divide randomly 30% Training Set used to develop one model Test Set check accuracy

Classifier Accuracy If the amount of data for training and testing is limited, the problem is how to use this limited amount of data for training to get a good classifier and for testing to obtain a correct estimation of the classifier accuracy? The standard and very common technique of measuring the accuracy of a classifier when the amount of data is limited is k-fold cross-validation In k-fold cross-validation, the initial set of samples is randomly partitioned into k approximately equal mutually exclusive subsets, called folds, S_1, S_2,..., S_k.

Classifier Accuracy Training and testing is performed k times. At each iteration, one fold is used for testing while remainder k-1 folds are used for training. So, at the end, each fold has been used exactly once for testing and k-1 for training. The accuracy estimate is the overall number of correct classifications from k iterations divided by the total number of samples N in the initial dataset. Often, the k-fold cross-validation technique is combined with stratification and is called stratified k-fold crossvalidation.

Testing in Small Datasets * cross-validation Repeat 10 times Available examples 90% 10% Training Set used to develop 10 different models Test Set check accuracy

Classifier Accuracy There are many other methods of estimating classifier accuracy on a particular dataset Two popular methods are leave-one-out cross-validation and the bootstrapping Leave-one-out cross-validation is simply N-fold cross-validation, where N is the number of samples in the initial dataset At each iteration, a single sample from the dataset is left out for testing, and remaining samples are used for training. The result of testing is either success or failure. The results of all N evaluations, one for each sample from the dataset, are averaged, and that average represents the final accuracy estimate.

Classifier Accuracy Bootstrapping is based on the sampling with replacement The initial dataset is sampled N times, where N is the total number of samples in the dataset, with replacement, to form another set of N samples for training. Since some samples in this new "set" will be repeated, so it means that some samples from the initial dataset will not appear in this training set. These samples will form a test set. Both mentioned estimation methods are interesting especially for estimating classifier accuracy for small datasets. In practice, the standard and most popular technique of estimating a classifier accuracy is stratified tenfold cross-validation

Accuracy Measures Actual Predicted Negative Positive Negative a b Positive c d Accuracy (A) = (a + d)/(a + b + c + d) Precision (P) = d / (b + d) Recall (R) = d / (c + d) F-Measure (F) = (2 * P * R) / (P + R)

The Lesson is Over