msc bd 5002/it 5210: knowledge discovery and data...

151
1 1 MSC BD 5002/IT 5210: Knowledge Discovery and Data Mining Acknowledgement: Slides modified by Dr. Lei Chen based on the slides provided by Jiawei Han, Micheline Kamber, and Jian Pei ©2012 Han, Kamber & Pei. All rights reserved.

Upload: others

Post on 11-Apr-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

11

MSC BD 5002/IT 5210: Knowledge Discovery and Data

Mining

Acknowledgement: Slides modified by Dr. Lei Chen based on the slides provided by Jiawei Han, Micheline Kamber, and

Jian Pei©2012 Han, Kamber & Pei. All rights reserved.

Page 2: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

22

Chapter 3: Data Preprocessing

n Data Preprocessing: An Overview

n Data Quality

n Major Tasks in Data Preprocessing

n Data Cleaning

n Data Integration

n Data Reduction

n Data Transformation and Data Discretization

n Summary

Page 3: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

3

Data Quality: Why Preprocess the Data?

n Measures for data quality: A multidimensional view

n Accuracy: correct or wrong, accurate or not

n Completeness: not recorded, unavailable, …

n Consistency: some modified but some not, dangling, …

n Timeliness: timely update?

n Believability: how trustable the data are correct?

n Interpretability: how easily the data can be understood?

Page 4: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

4

Major Tasks in Data Preprocessing

n Data cleaningn Fill in missing values, smooth noisy data, identify or remove

outliers, and resolve inconsistenciesn Data integration

n Integration of multiple databases, data cubes, or filesn Data reduction

n Dimensionality reductionn Numerosity reductionn Data compression

n Data transformation and data discretizationn Normalization n Concept hierarchy generation

Page 5: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

55

Chapter 3: Data Preprocessing

n Data Preprocessing: An Overview

n Data Quality

n Major Tasks in Data Preprocessing

n Data Cleaning

n Data Integration

n Data Reduction

n Data Transformation and Data Discretization

n Summary

Page 6: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

6

Data Cleaning

n Data in the Real World Is Dirty: Lots of potentially incorrect data, e.g., instrument faulty, human or computer error, transmission errorn incomplete: lacking attribute values, lacking certain attributes of

interest, or containing only aggregate datan e.g., Occupation=“ ” (missing data)

n noisy: containing noise, errors, or outliersn e.g., Salary=“−10” (an error)

n inconsistent: containing discrepancies in codes or names, e.g.,n Age=“42”, Birthday=“03/07/2010”n Was rating “1, 2, 3”, now rating “A, B, C”n discrepancy between duplicate records

n Intentional (e.g., disguised missing data)n Jan. 1 as everyone’s birthday?

Page 7: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

7

Incomplete (Missing) Data

n Data is not always availablen E.g., many tuples have no recorded value for several

attributes, such as customer income in sales datan Missing data may be due to

n equipment malfunctionn inconsistent with other recorded data and thus deletedn data not entered due to misunderstandingn certain data may not be considered important at the

time of entryn not register history or changes of the data

n Missing data may need to be inferred

Page 8: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

8

How to Handle Missing Data?

n Ignore the tuple: usually done when class label is missing (when doing classification)—not effective when the % of missing values per attribute varies considerably

n Fill in the missing value manually: tedious + infeasible?n Fill in it automatically with

n a global constant : e.g., “unknown”, a new class?! n the attribute meann the attribute mean for all samples belonging to the

same class: smartern the most probable value: inference-based such as

Bayesian formula or decision tree

Page 9: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

9

Noisy Data

n Noise: random error or variance in a measured variablen Incorrect attribute values may be due to

n faulty data collection instrumentsn data entry problemsn data transmission problemsn technology limitationn inconsistency in naming convention

n Other data problems which require data cleaningn duplicate recordsn incomplete datan inconsistent data

Page 10: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

10

How to Handle Noisy Data?

n Binningn first sort data and partition into (equal-frequency) binsn then one can smooth by bin means, smooth by bin

median, smooth by bin boundaries, etc.n Regression

n smooth by fitting the data into regression functionsn Clustering

n detect and remove outliersn Combined computer and human inspection

n detect suspicious values and check by human (e.g., deal with possible outliers)

Page 11: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

1111

Chapter 3: Data Preprocessing

n Data Preprocessing: An Overview

n Data Quality

n Major Tasks in Data Preprocessing

n Data Cleaning

n Data Integration

n Data Reduction

n Data Transformation and Data Discretization

n Summary

Page 12: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

1212

Data Integration

n Data integration: n Combines data from multiple sources into a coherent store

n Schema integration: e.g., A.cust-id º B.cust-#n Integrate metadata from different sources

n Entity identification problem: n Identify real world entities from multiple data sources, e.g., Bill

Clinton = William Clintonn Detecting and resolving data value conflicts

n For the same real world entity, attribute values from different sources are different

n Possible reasons: different representations, different scales, e.g., metric vs. British units

Page 13: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

EntityResolutionforBigData

Lise GetoorUniversityofMaryland

CollegePark,MD

Ashwin MachanavajjhalaDukeUniversityDurham,NC

http://www.cs.umd.edu/~getoor/Tutorials/ER_KDD2013.pdfhttp://goo.gl/7tKiiL

13

Page 14: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

WhatisEntityResolution?Problemofidentifyingandlinking/groupingdifferent

manifestationsofthesamerealworldobject.

Examplesofmanifestationsandobjects:• Differentwaysofaddressing(names,emailaddresses,FaceBook

accounts)thesamepersonintext.• Webpageswithdifferingdescriptionsofthesamebusiness.• Differentphotosofthesameobject.• …

14

Page 15: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

WhatisEntityResolution?

15

Page 16: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Ironically,EntityResolutionhasmanyduplicatenames

Doubles

DuplicatedetectionRecordlinkage

Deduplication

ObjectidentificationObjectconsolidation

Coreference resolution

Entityclustering

Referencereconciliation

ReferencematchingHouseholding

Householdmatching

Fuzzymatch

Approximatematch

Merge/purge

Hardeningsoftdatabases

Identityuncertainty

16

Page 17: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

ERMotivatingExamples• LinkingCensusRecords• PublicHealth• Websearch• Comparisonshopping• Counter-terrorism• KnowledgeGraphConstruction• …

17

Page 18: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

TraditionalChallengesinER• Name/Attributeambiguity

ThomasCruise

MichaelJordan

18

Page 19: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

TraditionalChallengesinER• Name/Attributeambiguity• Errorsduetodataentry

19

Page 20: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

TraditionalChallengesinER• Name/Attributeambiguity• Errorsduetodataentry• MissingValues

[Gilletal;Univ ofOxford2003]20

Page 21: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

TraditionalChallengesinER• Name/Attributeambiguity• Errorsduetodataentry• MissingValues• ChangingAttributes

• Dataformatting

• Abbreviations/DataTruncation21

Page 22: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Big-DataERChallenges

22

Page 23: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Big-DataERChallenges• LargerandmoreDatasets

– Needefficientparalleltechniques

• MoreHeterogeneity– Unstructured,UncleanandIncompletedata.Diversedatatypes.– Nolongerjustmatchingnameswithnames,butAmazonprofileswith

browsinghistoryonGoogleandfriendsnetworkinFacebook.

23

