Download presentation

Presentation is loading. Please wait.

Published byLexus Hatter Modified about 1 year ago

1
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine ICS 278: Data Mining Exploratory Data Analysis and Visualization

2
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Lecture 4 Project proposals due next Thursday Today’s lecture –Exploratory Data Analysis and Visualization Summary statistics 1 and 2 dimensional data visualization Higher dimensional visualization Examples of complex visualization –Reading: Chapter 3 in the text –Note: slides at end of last lecture on covariance, Mahalanobis distance, etc, will be revisited in next lecture

3
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Exploratory Data Analysis (EDA) get a general sense of the data interactive and visual –(cleverly/creatively) exploit human visual power to see patterns 1 to 5 dimensions (e.g. spatial, color, time, sound) –e.g. plot raw data/statistics, reduce dimensions as needed data-driven (model-free) especially useful in early stages of data mining –detect outliers (e.g. assess data quality) –test assumptions (e.g. normal distributions or skewed?) –identify useful raw data & transforms (e.g. log(x)) Bottom line: it is always well worth looking at your data!

4
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Summary Statistics not visual sample statistics of data X –mean: = i X i / n { minimizes i (X i - ) 2 } –mode: most common value in X –median: X=sort(X), median = X n/2 (half below, half above) –quartiles of sorted X: Q1 value = X 0.25n, Q3 value = X 0.75 n interquartile range: value(Q3) - value(Q1) range: max(X) - min(X) = X n - X 1 –variance: 2 = i (X i - ) 2 / n –skewness: i (X i - ) 3 / [ ( i (X i - ) 2 ) 3/2 ] zero if symmetric; right-skewed more common (e.g. you v. Bill Gates) –number of distinct values for a variable (see unique.m in MATLAB) –Note: all of these are estimates based on the sample at hand – they may be different from the “true” values (e.g., median age in US).

5
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Exploratory Data Analysis Tools for Displaying Single Variables

6
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Histogram Most common form: split data range into equal-sized bins Then for each bin, count the number of points from the data set that fall into the bin. –Vertical axis: Frequency (i.e., counts for each bin) –Horizontal axis: Response variable The histogram graphically shows the following: 1.center (i.e., the location) of the data; 2.spread (i.e., the scale) of the data; 3.skewness of the data; 4.presence of outliers; and 5.presence of multiple modes in the data.

7
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Issues with Histograms For small data sets, histograms can be misleading. Small changes in the data or to the bucket boundaries can result in very different histograms. Interactive bin-width example (online applet) –http://www.stat.sc.edu/~west/javahtml/Histogram.htmlhttp://www.stat.sc.edu/~west/javahtml/Histogram.html For large data sets, histograms can be quite effective at illustrating general properties of the distribution. Can smooth histogram using a variety of techniques –E.g., kernel density estimation (pages in text) Histograms effectively only work with 1 variable at a time –Difficult to extend to 2 dimensions, not possible for >2 –So histograms tell us nothing about the relationships among variables

8
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Histogram Example classical bell-shaped, symmetric histogram with most of the frequency counts bunched in the middle and with the counts dying off out in the tails. From a physical science/engineering point of view, the Normal/Gaussian distribution often occurs in nature (due in part to the central limit theorem).

9
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine ZipCode Data: Population K = 50 K = 500 K = 50

10
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine ZipCode Data: Population MATLAB code: X = zipcode_data(:,2) % second column from zipcode array histogram(X, 50) % histogram of X with 50 bins histogram(X, 500) % 500 bins index = X < 5000; % identify X values lower than 5000 histogram(X(index),50) % now plot just these X values

11
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Histogram Detecting Outlier (Missing Data) blood pressure = 0 ?

12
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Right Skewness Example: Credit Card Usage similarly right-skewed are Power law distributions (P i ~ 1/i a, where a >= 1) e.g. for a = 1 we have “Zipf’s law” For word frequencies in text

13
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Box (and Whisker) Plots: Pima Indians Data Q3-Q1 box contains middle 50% of data Q2 (median) healthydiabetic plots all data outside whiskers up to 1.5 x Q3-Q1 (or shorter, if no data that far above Q3)

