Download Understanding Data Characteristics

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
Understanding Basic
Characteristics of Data
Based in part on: Data Mining: Concepts and Techniques, Third Edition, by Han, Kamber, & Pei
Types of Data Sets

Record/Semi-Structured





Relational records
Data matrix, e.g., numerical
matrix, crosstabs
Document data: text
documents: term-frequency
vector
Transaction data
Graph and network



World Wide Web
Social or information networks
Molecular Structures

Ordered





Video data: sequence of
images
Temporal data: time-series
Sequential Data: transaction
sequences
Genetic sequence data
Spatial and multimedia



Spatial data: maps
Image data
Video data
2
Basic Data Objects

Data sets are made up of data objects.

A data object represents an entity.

Examples:

sales database: object  customers, store items, sales

medical database: object  patients, treatments

university database: object  students, professors, courses

Also called samples , examples, instances, data points, objects,
tuples, vectors.

Data objects are described by attributes.

Database rows  data objects; columns  attributes.
3
Attributes

Attribute (or dimensions, features, variables): a data field
representing a characteristic or property of a data object


E.g., customer _ID, name, address, income, GPA, ….
Types:



Nominal (Categorical)
Ordinal
Numeric: quantitative


Interval-scaled
Ratio-scaled
4
Attribute Types

Nominal (Categorical): categories, states, or “names of
things”





Ordinal




Hair_color = {auburn, black, blond, brown, grey, red, white}
marital status, occupation, ID numbers, zip codes
Often attributes with “yes” and “no” as values
Binary
 Nominal attribute with only 2 states (0 and 1)
Values have a meaningful order (ranking) but magnitude between successive
values is not known.
Size = {small, medium, large}, grades, army rankings
Month = {jan, feb, mar, … }
Numeric


Quantity (integer or real-valued)
Could also be intervals or ratios
5
Discrete vs. Continuous Attributes

Discrete Attribute

Has only a finite or countable set of values




E.g., zip codes, profession, or the set of words in a collection of
documents
Sometimes, represented as integer variables
Note: Binary attributes are a special case of discrete attributes
Continuous Attribute

Has real numbers as attribute values



E.g., temperature, height, or weight
Practically, real values can only be measured and represented
using a finite number of digits
Continuous attributes are typically represented as floating-point
variables
6
Basic Statistical Descriptions of Data



Before deeper analysis, it’s important to explore the basic
characteristics and relationships in the data set
Descriptive Statistics
 To better understand the characteristics of attributes and
fields: central tendency, variation, spread, etc.
 To get a feel for general patterns or relationships among
variables: e.g., correlation, covariance, etc.
Data Visualization
 Visual examination of data distributions often help in
uncovering important patterns and guide further
investigation or decision making
7
Measuring the Central Tendency

Mean (algebraic measure) (sample vs. population):
Note: n is sample size and N is population size.
1 n
x   xi
n i 1

x
N
n



w x
Weighted arithmetic mean:
Trimmed mean: chopping extreme values
x
i 1
n
i
w
Median:

i
i 1
i
Middle value if odd number of values, or average of the
middle two values otherwise


Estimated by interpolation (for grouped data):
Mode
Median
interval

Value that occurs most frequently in the data

Unimodal, bimodal, trimodal

Empirical formula: mean  mode  3  (mean  median)
8
Symmetric vs. Skewed Data

Median, mean and mode of
symmetric, positively and negatively
skewed data
positively skewed
May 22, 2017
symmetric
negatively skewed
Data Mining: Concepts and Techniques
9
Measuring the Dispersion of Data
Quartiles, outliers and boxplots


Quartiles: Q1 (25th percentile), Q3 (75th percentile)

Inter-quartile range: IQR = Q3 – Q1

Five number summary: min, Q1, median, Q3, max

Boxplot: ends of the box are the quartiles; median is marked; add whiskers,
and plot outliers individually

Outlier: usually, a value higher/lower than 1.5 x IQR
Variance and standard deviation (sample: s, population: σ)


Variance: (algebraic, scalable computation)
1 n
1 n 2 1 n
2
2
s 
(
x

x
)

[
x

(
x
)
 i
i n
i ]
n  1 i 1
n  1 i 1
i 1
2

1
 
N
2
n
1
(
x


)


i
N
i 1
2
n
 xi   2
2
i 1
Standard deviation s (or σ) is the square root of variance s2 (or σ2)
10
Properties of Normal Distribution Curve

The normal (distribution) curve
 From μ–σ to μ+σ: contains about 68% of the measurements
(μ: mean, σ: standard deviation)
 From μ–2σ to μ+2σ: contains about 95% of it
 From μ–3σ to μ+3σ: contains about 99.7% of it