Page 24: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Big-DataERChallenges• LargerandmoreDatasets

– Needefficientparalleltechniques

• MoreHeterogeneity– Unstructured,UncleanandIncompletedata.Diversedatatypes.

• Morelinked– Needtoinferrelationshipsinadditionto“equality”

• Multi-Relational– Dealwithstructureofentities(AreWalmart andWalmart Pharmacy

thesame?)

• Multi-domain– Customizablemethodsthatspanacrossdomains

• Multipleapplications(websearchversuscomparisonshopping)– Servediverseapplicationwithdifferentaccuracyrequirements

24

Page 25: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

ERReferences• Book/SurveyArticles

– DataQualityandRecordLinkageTechniques[T.Herzog,F.Scheuren,W.Winkler,Springer,’07]

– DuplicateRecordDetection[A.Elmagrid,P.Ipeirotis,V.Verykios,TKDE‘07]– AnIntroductiontoDuplicateDetection[F.Naumann,M.Herschel,M&P

synthesislectures2010]– EvaluationofEntityResolutionApproachedonReal-worldMatchProblems

[H.Kopke,A.Thor,E.Rahm,PVLDB2010]– DataMatching[P.Christen,Springer2012]

• Tutorials– RecordLinkage:SimilaritymeasuresandAlgorithms

[N.Koudas,S.Sarawagi,D.Srivatsava SIGMOD‘06]– Datafusion--Resolvingdataconflictsforintegration

[X.Dong,F.Naumann VLDB‘09]– EntityResolution:Theory,PracticeandOpenChallenges

http://goo.gl/Ui38o [L.Getoor,A.Machanavajjhala AAAI‘12]25

Page 26: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Notation• R:setofrecords/mentions(typed)• H:setofrelations/hyperedges (typed)• M:setofmatches(recordpairsthatcorrespondtosameentity)

• N:setofnon-matches(recordpairscorrespondingtodifferententities)• E:setofentities• L:setoflinks

• True(Mtrue,Ntrue,Etrue,Ltrue):accordingtorealworldvs Predicted(Mpred,Npred,Epred,Lpred ):byalgorithm

26

Page 27: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

RelationshipbetweenMtrue andMpred

• Mtrue (SameAs ,Equivalence)• Mpred (Similarrepresentationsandsimilarattributes)

MtrueRxR Mpred

27

Page 28: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Metrics• Pairwise metrics

– Precision/Recall,F1– #ofpredictedmatchingpairs

• Clusterlevelmetrics– purity,completeness,complexity– Precision/Recall/F1:Cluster-level,closestcluster,MUC,B3 ,RandIndex

– Generalizedmergedistance[Menestrina etal,PVLDB10]

• Littleworkthatevaluatescorrectpredictionoflinks

28

Page 29: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

TypicalAssumptionsMade• Eachrecord/mentionisassociatedwithasinglerealworldentity.

• Inrecordlinkage,noduplicatesinthesamesource• Iftworecords/mentionsareidentical,thentheyaretruematches

(,)ε Mtrue29

Page 30: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

ERversusClassificationFindingmatchesvs non-matchesisaclassificationproblem

• Imbalanced:typicallyO(R)matches,O(R^2)non-matches

• Instancesarepairsofrecords.PairsarenotIID

(,)ε Mtrue

(,)ε Mtrue

(,)ε MtrueAND

30

Page 31: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

ERvs (Multi-relational)ClusteringComputingentitiesfromrecordsisaclusteringproblem

• Intypicalclusteringalgorithms(k-means,LDA,etc.)numberofclustersisaconstantorsublinearinR.

• InER:numberofclustersislinearinR,andaverageclustersizeisaconstant.Significantfractionofclustersaresingletons.

31

Page 32: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

MOTIVATING  EXAMPLE:  BIBLIOGRAPHIC  DOMAIN  

45  

Page 33: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

En##es  &  Rela#ons  in  Bibliographic  Domain    

Wrote

Paper Title # of Authors Topic Word1 Word 2 … WordN

Cites

Author Name Research Area

Author Mention NameString

Paper Mention TitleString

Institution Name

Institute Mention NameString

Venue Name

Venue Mention NameString

WorksAt

AppearsIn

:  co-­‐occurrence  rela#onships  :  resolu#on  rela#onships  

:  en#ty  rela#onships  

47  

Page 34: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

DATA  PREPARATION  &    MATCH  FEATURES  

PART  2-­‐a  

48  

Page 35: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Normaliza#on  •  Schema  normaliza#on  

–  Schema  Matching  –  e.g.,  contact  number  and  phone  number  –  Compound  a]ributes  –  full  address  vs  str,city,state,zip  –  Nested  a]ributes  

•  List  of  features  in  one  dataset  (air  condi#oning,  parking)    vs  each  feature  a  boolean  a]ribute  

–  Set  valued  a]ributes  •  Set  of  phones  vs  primary/secondary  phone  

–  Record  segmenta#on  from  text  

•  Data    normaliza#on  –  OOen  convert  to  all  lower/all  upper;  remove  whitespace  –  detec#ng  and  correc#ng  values  that  contain  known  typographical  errors  or  

varia#ons,    –  expanding  abbrevia#ons  and  replacing  them  with  standard  forms;  replacing  

nicknames  with  their  proper  name  forms  –  Usually  done  based  on  dic#onaries  (e.g.,  commercial  dic#onaries,  postal  addresses,  

etc.)   49  

Page 36: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Normaliza#on  •  Schema  normaliza#on  

–  Schema  Matching  –  e.g.,  contact  number  and  phone  number  –  Compound  a]ributes  –  full  address  vs  str,city,state,zip  –  Nested  a]ributes  

•  List  of  features  in  one  dataset  (air  condi#oning,  parking)    vs  each  feature  a  boolean  a]ribute  

–  Set  valued  a]ributes  •  Set  of  phones  vs  primary/secondary  phone  

–  Record  segmenta#on  from  text  

•  Data    normaliza#on  –  OOen  convert  to  all  lower/all  upper;  remove  whitespace  –  detec#ng  and  correc#ng  values  that  contain  known  typographical  errors  or  

varia#ons,    –  expanding  abbrevia#ons  and  replacing  them  with  standard  forms;  replacing  

nicknames  with  their  proper  name  forms  –  Usually  done  based  on  dic#onaries  (e.g.,  commercial  dic#onaries,  postal  addresses,  

etc.)   50  

Page 37: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Matching  Features  •  For  two  references  x  and  y,  compute  a  “comparison”  vector  of  

similarity  scores  of  component  a]ribute.    –  [    1st-­‐author-­‐match-­‐score,    

     paper-­‐match-­‐score,          venue-­‐match-­‐score,          year-­‐match-­‐score,        ….        ]  

•  Similarity  scores  –  Boolean  (match  or  not-­‐match)  –  Real  values  based  on  distance  func#ons  

52  

Page 38: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Summary  of  Matching  Features  

•  Equality  on  a  boolean  predicate  •  Edit  distance  

–  Levenstein,  Smith-­‐Waterman,  Affine  

•  Set  similarity  –  Jaccard,  Dice  

•  Vector  Based  –  Cosine  similarity,  TFIDF  

•  Useful  packages:  –  SecondString,  h]p://secondstring.sourceforge.net/  –  Simmetrics:  h]p://sourceforge.net/projects/simmetrics/  –  LingPipe,  h]p://alias-­‐i.com/lingpipe/index.html  