14
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Time Series Example 1 annual fees introduced in UK (many users cutback to 1 credit card)

15
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Time Series Example 2 steady growth trend New Year bumps summer peaks summer bifurcations in air travel (favor early/late)

16
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Time-Series Example 3 Scotland experiment: “ milk in kid diet better health” ? 20,000 kids: 5k raw, 5k pasteurize, 10k control (no supplement) mean weight vs mean age for 10k control group Would expect smooth weight growth plot. Visually reveals unexpected pattern (steps), not apparent from raw data table. Possible explanations: Grow less early in year than later? No steps in height plots; so why height uniformly, weight spurts? Kids weighed in clothes: summer garb lighter than winter?

17
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Non-Stationarity Stationarity: –(loose definition) A probability distribution p (x | t) is stationary with respect to t if p (x | t ) = p (x) for all t, where x is the set of variables of interest, and t is some other varying quantity (e.g., usually t = time, but could represent spatial information, group information, etc) Examples: –p(customer demographics today) = p(customer demographics next month)? –p(weights in Scotland) = p(weights in US) ? –p(income of customers in Bank 1) = p(income of customers in Bank 2)? Non-stationarity is common in real data sets –Solutions? –Model stationarity (e.g., increasing trend over time) and extrapolate –Build model only on most recent/most similar data

18
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Exploratory Data Analysis Tools for Displaying Pairs of Variables

19
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine 2D Scatter Plots standard tool to display relation between 2 variables –e.g. y-axis = response, x-axis = suspected indicator useful to answer: –x,y related? no linearly nonlinearly –variance(y) depend on x? –outliers present? MATLAB: –plot(X(1,:),X(2,:),’.’); credit card repayment: low-low, high-high

20
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Scatter Plot: No apparent relationship

21
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Scatter Plot: Linear relationship

22
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Scatter Plot: Quadratic relationship

23
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Scatter plot: Homoscedastic Variation of Y Does Not Depend on X

24
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Scatter plot: Heteroscedastic variation in Y differs depending on the value of X e.g., Y = annual tax paid, X = income

25
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine (from US Zip code data: each point = 1 Zip code) units = dollars

26
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Problems with Scatter Plots of Large Data 96,000 bank loan applicants appears: later apps older; reality: downward slope (more apps, more variance) scatter plot degrades into black smudge...

27
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Contour Plots Can Help (same 96,000 bank loan apps as before) recall: unimodal skewed shows variance(y) with x is indeed due to horizontal skew in density skewed

28
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Problems with Scatter Plots of Large Data # weeks credit card buys gas vs groceries (10,000 customers) actual correlation (0.48) higher than appears (overprinting) also demands explanation

29
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine A simple data set Data X Y Anscombe, Francis (1973), Graphs in Statistical Analysis, The American Statistician, pp

30
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine A simple data set Data X Y Summary Statistics N = 11 Mean of X = 9.0 Mean of Y = 7.5 Intercept = 3 Slope = 0.5 Residual standard deviation = Correlation = 0.816

31
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine A simple data set Data X Y

32
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine 3 more data sets X2 Y2 X3 Y3 X4 Y

33
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Summary Statistics Summary Statistics of Data Set 2 N = 11 Mean of X = 9.0 Mean of Y = 7.5 Intercept = 3 Slope = 0.5 Residual standard deviation = Correlation = 0.816

34
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Summary Statistics Summary Statistics of Data Set 2 N = 11 Mean of X = 9.0 Mean of Y = 7.5 Intercept = 3 Slope = 0.5 Residual standard deviation = Correlation = Summary Statistics of Data Set 3 N = 11 Mean of X = 9.0 Mean of Y = 7.5 Intercept = 3 Slope = 0.5 Residual standard deviation = Correlation = Summary Statistics of Data Set 4 N = 11 Mean of X = 9.0 Mean of Y = 7.5 Intercept = 3 Slope = 0.5 Residual standard deviation = Correlation = 0.816

35
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Visualization really helps!

36
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Exploratory Data Analysis Tools for Displaying More than 2 Variables

