Data Mining:
Concepts and Techniques
— Chapter 2 —
Jiawei Han, Micheline Kamber, and Jian Pei
University of Illinois at Urbana-Champaign
Simon Fraser University
©2011 Han, Kamber, and Pei. All rights reserved.
1
Chapter 2: Getting to Know Your Data
Data Objects and Attribute Types
Basic Statistical Descriptions of Data
Data Visualization
Measuring Data Similarity and Dissimilarity
Summary
2
Types of Data Sets
Record
Relational records
Data matrix, e.g., numerical matrix,
timeout
season
coach
game
score
team
ball
lost
pla
wi
crosstabs
n
y
Document data: text documents: term-
frequency vector
Document 1 3 0 5 0 2 6 0 2 0 2
Transaction data
Graph and network Document 2 0 7 0 2 1 0 0 3 0 0
World Wide Web Document 3 0 1 0 0 1 2 2 0 3 0
Social or information networks
Molecular Structures
Ordered TID Items
Video data: sequence of images 1 Bread, Coke, Milk
Temporal data: time-series 2 Beer, Bread
Sequential Data: transaction sequences
3 Beer, Coke, Diaper, Milk
Genetic sequence data
4 Beer, Bread, Diaper, Milk
Spatial, image and multimedia:
Spatial data: maps
5 Coke, Diaper, Milk
Image data:
Video data:
3
Important Characteristics of Structured Data
Dimensionality
Curse of dimensionality
Sparsity
Only presence counts
Resolution
Patterns depend on the scale
Distribution
Centrality and dispersion
4
Data Objects
Data sets are made up of data objects.
A data object represents an entity.
Examples:
sales database: customers, store items, sales
medical database: patients, treatments
university database: students, professors, courses
Also called samples , examples, instances, data points,
objects, tuples.
Data objects are described by attributes.
Database rows -> data objects; columns ->attributes.
5
Attributes
Attribute (or dimensions, features, variables):
a data field, representing a characteristic or feature
of a data object.
E.g., customer _ID, name, address
Types:
Nominal
Binary
Numeric: quantitative
Interval-scaled
Ratio-scaled
6
Attribute Types
Nominal: categories, states, or “names of things”
Hair_color = {auburn, black, blond, brown, grey, red, white}
marital status, occupation, ID numbers, zip codes
Binary
Nominal attribute with only 2 states (0 and 1)
Symmetric binary: both outcomes equally important
e.g., gender
Asymmetric binary: outcomes not equally important.
e.g., medical test (positive vs. negative)
Convention: assign 1 to most important outcome (e.g., HIV
positive)
Ordinal
Values have a meaningful order (ranking) but magnitude between
successive values is not known.
Size = {small, medium, large}, grades, army rankings
7
Numeric Attribute Types
Quantity (integer or real-valued)
Interval
Measured on a scale of equal-sized units
Values have order
E.g., temperature in C˚or F˚, calendar dates
No true zero-point
Ratio
Inherent zero-point
We can speak of values as being an order of
magnitude larger than the unit of measurement
(10 K˚ is twice as high as 5 K˚).
e.g., temperature in Kelvin, length, counts,
monetary quantities
8
Discrete vs. Continuous Attributes
Discrete Attribute
Has only a finite or countably infinite 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
9
Chapter 2: Getting to Know Your Data
Data Objects and Attribute Types
Basic Statistical Descriptions of Data
Data Visualization
Measuring Data Similarity and Dissimilarity
Summary
10
Basic Statistical Descriptions of Data
Motivation
To better understand the data: central tendency,
variation and spread
Data dispersion characteristics
median, max, min, quantiles, outliers, variance, etc.
Numerical dimensions correspond to sorted intervals
Data dispersion: analyzed with multiple granularities
of precision
Boxplot or quantile analysis on sorted intervals
Dispersion analysis on computed measures
Folding measures into numerical dimensions
Boxplot or quantile analysis on the transformed cube
11
Basic Statistical Descriptions of Data
For data preprocessing to be successful, it is essential to
have an overall picture of your data.
Basic statistical descriptions can be used to identify
properties of the data
highlight noise or outliers
Three areas of basic statistical descriptions.
Measures of Central Tendency: Middle or center of a data
distribution. (where do most of its values fall) e.g. mean,
median, mode.
Dispersion of the data: how are the data spread out? (range,
quartiles, boxplots; and the variance and standard deviation of the data )
Graphic displays of basic statistical descriptions: to visually
inspect our data. (bar charts, pie charts, and line graphs, histograms,
and scatter plots etc.)
12
Measuring the Central Tendency
Mean (algebraic measure) (sample vs. population): 1 n
x xi x
Note: n is sample size and N is population size. n i 1 N
Weighted arithmetic mean: The weights reflect the w x i i
significance, importance, or occurrence frequency x i 1
n
attached to their respective values. w
i 1
i
13
Measuring the Central Tendency
Issues: A major problem with the mean is its sensitivity to extreme (e.g.,
outlier) values.
For example, the mean salary at a company may be substantially pushed up
by that of a few highly paid managers.
Similarly, the mean score of a class in an exam could be pulled down quite a
bit by a few very low scores.
Trimmed mean: Mean obtained after chopping off values at the high and low
extremes, to offset the effect caused by a small number of extreme values.
For example, we can sort the values observed for salary and remove the top
and bottom 2% before computing the mean.
We should avoid trimming too large a portion (such as 20%) at both ends,
as this can result in the loss of valuable information
14
Measuring the Central Tendency
Median:
Middle value if odd number of values, or average of
the middle two values otherwise
Estimated by interpolation (for grouped data)
The mode for a set of data is the value that occurs
most frequently in the set
Mode
Value that occurs most frequently in the data
Unimodal, bimodal, trimodal
A data set with two or more modes is multimodal
At the other extreme, if each data value occurs only
once, then there is no mode
15
Symmetric vs. Skewed Data
Median, mean and mode of symmetric, symmetric
positively and negatively skewed data
positively skewed negatively skewed
May 24, 2024 Data Mining: Concepts and Techniques 16