Beruflich Dokumente
Kultur Dokumente
Outline
Definitions Attributes Nominal, Ordinal, Interval, Ratio Types of Data Sets Characteristics of Structured Data Data Preprocessing Measure of Similarity & Dissimilarity
CPE403/CSC403 HOI & CHENG 2
What is Data?
Collection of data objects and their attributes An attribute is a property or characteristic of an object Examples: eye color of a person, temperature, etc. Attribute is also known as variable, field, characteristic, or feature A collection of attributes describe Objects an object Object is also known as record, point, case, sample, entity, or instance
Attributes
Tid Refund Marital Status 1 2 3 4 5 6 7 8 9 10
10
Taxable Income Cheat 125K 100K 70K 120K No No No No Yes No No Yes No Yes
3
Attribute Values
Attribute values are numbers or symbols assigned to an attribute Distinction between attributes and attribute values Same attributes can be mapped to different attribute values Example: height can be measured in feet or meters Different attributes can be mapped to the same set of values Example: Attribute values for ID and age are integers But properties of attribute values can be different E.g.: ID has no limit but age has a maximum value and a minimum value
Types of Attributes
There are different types of attributes
Nominal
Meaningless, barely enough to tell one object from another Examples: ID numbers, eye color, zip codes
Ordinal
Interval
Order has meaning Examples: rankings (e.g., taste of potato chips on a scale from 110), grades, height in {tall, medium, short} Difference has meaning Examples: calendar dates, temperatures in Celsius or Fahrenheit.
Ratio
Continuous Attribute
Graph
World Wide Web, Social Networks Molecular Structures
Ordered
Spatial Data Temporal Data Sequential Data Genetic Sequence Data
CPE403/CSC403 HOI & CHENG 8
Record Data
Data that consists of a collection of records, each of which consists of a fixed set of attributes
Tid Refund Marital Status 1 2 3 4 5 6 7 8 9 10
10
Taxable Income Cheat 125K 100K 70K 120K No No No No Yes No No Yes No Yes
10
Data Matrix
If data objects have the same fixed set of numeric attributes, then the data objects can be viewed as points in a multi-dimensional space, where each dimension represents a distinct attribute Such data set can be represented by an m by n matrix, where there are m rows, one for each object, and n columns, one for each attribute
Projection of x Load 10.23 12.65 Projection of y load 5.27 6.25 Distance Load Thickness
15.22 16.22
CPE403/CSC403 HOI & CHENG
2.7 2.2
1.2 1.1
11
Document Data
Each document becomes a term vector, Each term is a component (attribute) of the vector, The value of each component is the number of times the corresponding term occurs in the document Example: document1 it is what it is
document2 document3
"a" document1 document2 document3 0 0 1
what is it it is a banana
"is" 2 1 1
"banana" 0 0 1
"it" 1 1 1
"what" 1 1 0
12
Transaction Data
A special type of record data, where Each record (transaction) involves a set of items.
For example, consider a grocery store. The set of products purchased by a customer during one shopping trip constitute a transaction, while the individual products that were purchased are the items.
TID Items
1 2 3 4 5
Bread, Coke, Milk Beer, Bread Beer, Coke, Diaper, Milk Beer, Bread, Diaper, Milk Coke, Diaper, Milk
CPE403/CSC403 HOI & CHENG 13
2 5 2 5 1
Twitter networks
16
Ordered Data
Sequences of transactions
Items/Events
17
Ordered Data
Genomic sequence data
GGTTCCGCCTTCAGCCCCGCGCC CGCAGGGCCCGCCCCGCGCCGTC GAGAAGGGCCCGCCTGGCGGGCG GGGGGAGGCGGGGCCGCCCGAGC CCAACCGAGTCCGACCAGGTGCC CCCTCTGCTCGGCCTAGACCTGA GCTCATTAGGCGGCAGCGGACAG GCCAAGTAGAACACGCGAAGCGC TGGGCTGCCTGCTGCGACCAGGG
18
Ordered Data
Spatio-Temporal Data
Average Monthly Temperature of land and ocean
19
Data Quality
What kinds of data quality problems? How can we detect problems with the data? What can we do about these problems? Examples of data quality problems:
Noise and outliers missing values duplicate data
CPE403/CSC403 HOI & CHENG 20
Noise
Noise refers to modification of original values
Examples: distortion of a persons voice when talking on a poor phone and snow on television screen
Outliers
Outliers are data objects with characteristics that are considerably different than most of the other data objects in the data set
22
Missing Values
Data values are not always available E.g., many tuples have no recorded value for several attributes, such as customer income in sales data Missing data may be due to Equipment malfunction Information was not collected (e.g., people decline to give their age and weight) Data not entered due to misunderstanding Certain data may not be considered important at the time of entry Attributes may not be applicable to all cases (e.g., annual income is not applicable to children)
CPE403/CSC403 HOI & CHENG 23
Duplicate Data
Data set may include data objects that are duplicates, or almost duplicates of one another
Major issue when merging data from heterogeous sources Same person with multiple email addresses
Examples:
Data de-duplication
Process of dealing with duplicate data issues 1) if there are two objects that actually represent a single object, then values of the corresponding attributes may be differerent; these inconsistent values must be resolved 2) avoid accidentally combining data objects that are similar, but not duplicates, e.g., two distinct people with identical names
CPE403/CSC403 HOI & CHENG 24
Data Preprocessing
Data Cleaning Aggregation Sampling Dimensionality Reduction Feature Subset Selection Feature Creation Discretization and Binarization Attribute Transformation
CPE403/CSC403 HOI & CHENG 25
Data Cleaning
Importance
Data cleaning is the number one problem in data warehousingDCI survey
27
28
Regression
y
Noise Y1
Y1
y=x+1
X1
31
Cluster Analysis
Outliers
CPE403/CSC403 HOI & CHENG 32
Aggregation
Combining two or more attributes (or objects) into a single attribute (or object) Purposes
Data reduction
Change of scale
Reduce the number of attributes or objects Cities aggregated into regions, states, countries, etc Aggregated data tends to have less variability
33
Aggregation
Example: Variation of Precipitation in Australia
Sampling
Sampling is the main technique employed for data selection. It is often used for both the preliminary investigation of the data and the final data analysis. Statisticians sample because obtaining the entire set of data of interest is too expensive or time consuming. Sampling is used in data mining because processing the entire set of data of interest is too expensive or time consuming.
CPE403/CSC403 HOI & CHENG 35
Sampling
The key principle for effective sampling: Using a sample will work almost as well as using the entire data sets, if the sample is representative A sample is representative if it has approximately the same property (of interest) as the original set of data
36
Types of Sampling
Simple Random Sampling
There is an equal probability of selecting any particular item
Stratified sampling
Split the data into several partitions; then draw random samples from each partition
37
Sample Size
8000 points
2000 Points
500 Points
38
Sample Size
What sample size is necessary to get at least one object from each of 10 groups.
39
Curse of Dimensionality
When dimensionality increases, data becomes increasingly sparse in the space that it occupies Example
Randomly generate 500 points MAX_DIST: Gap between the two furthest points MIN_DIST: Gap between the two nearest points Compute difference between MAX_DIST and MIN_DIST of any pair of points
CPE403/CSC403 HOI & CHENG 40
Curse of Dimensionality
Definitions of density and distance between points become less meaningful In very high-Dimension, almost every point lie at the edge of the space, far away from the center
41
Curse of Dimensionality
One challenge of mining high-dimensional data is insufficient data samples
Suppose 5 samples/objects is considered enough in 1-D 1D : 5 points 2D : 25 points 3D : 125 points 10D : 9 765 625 points
42
Dimensionality Reduction
Purposes:
Avoid curse of dimensionality Reduce amount of time and memory required by data mining algorithms Allow data to be more easily visualized May help to eliminate irrelevant features or reduce noise Principle Component Analysis Singular Value Decomposition Others: supervised and non-linear techniques
CPE403/CSC403 HOI & CHENG 43
Techniques
x1
CPE403/CSC403 HOI & CHENG 44
x1
CPE403/CSC403 HOI & CHENG 45
46
47
Irrelevant features
48
Wrapper approaches:
Feature Creation
Create new attributes that can capture the important information in a data set much more efficiently than the original attributes Three general methodologies:
Feature Extraction
domain-specific
Binarization
Transform either a continuous attribute or a categorical attribute into one or more binary attributes
CPE403/CSC403 HOI & CHENG 52
Binarization
A simple method
Given m categorical values, assign each original value to an integer in the interval [0, m-1]. Convert each of these m integers into a binary number Require n = log2(m) binary digits to represent these integers A categorical variable with 5 values {Awful, Poor, OK, Good, Great}, require 3 binary attributes x1, x2, x3
CPE403/CSC403 HOI & CHENG 53
Example:
Example:
Categorical Value Awful Poor OK Good Great Categorical Value Awful Poor OK Good Great Integer value 0 1 2 3 4 Integer value 0 1 2 3 4 X1 1 0 0 0 1 X1 0 0 0 0 1 X2 0 1 0 0 0 X2 0 0 1 1 0 X3 0 0 1 0 0 X4 0 0 0 1 0 X3 0 1 0 1 0 X5 0 0 0 0 1
54
(2) Determine how to map the values of the continuous attribute to these categories
Discretization methods
The key issue is how many split points to choose and where to place them Unsupervised vs. Supervised Discretization
CPE403/CSC403 HOI & CHENG 55
Attribute/Variable Transformation
A function that maps the entire set of values of a given attribute to a new set of replacement values such that each old value can be identified with one of the new values Simple math functions: xk, log(x), ex, |x|, 1/x, sin x Normalization (or Standardization)
58
Normalization
Min-max normalization:
[minA, maxA] [new_minA, new_maxA]
v minA v' = (new _ maxA new _ minA) + new _ minA maxA minA
Example: Income range [$12,000, $98,000] normalized to [0.0, 1.0]. Then $73,000 is mapped to
Normalization (cont)
Z-score normalization
(A: mean, A: standard deviation): v ' =
v A
v v' = j 10
Dissimilarity
Numerical measure of how different are two data objects Lower when objects are more alike Minimum dissimilarity is often 0 Upper limit varies
CPE403/CSC403 HOI & CHENG 62
63
Euclidean Distance
Euclidean Distance between two n-dimensional vectors (objects) p and q
dist =
k =1
( pk qk )
where n is the number of dimensions (attributes) and pk and qk are the kth attributes (components) of data objects p and q, respectively. Normalization is usually necessary if scales are different.
CPE403/CSC403 HOI & CHENG 64
Euclidean Distance
Example:
point p1 p2 p3 p4 x 0 2 3 5 y 2 0 1 1
3 2 1
p2 p1 p3 p4
0 0 1 2 3 4 5 6
p3 3.162 1.414 0 2
p4 5.099 3.162 2 0
65
Minkowski Distance
dist = ( | pk qk
k =1
r r |)
Where r is a parameter, n is the number of dimensions (attributes) and pk and qk are, respectively, the k-th attributes (components) of data objects p and q.
CPE403/CSC403 HOI & CHENG 66
Minkowski Distance
Example:
point p1 p2 p3 p4 x 0 2 3 5 y 2 0 1 1
Distance Matrix
L1 p1 p2 p3 p4 L2 p1 p2 p3 p4
L p1 p2 p3 p4
p3 4 2 0 2 p3 3.162 1.414 0 2
p3 3 1 0 2
p4 6 4 2 0 p4 5.099 3.162 2 0
p4 5 3 2 0
68
Mahalanobis Distance
mahalanobis( p, q) = ( p q) 1 ( p q)T
is the covariance matrix of all the input data X
j ,k 1 n = ( X ij X j )( X ik X k ) n 1 i =1
For two red points, the Euclidean distance is 14.7, Mahalanobis distance is 6.
CPE403/CSC403 HOI & CHENG 69
Mahalanobis Distance
Covariance Matrix:
C B A
Analogy: A(ndrew) is closer to C(athy), because there are thousands of friends spreaded in the direction of AC, C is just like any other friends. A(ndrew) is relatively far away from B(etty), because not many friends lie in the direction of AB, so B is considered rare and thus far.
CPE403/CSC403 HOI & CHENG 70
72
SMC = (M11 + M00)/(M01 + M10 + M11 + M00) = (0+7) / (2+1+0+7) = 0.7 J = (M11) / (M01 + M10 + M11) = 0 / (2 + 1 + 0) = 0
CPE403/CSC403 HOI & CHENG 74
Cosine Similarity
If d1 and d2 are two document vectors, then
where indicates vector dot product and || d || is the length of vector d. It is a measure of the cosine of the angle between the two vectors.
Example:
d1 = 3 2 0 5 0 0 0 2 0 0 d2 = 1 0 0 0 0 0 0 1 0 2
d1 d2= 3*1 + 2*0 + 0*0 + 5*0 + 0*0 + 0*0 + 0*0 + 2*1 + 0*0 + 0*2 = 5 ||d1|| = (3*3+2*2+0*0+5*5+0*0+0*0+0*0+2*2+0*0+0*0)0.5 = (42) 0.5 = 6.4807 ||d2|| = (1*1+0*0+0*0+0*0+0*0+0*0+0*0+1*1+0*0+2*2) 0.5 = (6) 0.5 = 2.4495
75
76
Correlation
Correlation is a measure of the linear relationship between the attributes of the objects The (Pearsons) correlation coefficient between two data objects p and q is defined as
77
Example of Correlation
(Perfect Correlation)
Correlation is always in the range -1 and 1. A correlation of value 1 (-1) means that p and q have a perfect positive (negative) linear relationship, i.e., x = a*y + b, where a and b are constants. The follow two sets of x and y indicate two cases of correlation -1 and +1, respectively x=(-3, 6, 0, 3, -6) y = (1, -2, 0, -1, 2) corr(x, y) = -1 x= (3, 6, 0, 3, 6) y=(1, 2, 0, 1, 2) corr(x, y) = 1
78
79
3.
Compute the overall similarity between the two objects using the following formula:
80
81
Density
Density-based clustering requires a notion of density Examples: Euclidean density Euclidean density = number of points per unit volume Probability density Distribution measures such as covariance Graph-based density #internal links #external links
CPE403/CSC403 HOI & CHENG 82
83
84
Summary
Definitions Attributes Nominal, Ordinal, Interval, Ratio Types of Data Sets Characteristics of Structured Data Data Preprocessing
Data Cleaning, Aggregation, Sampling, Dimensionality Reduction, Feature subset selection, Discretization and Binarization, Attribute Transformation
85