37
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Multivariate Visualization Multivariate -> multiple variables 2 variables: scatter plots, etc 3 variables: –3-dimensional plots –Look impressive, but often not used –Can be cognitively challenging to interpret –Alternatives: overlay color-coding (e.g., categorical data) on 2d scatter plot 4 variables: –3d with color or time –Can be effective in certain situations, but tricky Higher dimensions –Generally difficult –Scatter plots, icon plots, parallel coordinates: all have weaknesses –Alternative: “map” data to lower dimensions, e.g., PCA or multidimensional scaling –Main problem: high-dimensional structure may not be apparent in low-dimensional views

38
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Scatter Plot Matrix For interactive visualization the concept of “linked plots” is generally useful

39
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Trellis Plot Younger Older MaleFemale

40
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Using Icons to Encode Information, e.g., Star Plots Each star represents a single observation. Star plots are used to examine the relative values for a single data point The star plot consists of a sequence of equi-angular spokes, called radii, with each spoke representing one of the variables. Useful for small data sets with up to 10 or so variables Limitations? –Small data sets, small dimensions –Ordering of variables may affect perception 1 Price 2 Mileage (MPG) Repair Record (1 = Worst, 5 = Best) Repair Record (1 = Worst, 5 = Best) 5 Headroom 6 Rear Seat Room 7 Trunk Space 8 Weight 9 Length

41
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Chernoff’s Faces described by ten facial characteristic parameters: head eccentricity, eye eccentricity, pupil size, eyebrow slant, nose size, mouth shape, eye spacing, eye size, mouth length and degree of mouth opening Chernoff faces applet more icon plots

42
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Parallel Coordinates interactive “brushing” is useful for seeing such distinctions dimensions (possibly all p of them!) often (re)ordered to better distinguish among interesting subsets of n total cases (epileptic seizure data from text) 1 (of n) cases (this case is a “brushed” one, with a darker line, to standout from the n-1 other cases)

43
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine More elaborate parallel coordinates example (from E. Wegman, 1999). 12,000 bank customers with 8 variables Additional “dependent” variable is profit (green for positive, red for negative)

44
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Interactive “Grand Tour” Techniques “Grand Tour” idea –Cycle continuously through multiple projections of the data –Cycles through all possible projections (depending on time constraints) –Projects can be 1, 2, or 3d typically (often 2d) –Can link with scatter plot matrices (see following example) – Asimov (1985) e.g. XGOBI visualization package (available on the Web) –http://public.research.att.com/~stat/xgobi/http://public.research.att.com/~stat/xgobi/ Example on following 2 slides –7dimensional physics data, color-coded by group, shown with (a)Standard scatter matrix (b)static snapshot of grand tour

45
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine

46

47
Example of displaying 4d categorical data, e.g., as used in OLAP/databases

48
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Other aspects (not discussed) Cognitive and human-factors aspects of visualization –In creating visualizations of data it is important to be aware of how the human brain perceives visual information –E.g., “Rules and principles of scientific data visualization” Artistic aspects of visualization –Classic books by Edward Tufte: Visualization of other data –2d, 3d, 4d “volume” data (fluid flow, brain images, etc) –Network/graph data Issues: graph layout/drawing, issues of graph size –Many others…., e.g., CHI conference, etc

49
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Visualization of weather states for Kenya Daily data from 20 year history clustered into 3 different weather “states” Mean image for each state - wind direction (arrows) - wind intensity (size of arrows) - rainfall (size of circles) - pressure (contours) S. Kirshner, A. Robertson, P. Smyth, 2004.

50
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Summary of 189k newsgroups and 257M postings Green = increase in postings in 2004 over 2003, red = decrease Uses “treemap” technique. Details at

51
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Time-line Visualization of Research Fronts (Morris et al, JASIST, 2003)

52
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Interactive MultiTile Visualization (Falko Kuester’s HIPerWall system, Calit2, UCI)

53
Data Mining Lectures Lecture on EDA and Visualization Padhraic Smyth, UC Irvine Summary EDA and Visualization –Can be very useful for data checking getting a general sense of individual or pairs of variables –But… do not necessarily reveal structure in high dimensions Reading: Chapter 3 Next lecture: –projecting/mapping data from high dimensions to low dimensions

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google