1. Trang chủ
  2. » Giáo Dục - Đào Tạo

chap4 basic classification

111 39 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 111
Dung lượng 1,64 MB

Nội dung

Data Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation Lecture Notes for Chapter Introduction to Data Mining by Tan, Steinbach, Kumar © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 Classification: Definition   Classification is the task of learning a target function f that maps each attribute set x to one of the predefined class labels y The target function is known as a classification model © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Classification: Definition   Descriptive Modeling – Distinguish between objects of different classes Predictive Modeling – Predict the class label of unknown records © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Classification—A Two-Step Process  Model construction: describing a set of predetermined classes – Each tuple/sample is assumed to belong to a predefined class, as determined by the class label attribute – The set of tuples used for model construction is training set – The model is represented as classification rules, decision trees, or mathematical formulae  Model usage: for classifying future or unknown objects – Estimate accuracy of the model The known label of test sample is compared with the classified result from the model Accuracy rate is the percentage of test set samples that are correctly classified by the model Test set is independent of training set (otherwise overfitting) – If the accuracy is acceptable, use the model to classify new data  Note: If the test set is used to select models, it is called validation (test) set © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Process (1): Model Construction Classification Algorithms Training Data NAME RANK M ike M ary B ill Jim D ave A nne A ssistant P rof A ssistant P rof P rofessor A ssociate P rof A ssistant P rof A ssociate P rof © Tan,Steinbach, Kumar YEARS TENURED 7 no yes yes yes no no Introduction to Data Mining Classifier (Model) IF rank = ‘professor’ OR years > THEN tenured = ‘yes’ 4/18/2004 ‹#› Process (2): Using the Model in Prediction Classifier Testing Data Unseen Data (Jeff, Professor, 4) NAME T om M erlisa G eorge Joseph RANK YEARS TENURED A ssistant P rof no A ssociate P rof no P rofessor yes A ssistant P rof yes © Tan,Steinbach, Kumar Introduction to Data Mining Tenured? 4/18/2004 ‹#› Illustrating Classification Task Tid Attrib1 Attrib2 Attrib3 Yes Large 125K No No Medium 100K No No Small 70K No Yes Medium 120K No No Large 95K Yes No Medium 60K No Yes Large 220K No No Small 85K Yes No Medium 75K No 10 No Small 90K Yes Learning algorithm Class Induction Learn Model Model 10 Training Set Tid Attrib1 Attrib2 Attrib3 11 No Small 55K ? 12 Yes Medium 80K ? 13 Yes Large 110K ? 14 No Small 95K ? 15 No Large 67K ? Apply Model Class Deduction 10 Test Set © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Examples of Classification Task  Predicting tumor cells as benign or malignant  Classifying credit card transactions as legitimate or fraudulent  Classifying secondary structures of protein as alpha-helix, beta-sheet, or random coil  Categorizing news stories as finance, weather, entertainment, sports, etc © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Evaluate the performance of a classification model © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Classification Techniques Decision Tree based Methods  Rule-based Methods  Memory based reasoning  Neural Networks  Naïve Bayes and Bayesian Belief Networks  Support Vector Machines  © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Model Evaluation  Metrics for Performance Evaluation – How to evaluate the performance of a model?  Methods for Performance Evaluation – How to obtain reliable estimates?  Methods for Model Comparison – How to compare the relative performance among competing models? © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› ROC (Receiver Operating Characteristic) Developed in 1950s for signal detection theory to analyze noisy signals – Characterize the trade-off between positive hits and false alarms  ROC curve plots TP (on the y-axis) against FP (on the x-axis)  Performance of each classifier represented as a point on the ROC curve – changing the threshold of algorithm, sample distribution or cost matrix changes the location of the point  © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› ROC Curve - 1-dimensional data set containing classes (positive and negative) - any points located at x > t is classified as positive At threshold t: TP=0.5, FN=0.5, FP=0.12, FN=0.88 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› ROC Curve (TP,FP):  (0,0): declare everything to be negative class  (1,1): declare everything to be positive class  (1,0): ideal  Diagonal line: – Random guessing – Below diagonal line: prediction is opposite of the true class  © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Using ROC for Model Comparison  No model consistently outperform the other  M1 is better for small FPR  M2 is better for large FPR  Area Under the ROC curve  Ideal:  Area  Random guess:  Area © Tan,Steinbach, Kumar Introduction to Data Mining =1 = 0.5 4/18/2004 ‹#› How to Construct an ROC curve Instance P(+|A) True Class 0.95 + 0.93 + 0.87 - 0.85 - 0.85 - 0.85 + 0.76 - 0.53 + 0.43 - 10 0.25 + • Use classifier that produces posterior probability for each test instance P(+|A) • Sort the instances according to P(+|A) in decreasing order • Apply threshold at each unique value of P(+|A) • Count the number of TP, FP, TN, FN at each threshold • TP rate, TPR = TP/(TP+FN) • FP rate, FPR = FP/(FP + TN) © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› How to construct an ROC curve + - + - - - + - + + 0.25 0.43 0.53 0.76 0.85 0.85 0.85 0.87 0.93 0.95 1.00 TP 4 3 3 2 FP 5 4 1 0 TN 0 1 4 5 FN 1 2 2 3 TPR 0.8 0.8 0.6 0.6 0.6 0.6 0.4 0.4 0.2 FPR 1 0.8 0.8 0.6 0.4 0.2 0.2 0 Class P Threshold >= ROC Curve: © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Test of Significance  Given two models: – Model M1: accuracy = 85%, tested on 30 instances – Model M2: accuracy = 75%, tested on 5000 instances  Can we say M1 is better than M2? – How much confidence can we place on accuracy of M1 and M2? – Can the difference in performance measure be explained as a result of random fluctuations in the test set? © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Confidence Interval for Accuracy  Prediction can be regarded as a Bernoulli trial – A Bernoulli trial has possible outcomes – Possible outcomes for prediction: correct or wrong – Collection of Bernoulli trials has a Binomial distribution:    x  Bin(N, p) x: number of correct predictions e.g: Toss a fair coin 50 times, how many heads would turn up? Expected number of heads = Np = 50  0.5 = 25 Given x (# of correct predictions) or equivalently, acc=x/N, and N (# of test instances), Can we predict p (true accuracy of model)? © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Confidence Interval for Accuracy  Area = -  For large test sets (N > 30), – acc has a normal distribution with mean p and variance p(1-p)/N P( Z   /2 acc  p Z p(1  p) / N 1 / )  1  Z/2 Z1-  /2 Confidence Interval for p:  N  acc  Z  Z   N  acc   N  acc p 2( N  Z )  /2  /2  /2 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Confidence Interval for Accuracy  Consider a model that produces an accuracy of 80% when evaluated on 100 test instances: – N=100, acc = 0.8 – Let 1- = 0.95 (95% confidence) – From probability table, Z/2=1.96 1- Z 0.99 2.58 0.98 2.33 N 50 100 500 1000 5000 0.95 1.96 p(lower) 0.670 0.711 0.763 0.774 0.789 0.90 1.65 p(upper) 0.888 0.866 0.833 0.824 0.811 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Comparing Performance of Models  Given two models, say M1 and M2, which is better? – – – – M1 is tested on D1 (size=n1), found error rate = e1 M2 is tested on D2 (size=n2), found error rate = e2 Assume D1 and D2 are independent If n1 and n2 are sufficiently large, then e1 ~ N 1 ,   e2 ~ N 2 ,   e (1  e ) – Approximate: ˆ  n i i i i © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Comparing Performance of Models  To test if performance difference is statistically significant: d = e1 – e2 – d ~ N(dt,t) where dt is the true difference – Since D1 and D2 are independent, their variance adds up:       ˆ  ˆ t 2 2 2 e1(1  e1) e2(1  e2)   n1 n2 – At (1-) confidence level, © Tan,Steinbach, Kumar d  d  Z ˆ Introduction to Data Mining t  /2 t 4/18/2004 ‹#› An Illustrative Example Given: M1: n1 = 30, e1 = 0.15 M2: n2 = 5000, e2 = 0.25  d = |e2 – e1| = 0.1 (2-sided test)  0.15(1  0.15) 0.25(1  0.25) ˆ    0.0043 30 5000 d  At 95% confidence level, Z/2=1.96 d  0.100  1.96  0.0043  0.100  0.128 t => Interval contains => difference may not be statistically significant © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 ‹#› Comparing Performance of Algorithms  Each learning algorithm may produce k models: – L1 may produce M11 , M12, …, M1k – L2 may produce M21 , M22, …, M2k  If models are generated on the same test sets D1,D2, …, Dk (e.g., via cross-validation) – For each set: compute dj = e1j – e2j – dj has mean dt and variance t k – Estimate:  (d  d ) ˆ  j 1 j k (k  1) d  d  t ˆ t t © Tan,Steinbach, Kumar 1 , k 1 Introduction to Data Mining t 4/18/2004 ‹#›

Ngày đăng: 05/11/2019, 11:13

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w