•  Alignment-­‐based  or  Two-­‐#ered  –  Jaro-­‐Winkler,  SoO-­‐TFIDF,  Monge-­‐Elkan  

•  Phone#c  Similarity  –  Soundex  

•  Transla#on-­‐based  •  Numeric  distance  between  values  •  Domain-­‐specific  

Good  for  Names  

Good  for  Text  like  reviews/  tweets   Useful  for  

abbreviaKons,  alternate  names.  

Handle  Typographical  errors  

53  

Page 39: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Rela#onal  Matching  Features  •  Rela#onal  features  are  oOen  set-­‐based  

–  Set  of  coauthors  for  a  paper  –  Set  of  ci#es  in  a  country  –  Set  of  products  manufactured  by  manufacturer  

•  Can  use  set  similarity  func#ons  men#oned  earlier  –  Common  Neighbors:                    Intersec#on  size  –  Jaccard’s  Coefficient:            Normalize  by  union  size  –  Adar  Coefficient:                          Weighted  set  similarity  

•  Can  reason  about  similarity  in  sets  of  values  –  Average  or  Max  –  Other  aggregates  

54  

Page 40: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PAIRWISE  MATCHING  PART  2-­‐b  

55  

Page 41: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Pairwise  Match  Score  Problem:  Given  a  vector  of  component-­‐wise  similari#es  for  a  pair  of  

records  (x,y),  compute  P(x  and  y  match).      Solu#ons:  1.  Weighted  sum  or  average  of  component-­‐wise  similarity  scores.  

Threshold  determines  match  or  non-­‐match.    –  0.5*1st-­‐author-­‐match-­‐score  +  0.2*venue-­‐match-­‐score  +  0.3*paper-­‐match-­‐score.    –  Hard  to  pick  weights.  

•  Match  on  last  name  match  more  predic<ve  than  login  name.  •  Match  on  “Smith”  less  predic<ve  than  match  on  “Getoor”  or  “Machanavajjhala”.  

–  Hard  to  tune  a  threshold.      

56  

Page 42: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Pairwise  Match  Score  Problem:  Given  a  vector  of  component-­‐wise  similari#es  for  a  pair  of  

records  (x,y),  compute  P(x  and  y  match).      Solu#ons:  1.  Weighted  sum  or  average  of  component-­‐wise  similarity  scores.  

Threshold  determines  match  or  non-­‐match.    2.  Formulate  rules  about  what  cons#tutes  a  match.  

–  (1st-­‐author-­‐match-­‐score  >  0.7  AND  venue-­‐match-­‐score  >  0.8)    OR  (paper-­‐match-­‐score  >  0.9  AND  venue-­‐match-­‐score  >  0.9)  

–  Manually  formula#ng  the  right  set  of  rules  is  hard.    

57  

Page 43: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Fellegi  &  Sunter  Model  [FS,  Science  ‘69]  •  Record  pair:  r  =  (x,y)  in  A  x  B  

•  γ  =  γ(r)  is  a  comparison  vector  –  E.g.,  γ  =  [“Is  x.name  =  y.name?”,  “Is  x.address  =  y.address?”  …]  –  Assume  binary  vector  for  simplicity  

•  M  :  set  of  matching  pairs  of  records  •  U  :  set  of  non-­‐matching  pairs  of  records    

58  

Page 44: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

•  r  =  (x,y)  is  record  pair,  γ  is  comparison  vector,  M  matches,  U  non-­‐matches  

 •  Linkage  decisions  are  based  on:  

 •  Linkage  Rule:  L(tl,  tu)  

       

 

Fellegi  &  Sunter  Model  [FS,  Science  ‘69]  

59  

tl tU

MATCH  NON-­‐MATCH   UNCERTAIN  

Page 45: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Error  due  to  a  Linkage  Rule    •  Type  I  Error:  r  =  (x,y)  in  U,  but  the  linkage  rule  calls  it  a  match      

•  Type  II  Error:  r  =  (x,y)  in  M,  but  the  linkage  rule  calls  it  a  non-­‐match  

61  

Page 46: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Op#mal  Linkage  Rule  •  L*  =  (tl*,  tu*)  is  an  op#mal  decision  rule  for  comparison  space  Γ  

with  error  bounds  μ  and  λ,  if  

–  L*  meets  the  type  I  and  type  II  requirements  

–  L*  has  the  least    condi#onal  probabili#es  of  not  making  a  decision.    That  is  for  all  other  decision  rules  L  (with  error  bounds  μ  and  λ),    

62  

Page 47: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Finding  the  Op#mal  Linkage  Rule  •  Suppose  there  are  N  comparison  vectors  •  Sort  them  in  decreasing  order  of  m(γ)  /  u(γ)

 •  Pick  the  largest  n  and  n’  such  that:    

63  

Page 48: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Using  Fellegi  Sunter  in  Prac#ce  •  Γ  is  usually  high  dimensional  (compu#ng  m(γ)  and  u(γ)  is  

inefficient)    –  Use  condi#onal  independence  of  features  in  γ  given  match  or  non-­‐match  –  Naïve  Bayes  assump#on  

•  Compu#ng  P(γ  |  r  ε  M)  requires  some  knowledge  of  matches.  –  Supervised  learning  (assume  a  training  set  is  provided)  –   EM-­‐based  techniques  can  used  to  learn  the  parameters  jointly  while  

iden#fying  matches.    

64  

Page 49: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

ML  Pairwise  Approaches  •  Supervised  machine  learning  algorithms  

–  Decision  trees  •  [Cochinwala  et  al,  IS01]  

–  Support  vector  machines  •  [Bilenko  &  Mooney,  KDD03];  [Christen,  KDD08]  

–  Ensembles  of  classifiers  •  [Chen  et  al.,  SIGMOD09]  

–  Condi#onal  Random  Fields  (CRF)  •  [Gupta  &  Sarawagi,  VLDB09]  

–  …  and  many  others.  

•  Issues:  –  Training  set  generaKon  –  Imbalanced  classes  –  many  more  nega#ves  than  posi#ves  (even  aOer  

elimina#ng  obvious  non-­‐matches  …  using  Blocking)  –  Misclassifica#on  cost    

65  

Page 50: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Crea#ng  a  Training  Set  is  a  key  issue  •  Construc#ng  a  training  set  is  hard  –  since  most  pairs  of  records  are  “easy  non-­‐matches”.    –  100  records  from  100  ci#es.    –  Only  106  pairs  out  of  total  108  (1%)  come  from  the  same  city  

•  Some  pairs  are  hard  to  judge  even  by  humans  –  Inherently  ambiguous    

•  E.g.,  Paris  Hilton  (person  or  business)  – Missing  a]ributes    

•  Starbucks,  Toronto  vs  Starbucks,  Queen  Street  ,Toronto  

66  

Page 51: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Avoiding  Training  Set  Genera#on  •  Unsupervised  /  Semi-­‐supervised  Techniques  

–  EM  based  techniques  to  learn  parameters  •  [Winkler  ‘06,  Herzog  et  al  ’07]  

–  Genera#ve  Models  •  [Ravikumar  &  Cohen,  UAI04]  

•  Ac#ve  Learning  –  Commi]ee  of  Classifiers  