11
Graphic Displays of Basic Statistical Descriptions

Boxplot: graphic display of five-number summary

Histogram: x-axis are values, y-axis repres. frequencies

Quantile plot: each value xi is paired with fi indicating that
approximately 100 fi % of data are  xi

Quantile-quantile (q-q) plot: graphs the quantiles of one
univariant distribution against the corresponding quantiles of
another

Scatter plot: each pair of values is a pair of coordinates and
plotted as points in the plane
12
Boxplot Analysis

Five-number summary of a distribution


Minimum, Q1, Median, Q3, Maximum
Boxplot

Data is represented with a box

The ends of the box are at the first and third
quartiles, i.e., the height of the box is IQR

The median is marked by a line within the box

Whiskers: two lines outside the box extended to
Minimum and Maximum

Outliers: points beyond a specified outlier
threshold, plotted individually
13
Histogram Analysis



Histogram: Graph display of tabulated
40
frequencies, shown as bars
It shows what proportion of cases fall35
30
into each of several categories
Differs from a bar chart in that it is 25
the area of the bar that denotes the 20
value, not the height as in bar charts,15
a crucial distinction when the
10
categories are not of uniform width
5

The categories are usually specified as
0
non-overlapping intervals of some
variable. The categories (bars) must
be adjacent
10000
30000
50000
70000
90000
14
Quantile Plot


Displays all of the data (allowing the user to assess both the
overall behavior and unusual occurrences)
Plots quantile information
 For a data xi data sorted in increasing order, fi indicates that
approximately 100 fi% of the data are below or equal to the
value xi
Data Mining: Concepts and Techniques
15
Scatter plot


Provides a first look at bivariate data to see clusters of points,
outliers, etc
Each pair of values is treated as a pair of coordinates and
plotted as points in the plane
16
Positively and Negatively Correlated Data

Above-left: positively correlated

Above-right: negative correlated
17
Uncorrelated Data
18
Correlation Analysis (Nominal Data)

Χ2 (chi-square) test
2
(
Observed

Expected
)
2  
Expected

The larger the Χ2 value, the more likely the variables are
related

The cells that contribute the most to the Χ2 value are those
whose actual count is very different from the expected count

Correlation does not imply causality

# of hospitals and # of car-theft in a city are correlated

Both are causally linked to the third variable: population
19
Chi-Square Calculation: An Example

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
Χ2 (chi-square) calculation (numbers in parenthesis are expected
counts calculated based on the data distribution in the two
categories)
(250  90) 2 (50  210) 2 (200  360) 2 (1000  840) 2
 



 507.93
90
210
360
840
2

It shows that like_science_fiction and play_chess are correlated
in the group
20
Correlation Analysis (Numeric Data)

Correlation coefficient (also called Pearson’s product moment
coefficient)
i1 (ai  A)(bi  B)
n
rA, B 


(n  1) A B


n
i 1
(ai bi )  n AB
(n  1) A B
where n is the number of tuples, A and B 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 crossproduct.
If rA,B > 0, A and B are positively correlated (A’s values increase
as B’s). The higher, the stronger correlation.
rA,B = 0: independent; rAB < 0: negatively correlated
21
Visually Evaluating Correlation
Scatter plots
showing the
similarity from
–1 to 1.
22
Correlation (viewed as linear relationship)


Correlation measures the linear relationship between
objects
To compute correlation, we standardize data objects,
A and B, and then take their dot product
a'k  (ak  mean( A)) / std ( A)
b'k  (bk  mean( B)) / std ( B)
correlatio n( A, B)  A' B'
23
Visualizing Patterns Using Aggregation
Example: Cross Tabulation

ID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Outlook
sunny
sunny
overcast
rain
rain
rain
overcast
sunny
sunny
rain
sunny
overcast
overcast
rain
Temperature Humidity Windy
85
85
FALSE
80
90
TRUE
83
78
FALSE
70
96
FALSE
68
80
FALSE
65
70
TRUE
58
65
TRUE
72
95
FALSE
69
70
FALSE
71
80
FALSE
75
70
TRUE
73
90
TRUE
81
75
FALSE
75
80
TRUE
Windy
Not Windy
Outlook =
sunny
2
3
Outlook = rain
2
3
Outlook =
overcast
2
2
3
2.5
2
Outlook = sunny
1.5
Outlook = rain
Outlook = overcast
1
0.5
0
Windy
Not Windy
24
Other Types of Statistics / Visualization

Understanding Properties of Text



Zipf distribution
TF x IDF
Tag/Word Clouds

Graph Visualization
25