•  [Sarawagi  et  al  KDD  ’00,  Tajeda  et  al  IS  ‘01]  –  Provably  op#mizing  precision/recall  

•  [Arasu  et  al  SIGMOD  ‘10,  Bellare  et  al  KDD  ‘12]  –  Crowdsourcing  

•  [Wang  et  al  VLDB  ‘12,  Marcus  et  al  VLDB  ’12,  …]  

67  

Page 52: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Commi]ee  of  Classifiers  [Tejada  et  al,  IS  ‘01]  

68  

Page 53: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Ac#ve  Learning  with  Provable  Guarantees  

•  Most  ac#ve  learning  techniques  minimize  0-­‐1  loss    [Beygelzimer  et  al  NIPS  2010].  

•  However,  ER  is  very  imbalanced:  –  Number  of  non-­‐matches  >  100  *  number  of  matches.  –  Classifying  all  pairs  as  “non-­‐matches”  has  low  0-­‐1  loss  (<  1%).  

•  Hence,  need  ac#ve  learning  techniques  that  maximize  precision/recall.    

69  

Page 54: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Ac#ve  Learning  with  Provable  Guarantees  

•  Monotonicity  of  Precision  [Arasu  et  al  SIGMOD  ‘10]    

There  is  a  larger  fracKon  of  matches  in  C1  than  in  C2.    

Algorithm  searches  for  the  opKmal  classifier  using  binary  search  on  each  dimension  

70  

Page 55: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Ac#ve  Learning  with  Provable  Guarantees  

[Bellare  et  al  KDD  ‘12]  

1.  Precision  Constrained  à  Weighted  0-­‐1  Loss  Problem    (using  a  Lagrange  Mul#plier  λ).  

2.  Given  a  fixed  value  for  λ,  weighted  0-­‐1  Loss  can  be  op#mized  by  (one  call  to)  a  blackbox  ac#ve  learning  classifier.  

3.  Right  value  of  λ  is  computed  by  searching  over  all  op#mal  classifiers.  –  Classifiers  are  embedded  in  a  2-­‐d  plane  (precision/recall)  –   Search  is  along  the  convex  hull  of  the  embedded  classifiers  

 

O  (log2  n)  calls  to  a  blackbox  0-­‐1  loss  acKve  learning  algorithm.    

ExponenKally  smaller  label  complexity  than  [Arasu  et  al  SIGMOD  ‘10]    (in  the  worst  case).    

71  

Page 56: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Crowdsourcing  •  Growing  interest  in  integra#ng  human  computa#on  in  declara#ve  

workflow  engines.    –  ER  is  an  important  problem  (e.g.,  for  evalua#ng  fuzzy  joins)  –  [Wang  et  al  VLDB  ‘12,  Marcus  et  al  VLDB  ’12,  …]  

•  Opportunity:  u#lize  crowdsourcing  for  crea#ng  training  sets,                                                  or  for  ac#ve  learning.    

•  Key  open  issue:  Handling  errors  in  human  judgments  –  In  an  experiment  on  Amazon  Mechanical  Turk:    

•  Pairwise  matching  judgment,  each  given  to  5  different  people  –  Majority  of  workers  agreed  on  truth  on  only  90%  of  pairwise  judgments.    

72  

Page 57: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Summary  of  Single-­‐En#ty  ER  Algorithms  

•  Many  algorithms  for  independent  classifica#on  of  pairs  of  records  as  match/non-­‐match  

•  ML  based  classifica#on  &  Fellegi-­‐Sunter    –  Pro:  Advanced  state  of  the  art  –  Con:  Building  high  fidelity  training  sets  is  a  hard  problem  

•  Ac#ve  Learning  &  Crowdsourcing  for  ER  are  ac#ve  areas  of  research.  

73  

Page 58: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

3232

Handling Redundancy in Data Integration

n Redundant data occur often when integration of multiple databasesn Object identification: The same attribute or object

may have different names in different databasesn Derivable data: One attribute may be a “derived”

attribute in another table, e.g., annual revenuen Redundant attributes may be able to be detected by

correlation analysis and covariance analysisn Careful integration of the data from multiple sources may

help reduce/avoid redundancies and inconsistencies and improve mining speed and quality

Page 59: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

33

Correlation Analysis (Nominal Data)

n Χ2 (chi-square) test

n The larger the Χ2 value, the more likely the variables are related

n The cells that contribute the most to the Χ2 value are those whose actual count is very different from the expected count

n Correlation does not imply causalityn # of hospitals and # of car-theft in a city are correlatedn Both are causally linked to the third variable: population

å -=

ExpectedExpectedObserved 2

2 )(c

Page 60: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

34

Chi-Square Calculation: An Example

n Χ2 (chi-square) calculation (numbers in parenthesis are expected counts calculated based on the data distribution in the two categories)

n It shows that like_science_fiction and play_chess are correlated in the group

93.507840

)8401000(360

)360200(210

)21050(90

)90250( 22222 =

-+

-+

-+

-=c

Play chess Not play chess Sum (row)Like science fiction 250(90) 200(360) 450

Not like science fiction 50(210) 1000(840) 1050

Sum(col.) 300 1200 1500

Page 61: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

35

Correlation Analysis (Numeric Data)

n Correlation coefficient (also called Pearson’s product moment coefficient)

where n is the number of tuples, and are the respective means of A and B, σA and σB are the respective standard deviation of A and B, and Σ(aibi) is the sum of the AB cross-product.

n If rA,B > 0, A and B are positively correlated (A’s values increase as B’s). The higher, the stronger correlation.

n rA,B = 0: independent; rAB < 0: negatively correlated

BA

n

i ii

BA

n

i iiBA n

BAnban

BbAar

ssss )1()(

)1())((

11, -

-=

-

--= åå ==

A B

Page 62: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

36

Visually Evaluating Correlation

Scatter plots showing the similarity from –1 to 1.

Page 63: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

37

Correlation (viewed as linear relationship)n Correlation measures the linear relationship

between objectsn To compute correlation, we standardize data

objects, A and B, and then take their dot product

)(/))((' AstdAmeanaa kk -=

)(/))((' BstdBmeanbb kk -=

''),( BABAncorrelatio •=

Page 64: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

38

Covariance (Numeric Data)

n Covariance is similar to correlation

where n is the number of tuples, and are the respective mean or expected values of A and B, σA and σB are the respective standard deviation of A and B.

n Positive covariance: If CovA,B > 0, then A and B both tend to be larger than their expected values.

n Negative covariance: If CovA,B < 0 then if A is larger than its expected value, B is likely to be smaller than its expected value.

n Independence: CovA,B = 0 but the converse is not true:n Some pairs of random variables may have a covariance of 0 but are not

independent. Only under some additional assumptions (e.g., the data follow multivariate normal distributions) does a covariance of 0 imply independence

A B

Correlation coefficient:

Page 65: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Co-Variance: An Example

n It can be simplified in computation as

n Suppose two stocks A and B have the following values in one week: (2, 5), (3, 8), (5, 10), (4, 11), (6, 14).

n Question: If the stocks are affected by the same industry trends, will their prices rise or fall together?

n E(A) = (2 + 3 + 5 + 4 + 6)/ 5 = 20/5 = 4

n E(B) = (5 + 8 + 10 + 11 + 14) /5 = 48/5 = 9.6

n Cov(A,B) = (2×5+3×8+5×10+4×11+6×14)/5 − 4 × 9.6 = 4

n Thus, A and B rise together since Cov(A, B) > 0.

Page 66: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

4040

Chapter 3: Data Preprocessing

n Data Preprocessing: An Overview

n Data Quality

n Major Tasks in Data Preprocessing

n Data Cleaning

n Data Integration

n Data Reduction

n Data Transformation and Data Discretization

n Summary

Page 67: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

41

Data Reduction Strategies

n Data reduction: Obtain a reduced representation of the data set that is much smaller in volume but yet produces the same (or almost the same) analytical results

n Why data reduction? — A database/data warehouse may store terabytes of data. Complex data analysis may take a very long time to run on the complete data set.

n Data reduction strategiesn Dimensionality reduction, e.g., remove unimportant attributes

n Wavelet transformsn Principal Components Analysis (PCA)n Feature subset selection, feature creation

n Numerosity reduction (some simply call it: Data Reduction)n Regression and Log-Linear Modelsn Histograms, clustering, samplingn Data cube aggregation

n Data compression

Page 68: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

42

Data Reduction 1: Dimensionality Reductionn Curse of dimensionality

n When dimensionality increases, data becomes increasingly sparsen Density and distance between points, which is critical to clustering, outlier

analysis, becomes less meaningfuln The possible combinations of subspaces will grow exponentially

n Dimensionality reductionn Avoid the curse of dimensionalityn Help eliminate irrelevant features and reduce noisen Reduce time and space required in data miningn Allow easier visualization

n Dimensionality reduction techniquesn Wavelet transformsn Principal Component Analysisn Supervised and nonlinear techniques (e.g., feature selection)

Page 69: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

43

Mapping Data to a New Space

Two Sine Waves Two Sine Waves + Noise Frequency

n Fourier transformn Wavelet transform

Page 70: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

44

What Is Wavelet Transform?

n Decomposes a signal into different frequency subbandsn Applicable to n-

dimensional signalsn Data are transformed to

preserve relative distance between objects at different levels of resolution

n Allow natural clusters to become more distinguishable

n Used for image compression

Page 71: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

45

Wavelet Transformation

n Discrete wavelet transform (DWT) for linear signal processing, multi-resolution analysis

n Compressed approximation: store only a small fraction of the strongest of the wavelet coefficients

n Similar to discrete Fourier transform (DFT), but better lossy compression, localized in space

n Method:n Length, L, must be an integer power of 2 (padding with 0’s, when

necessary)n Each transform has 2 functions: smoothing, differencen Applies to pairs of data, resulting in two set of data of length L/2n Applies two functions recursively, until reaches the desired length

Haar2 Daubechie4

Page 72: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Introduction toWavelets

http://www.math.tau.ac.il/~turkel/notes/wavelets.pdf

Page 73: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Background

Page 74: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Fourier Analysisn Breaks down a signal into constituent

sinusoids of different frequencies

In other words: Transform the view of the signal from time-base to frequency-base.

Page 75: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

What’s wrong with Fourier?

n FT is only the function of , frequency.n By using Fourier Transform , we loose the time information :

WHEN did a particular event take place ?n Fourier Transform can not locate drift, trends, abrupt

changes, beginning and ends of events, etc.n Fourier Transform is unable to pick out local frequency

content. It has a “hard time” representing functions that are oscillatory or discontinuous (Gibbs phenomena)

n Frequency domain Jn Temporal domain L

F f t e d tj t( ) ( ) ,wp

w= -

¥

ò12

w

Page 76: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Wavelet Analysis

Page 77: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

What is Wavelet Analysis ?

n And…what is a wavelet…?

n A wavelet is a waveform of effectively limited duration that has an average value of zero.

Page 78: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Wavelet's properties

n Short time localized waves with zero integral value.

n Possibility of time shifting.n Flexibility.

Page 79: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Wavelet Analysis Detailn Wavelet transform decomposes a

signal into a set of basis functions (wavelets)

n Wavelets are obtained from a single prototype wavelet Ψ(t) called motherwavelet by dilations and shifting:

n where a is the scaling parameter and b is the shifting parameter

)(1)(, abt

atba

-= yy

Page 80: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Scalingn Wavelet analysis produces a time-scale

view of the signal.n Scaling means stretching or

compressing of the signal.n scale factor (a) for sine waves:

f t a

f t a

f t a

t

t

t

( )

( )

( )

sin( )

sin( )

sin( )

= =

= =

= =

;

;

;

1

2 12

4 14

Page 81: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Scaling

n Scale factor works exactly the same with wavelets:

f t a

f t a

f t a

t

t

t

( )

( )

( )

( )

( )

( )

= =

= =

= =

Y

Y

Y

;

;

;

1

2 12

4 14

Page 82: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Wavelet function

( ) ( )aby

abx

abbayx

yxyx--Y=Y ,1, ,,

n b – shift coefficient

n a – scale coefficient

n 2D function

( ) ( )abx

xba-Y=Y

a1

,

Page 83: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Haar transformn A Haar wavelet is the simplest type of wavelet. n In discrete form, Haar wavelets are related to a

mathematical operation called the Haar transform. n The Haar transform serves as a prototype for all other

wavelet transforms.

Page 84: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Haar transformn Like all wavelet transforms, the Haar transform

decomposes a discrete signal into two subsignals of half its length.

n One subsignal is a running average or trend; the other subsignal is a running difference or fluctuation.

Page 85: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Haar Transform Example1. Find the average of each pair of samples. Fill the first

half of the array with averages. (first trend subsignal)

1 3 5 71. Iteration

(1+3)/2 = 2 (5+7)/2 = 6

Original Signal

62

Page 86: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Haar Wavelet Transform1. Find the average of each pair of samples. Fill the first half

of the array with averages. 2. Find the difference between the average and the

samples. Fill the second half of the array with differences. (first fluctuation subsignal)

1 3 5 71. Iteration -1-162

1-2 = -1 5-6= -1

Original Signal

Page 87: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Haar Wavelet Transform1. Find the average of each pair of samples. Fill the first half

of the array with averages. 2. Find the difference between the average and the

samples. Fill the second half of the array with differences.3. Repeat the process on the first half of the array.

Original Signal 1 3 5 71. Iteration

2. Iteration -1

-1-1

-1

6

-2

2

4

Page 88: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

A more complicated example

Page 89: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

A more complicated example

Page 90: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

A more complicated example

Page 91: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

A more complicated example

Page 92: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

66

Wavelet Decomposition

n Wavelets: A math tool for space-efficient hierarchical decomposition of functions

n S = [2, 2, 0, 2, 3, 5, 4, 4] can be transformed to S^ = [23/4, -11/4, 1/2, 0, 0, -1, -1, 0]

n Compression: many small detail coefficients can be replaced by 0’s, and only the significant coefficients are retained

Page 93: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

67

Haar Wavelet Coefficients Coefficient “Supports”

2 2 0 2 3 5 4 4

-1.25

2.75

0.5 0

0 -1 0-1

+

-+

+

+ + +

+

+

- -

- - - -

+-+

+ -+ -

+-+-

-++--1

-1

0.5

0

2.75

-1.25

0

0Original frequency distribution

Hierarchical decomposition structure (a.k.a. “error tree”)

Page 94: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

68

Why Wavelet Transform?

n Use hat-shape filtersn Emphasize region where points clustern Suppress weaker information in their boundaries

n Effective removal of outliersn Insensitive to noise, insensitive to input order

n Multi-resolutionn Detect arbitrary shaped clusters at different scales

n Efficientn Complexity O(N)

n Only applicable to low dimensional data

Page 95: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

69

x2

x1

e

Principal Component Analysis (PCA)

n Find a projection that captures the largest amount of variation in datan The original data are projected onto a much smaller space, resulting

in dimensionality reduction. We find the eigenvectors of the covariance matrix, and these eigenvectors define the new space

Page 96: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

What is PCA?n Principal components analysis (PCA):

Dimensionality Reduction and Feature Construction¨PCA is used to reduce dimensions of data

without much loss of information. ¨Used in machine learning and in signal

processing and image compression (among other things).

Page 97: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Goal of PCA§ We wish to explain/summarize the underlying

variance-covariance structure of a large set of variables through a few linear combinations of these variables.

Page 98: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Background for PCAn Suppose attributes are A1 and A2, and we

have n training examples. x’s denote values of A1 and y’s denote values of A2 over the training examples.

n Variance of an attribute A1:

)1(

)()var( 1

2

1 -

-=å=

n

xxA

n

ii

Page 99: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

n Covariance of two attributes A1 and A2 :

¨ If covariance is positive, both dimensions increase together.

¨ If negative, as one increases, the other decreases. ¨ Zero: independent of each other.

)1(

))((),cov( 121 -

--=å=

n

yyxxAA

n

iii

Background for PCA

Page 100: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

n Covariance matrix¨Suppose we have n attributes, A1, ..., An. ¨Covariance matrix:

),cov( where),( ,, jijijinn AAccC ==´

Background for PCA

Page 101: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Covariance matrix÷÷ø

öççè

æ=

÷÷ø

öççè

æ=

÷÷ø

öççè

æ

3705.1045.1047.47

)var(5.1045.104)var(

),cov(),cov(),cov(),cov(

MH

MMHMMHHH

Example

Page 102: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

n Eigenvectors: ¨ Let M be an n´n matrix.

n v is an eigenvector of M if M ´ v = lvn l is called the eigenvalue associated with v

¨ For any eigenvector v of M and scalar a,

¨ Thus you can always choose eigenvectors of length 1:

¨ If M has any eigenvectors, it has n of them, and they are orthogonal to one another.

¨ Thus eigenvectors can be used as a new basis for a n-dimensional vector space.

vvM aa l=´

1... 221 =++ nvv

Background for PCA

Page 103: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

A 2D Numerical Example

Page 104: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 1

n Subtract the meanq From each of the data dimensions, all the x values

have x subtracted and y values have y subtracted from them. This produces a data set whose mean is zero.

q Subtracting the mean makes variance and covariance calculation easier by simplifying their equations. The variance and co-variance values are not affected by the mean value.

Page 105: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 1

§ Given original data set S = {x1, ..., xk}, produce new set by subtracting the mean of attribute Ai from each xi.

Mean: 1.81 1.91 Mean: 0 0

Page 106: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 2

n Calculate the covariance matrix

cov = .616555556 .615444444.615444444 .716555556

n since the non-diagonal elements in this covariance matrix are positive, we should expect that both the x and y variable increase together.

x yx

y

Page 107: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 3

n Calculate the (unit )eigenvectors and eigenvalues of the covariance matrix

eigenvalues = .04908339891.28402771

eigenvectors = -.735178656 -.677873399.677873399 -.735178656

Page 108: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 3•eigenvectors are plotted as diagonal dotted lines on the plot. •Note they are perpendicular to each other.•Note one of the eigenvectors goes through the middle of the points, like drawing a line of best fit. •The second eigenvector gives us the other, less important, pattern in the data, that all the points follow the main line, but are off to the side of the main line by some amount.

Page 109: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 4

n Reduce dimensionality and form feature vectorthe eigenvector with the highest eigenvalue is the principle component of the data set.

In our example, the eigenvector with the larges eigenvalue was the one that pointed down the middle of the data.

Once eigenvectors are found from the covariance matrix, the next step is to order them by eigenvalue, highest to lowest. This gives you the components in order of significance.

Page 110: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 4

Now, if you like, you can decide to ignore the components of lesser significance.

You do lose some information, but if the eigenvalues are small, you don’t lose much

n n dimensions in your data n calculate n eigenvectors and eigenvaluesn choose only the first p eigenvectorsn final data set has only p dimensions.

Page 111: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 4

n Order eigenvectors by eigenvalue, highest to lowest.

n In general, you get n components.To reduce dimensionality to p, ignore n-p components at the bottom of the list.

0490833989.677873399.735178956.

28402771.1735178956.677873399.

2

1

=÷÷ø

öççè

æ-=

=÷÷ø

öççè

æ--

=

l

l

v

v

Page 112: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 4

n Feature VectorFeatureVector = (eig1 eig2 eig3 … eign)

We can either form a feature vector with both of the eigenvectors:

-.677873399 -.735178656 -.735178656 .677873399

or, we can choose to leave out the smaller, less significant component and only have a single column:

- .677873399 - .735178656

Page 113: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 5

n Deriving the new dataFinalData = RowFeatureVector x RowZeroMeanDataRowFeatureVector is the matrix with the eigenvectors in the columns transposed so that the eigenvectors are now in the rows, with the most significant eigenvector at the topRowZeroMeanData is the mean-adjusted data transposed, ie. the data items are in each column, with each row holding a separate dimension.

Page 114: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 5

n Deriving the new dataFinalData = RowFeatureVector x RowZeroMeanData (RowDataAdjust)

( )735178956.677873399.2

677873399.735178956.735178956.677873399.

1

--=

÷÷ø

öççè

æ-

--=

VectorRowFeature

VectorRowFeature

÷÷ø

öççè

æ---------

=01.131.81.31.79.09.129.99.21.149.71.31.81.19.49.29.109.39.31.169.

ustRowDataAdj

Page 115: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 5FinalData transpose: dimensions along columnsx y

-.827970186 -.1751153071.77758033 .142857227-.992197494 .384374989-.274210416 .130417207-1.67580142 -.209498461-.912949103 .175282444.0991094375 -.3498246981.14457216 .0464172582.438046137 .01776462971.22382056 -.162675287

Page 116: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 5

Page 117: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

PCA Example –STEP 5

Page 118: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Reconstruction of original Data

n If we reduced the dimensionality, obviously, when reconstructing the data we would lose those dimensions we chose to discard. In our example let us assume that we considered only the x dimension…

n We did:TransformedData = RowFeatureVector ´

RowDataAdjustso we can do RowDataAdjust = RowFeatureVector -1 ´

TransformedData = RowFeatureVector T ´ TransformedData and RowDataOriginal = RowDataAdjust + OriginalMean

Page 119: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

Reconstruction of original Datax

-.827970186 1.77758033 -.992197494 -.274210416 -1.67580142 -.912949103 .0991094375 1.14457216 .438046137 1.22382056

Page 120: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

94

n Given N data vectors from n-dimensions, find k ≤ n orthogonal vectors (principal components) that can be best used to represent data n Normalize input data: Each attribute falls within the same rangen Compute k orthonormal (unit) vectors, i.e., principal componentsn Each input data (vector) is a linear combination of the k principal

component vectorsn The principal components are sorted in order of decreasing

“significance” or strengthn Since the components are sorted, the size of the data can be

reduced by eliminating the weak components, i.e., those with low variance (i.e., using the strongest principal components, it is possible to reconstruct a good approximation of the original data)

n Works for numeric data only

Principal Component Analysis (Steps)

Page 121: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

95

Attribute Subset Selection

n Another way to reduce dimensionality of datan Redundant attributes

n Duplicate much or all of the information contained in one or more other attributes

n E.g., purchase price of a product and the amount of sales tax paid

n Irrelevant attributesn Contain no information that is useful for the data

mining task at handn E.g., students' ID is often irrelevant to the task of

predicting students' GPA

Page 122: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

96

Heuristic Search in Attribute Selection

n There are 2d possible attribute combinations of d attributesn Typical heuristic attribute selection methods:

n Best single attribute under the attribute independence assumption: choose by significance tests

n Best step-wise feature selection:n The best single-attribute is picked firstn Then next best attribute condition to the first, ...

n Step-wise attribute elimination:n Repeatedly eliminate the worst attribute

n Best combined attribute selection and eliminationn Optimal branch and bound:

n Use attribute elimination and backtracking

Page 123: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

97

Attribute Creation (Feature Generation)

n Create new attributes (features) that can capture the important information in a data set more effectively than the original ones

n Three general methodologiesn Attribute extraction

n Domain-specificn Mapping data to new space (see: data reduction)

n E.g., Fourier transformation, wavelet transformation, manifold approaches (not covered)

n Attribute construction n Combining features (see: discriminative frequent

patterns in Chapter 7)n Data discretization

Page 124: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

98

Data Reduction 2: Numerosity Reductionn Reduce data volume by choosing alternative, smaller

forms of data representationn Parametric methods (e.g., regression)

n Assume the data fits some model, estimate model parameters, store only the parameters, and discard the data (except possible outliers)

n Ex.: Log-linear models—obtain value at a point in m-D space as the product on appropriate marginal subspaces

n Non-parametric methodsn Do not assume modelsn Major families: histograms, clustering, sampling, …

Page 125: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

99

Parametric Data Reduction: Regression and Log-Linear Models

n Linear regressionn Data modeled to fit a straight linen Often uses the least-square method to fit the line

n Multiple regressionn Allows a response variable Y to be modeled as a

linear function of multidimensional feature vectorn Log-linear model

n Approximates discrete multidimensional probability distributions

Page 126: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

100

Regression Analysis

n Regression analysis: A collective name for techniques for the modeling and analysis of numerical data consisting of values of a dependent variable (also called response variable or measurement) and of one or more independent variables (aka. explanatory variables or predictors)

n The parameters are estimated so as to give a "best fit" of the data

n Most commonly the best fit is evaluated by using the least squares method, but other criteria have also been used

n Used for prediction (including forecasting of time-series data), inference, hypothesis testing, and modeling of causal relationships

y

x

y = x + 1

X1

Y1

Y1’

Page 127: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

101

n Linear regression: Y = w X + bn Two regression coefficients, w and b, specify the line and are to be

estimated by using the data at handn Using the least squares criterion to the known values of Y1, Y2, …,

X1, X2, ….n Multiple regression: Y = b0 + b1 X1 + b2 X2

n Many nonlinear functions can be transformed into the aboven Log-linear models:

n Approximate discrete multidimensional probability distributionsn Estimate the probability of each point (tuple) in a multi-dimensional

space for a set of discretized attributes, based on a smaller subset of dimensional combinations

n Useful for dimensionality reduction and data smoothing

Regress Analysis and Log-Linear Models

Page 128: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

102

Histogram Analysis

n Divide data into buckets and store average (sum) for each bucket

n Partitioning rules:n Equal-width: equal bucket

rangen Equal-frequency (or equal-

depth)

0510152025303540

10000

20000

30000

40000

50000

60000

70000

80000

90000

100000

Page 129: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

103

Clustering

n Partition data set into clusters based on similarity, and store cluster representation (e.g., centroid and diameter) only

n Can be very effective if data is clustered but not if data is “smeared”

n Can have hierarchical clustering and be stored in multi-dimensional index tree structures

n There are many choices of clustering definitions and clustering algorithms

n Cluster analysis will be studied in depth in Chapter 10

Page 130: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

104

Sampling

n Sampling: obtaining a small sample s to represent the whole data set N

n Allow a mining algorithm to run in complexity that is potentially sub-linear to the size of the data

n Key principle: Choose a representative subset of the datan Simple random sampling may have very poor

performance in the presence of skewn Develop adaptive sampling methods, e.g., stratified

sampling: n Note: Sampling may not reduce database I/Os (page at a

time)

Page 131: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

105

Types of Sampling

n Simple random samplingn There is an equal probability of selecting any particular

itemn Sampling without replacement

n Once an object is selected, it is removed from the population

n Sampling with replacementn A selected object is not removed from the population

n Stratified sampling: n Partition the data set, and draw samples from each

partition (proportionally, i.e., approximately the same percentage of the data)

n Used in conjunction with skewed data

Page 132: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

106

Sampling: With or without Replacement

Raw Data

Page 133: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

107

Sampling: Cluster or Stratified Sampling

Raw Data Cluster/Stratified Sample

Page 134: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

108

Data Cube Aggregation

n The lowest level of a data cube (base cuboid)n The aggregated data for an individual entity of interestn E.g., a customer in a phone calling data warehouse

n Multiple levels of aggregation in data cubesn Further reduce the size of data to deal with

n Reference appropriate levelsn Use the smallest representation which is enough to

solve the taskn Queries regarding aggregated information should be

answered using data cube, when possible

Page 135: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

109

Data Reduction 3: Data Compression

n String compressionn There are extensive theories and well-tuned algorithmsn Typically lossless, but only limited manipulation is

possible without expansionn Audio/video compression

n Typically lossy compression, with progressive refinementn Sometimes small fragments of signal can be

reconstructed without reconstructing the wholen Time sequence is not audio

n Typically short and vary slowly with timen Dimensionality and numerosity reduction may also be

considered as forms of data compression

Page 136: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

110

Data Compression

Original Data Compressed Data

lossless

Original DataApproximated

Page 137: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

111

Chapter 3: Data Preprocessing

n Data Preprocessing: An Overview

n Data Quality

n Major Tasks in Data Preprocessing

n Data Cleaning

n Data Integration

n Data Reduction

n Data Transformation and Data Discretization

n Summary

Page 138: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

112

Data Transformation

n A function that maps the entire set of values of a given attribute to a new set of replacement values s.t. each old value can be identified with one of the new values

n Methodsn Smoothing: Remove noise from datan Attribute/feature construction

n New attributes constructed from the given onesn Aggregation: Summarization, data cube constructionn Normalization: Scaled to fall within a smaller, specified range

n min-max normalizationn z-score normalizationn normalization by decimal scaling

n Discretization: Concept hierarchy climbing

Page 139: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

113

Normalization

n Min-max normalization: to [new_minA, new_maxA]

n Ex. Let income range $12,000 to $98,000 normalized to [0.0, 1.0]. Then $73,000 is mapped to

n Z-score normalization (μ: mean, σ: standard deviation):

n Ex. Let μ = 54,000, σ = 16,000. Thenn Normalization by decimal scaling

716.00)00.1(000,12000,98000,12600,73

=+---

AAA

AA

A minnewminnewmaxnewminmaxminvv _)__(' +--

-=

A

Avvsµ-

='

j

vv10

'= Where j is the smallest integer such that Max(|ν’|) < 1

225.1000,16

000,54600,73=

-

Page 140: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

114

Discretization

n Three types of attributesn Nominal—values from an unordered set, e.g., color, professionn Ordinal—values from an ordered set, e.g., military or academic

rank n Numeric—real numbers, e.g., integer or real numbers

n Discretization: Divide the range of a continuous attribute into intervalsn Interval labels can then be used to replace actual data values n Reduce data size by discretizationn Supervised vs. unsupervisedn Split (top-down) vs. merge (bottom-up)n Discretization can be performed recursively on an attributen Prepare for further analysis, e.g., classification

Page 141: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

115

Data Discretization Methods

n Typical methods: All the methods can be applied recursivelyn Binning

n Top-down split, unsupervisedn Histogram analysis

n Top-down split, unsupervisedn Clustering analysis (unsupervised, top-down split or

bottom-up merge)n Decision-tree analysis (supervised, top-down split)n Correlation (e.g., c2) analysis (unsupervised, bottom-up

merge)

Page 142: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

116

Simple Discretization: Binning

n Equal-width (distance) partitioningn Divides the range into N intervals of equal size: uniform gridn if A and B are the lowest and highest values of the attribute, the

width of intervals will be: W = (B –A)/N.n The most straightforward, but outliers may dominate presentationn Skewed data is not handled well

n Equal-depth (frequency) partitioningn Divides the range into N intervals, each containing approximately

same number of samplesn Good data scalingn Managing categorical attributes can be tricky

Page 143: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

117

Binning Methods for Data Smoothing

q Sorted data for price (in dollars): 4, 8, 9, 15, 21, 21, 24, 25, 26, 28, 29, 34

* Partition into equal-frequency (equi-depth) bins:- Bin 1: 4, 8, 9, 15- Bin 2: 21, 21, 24, 25- Bin 3: 26, 28, 29, 34

* Smoothing by bin means:- Bin 1: 9, 9, 9, 9- Bin 2: 23, 23, 23, 23- Bin 3: 29, 29, 29, 29

* Smoothing by bin boundaries:- Bin 1: 4, 4, 4, 15- Bin 2: 21, 21, 25, 25- Bin 3: 26, 26, 26, 34

Page 144: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

118

Discretization Without Using Class Labels(Binning vs. Clustering)

Data Equal interval width (binning)

Equal frequency (binning) K-means clustering leads to better results

Page 145: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

119

Discretization by Classification & Correlation Analysis

n Classification (e.g., decision tree analysis)

n Supervised: Given class labels, e.g., cancerous vs. benign

n Using entropy to determine split point (discretization point)

n Top-down, recursive split

n Details to be covered in Chapter 7

n Correlation analysis (e.g., Chi-merge: χ2-based discretization)

n Supervised: use class information

n Bottom-up merge: find the best neighboring intervals (thosehaving similar distributions of classes, i.e., low χ2 values) to merge

n Merge performed recursively, until a predefined stopping condition

Page 146: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

120

Concept Hierarchy Generation

n Concept hierarchy organizes concepts (i.e., attribute values) hierarchically and is usually associated with each dimension in a data warehouse

n Concept hierarchies facilitate drilling and rolling in data warehouses to view data in multiple granularity

n Concept hierarchy formation: Recursively reduce the data by collecting and replacing low level concepts (such as numeric values for age) by higher level concepts (such as youth, adult, or senior)

n Concept hierarchies can be explicitly specified by domain experts and/or data warehouse designers

n Concept hierarchy can be automatically formed for both numeric and nominal data. For numeric data, use discretization methods shown.

Page 147: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

121

Concept Hierarchy Generation for Nominal Data

n Specification of a partial/total ordering of attributes explicitly at the schema level by users or expertsn street < city < state < country

n Specification of a hierarchy for a set of values by explicit data groupingn {Urbana, Champaign, Chicago} < Illinois

n Specification of only a partial set of attributesn E.g., only street < city, not others

n Automatic generation of hierarchies (or attribute levels) by the analysis of the number of distinct valuesn E.g., for a set of attributes: {street, city, state, country}

Page 148: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

122

Automatic Concept Hierarchy Generation

n Somehierarchiescanbeautomaticallygeneratedbasedontheanalysisofthenumberofdistinctvaluesperattributeinthedatasetn Theattributewiththemostdistinctvaluesisplacedatthelowestlevelofthehierarchy

n Exceptions,e.g.,weekday,month,quarter,year

country

province_or_ state

city

street

15 distinct values

365 distinct values

3567 distinct values

674,339 distinct values

Page 149: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

123

Chapter 3: Data Preprocessing

n Data Preprocessing: An Overview

n Data Quality

n Major Tasks in Data Preprocessing

n Data Cleaning

n Data Integration

n Data Reduction

n Data Transformation and Data Discretization

n Summary

Page 150: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

124

Summaryn Data quality: accuracy, completeness, consistency, timeliness,

believability, interpretabilityn Data cleaning: e.g. missing/noisy values, outliersn Data integration from multiple sources:

n Entity identification problemn Remove redundanciesn Detect inconsistencies

n Data reductionn Dimensionality reductionn Numerosity reductionn Data compression

n Data transformation and data discretizationn Normalizationn Concept hierarchy generation

Page 151: MSC BD 5002/IT 5210: Knowledge Discovery and Data Miningleichen/courses/mscbd-5002/lectures/03... · 2020-02-15 · 7 Incomplete (Missing) Data n Data is not always available n E.g.,

125

References

n D.P.BallouandG.K.Tayi.Enhancingdataqualityindatawarehouseenvironments.Comm.ofACM,42:73-78,1999

n A.Bruce,D.Donoho,andH.-Y.Gao.Waveletanalysis.IEEESpectrum,Oct1996n T.DasuandT.Johnson.ExploratoryDataMiningandDataCleaning.JohnWiley,2003n J.DevoreandR.Peck.Statistics:TheExplorationandAnalysisofData.DuxburyPress,1997.n H.Galhardas,D.Florescu,D.Shasha,E.Simon,andC.-A.Saita.Declarativedatacleaning:

Language,model,andalgorithms.VLDB'01n M.HuaandJ.Pei.Cleaningdisguisedmissingdata:Aheuristicapproach.KDD'07n H.V.Jagadish,etal.,SpecialIssueonDataReductionTechniques.BulletinoftheTechnical

CommitteeonDataEngineering,20(4),Dec.1997n H.LiuandH.Motoda(eds.).FeatureExtraction,Construction,andSelection:ADataMining

Perspective.KluwerAcademic,1998n J.E.Olson.DataQuality:TheAccuracyDimension.MorganKaufmann,2003n D.Pyle.DataPreparationforDataMining.MorganKaufmann,1999n V.RamanandJ.Hellerstein.PottersWheel:AnInteractiveFrameworkforDataCleaningand

Transformation,VLDB’2001n T.Redman.DataQuality:TheFieldGuide.DigitalPress(Elsevier),2001n R.Wang,V.Storey,andC.Firth.Aframeworkforanalysisofdataqualityresearch.IEEETrans.

KnowledgeandDataEngineering,7:623-640,1995