0% found this document useful (0 votes)
53 views47 pages

Data and Attributes in Data Mining

The document provides an overview of data and attributes in data mining, defining key concepts such as data objects, attributes, and their values. It categorizes attributes into types (nominal, ordinal, interval, ratio) and discusses properties of attribute values, measurement scales, and data quality issues like noise and missing values. Additionally, it covers various data types, including record data, graph data, and ordered data, along with methods for handling data quality problems and measuring similarity and dissimilarity between data objects.

Uploaded by

dumi dlam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views47 pages

Data and Attributes in Data Mining

The document provides an overview of data and attributes in data mining, defining key concepts such as data objects, attributes, and their values. It categorizes attributes into types (nominal, ordinal, interval, ratio) and discusses properties of attribute values, measurement scales, and data quality issues like noise and missing values. Additionally, it covers various data types, including record data, graph data, and ordered data, along with methods for handling data quality problems and measuring similarity and dissimilarity between data objects.

Uploaded by

dumi dlam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Data and attributes in

Data Mining
What is Data?
• Collection of data objects and Attributes
their attributes
• An attribute is a property or Tid Refund Marital Taxable
Status Income Cheat
characteristic of an object
1 Yes Single 125K No
– Examples: eye color of a person,
temperature, etc. 2 No Married 100K No

– Attribute is also known as 3 No Single 70K No

Objects
variable, field, characteristic, 4 Yes Married 120K No
dimension, or feature 5 No Divorced 95K Yes
• A collection of attributes 6 No Married 60K No
describe an object 7 Yes Divorced 220K No
– Object is also known as record, 8 No Single 85K Yes
point, case, sample, entity, or 9 No Married 75K No
instance
10 No Single 90K Yes
10
Attribute Values
• Attribute values are numbers or symbols assigned to
an attribute for a particular object
• Distinction between attributes and attribute values
– Same attribute 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 can be different than the
properties of the values used to represent the
attribute
Measurement of Length
• The way you measure an attribute may not match the attributes
properties.
5 A 1

B
7 2

C
This scale This scale
8 3
stores only stores the
the ordering ordering and
D
property of additvity
length. 10
properties of
4
length.

15 5
Types of Attributes
• There are different types of attributes
– Nominal
• Examples: ID numbers, eye color, zip codes
– Ordinal
• Examples: rankings (e.g., taste of potato chips on a scale
from 1-10), grades, height {tall, medium, short}
– Interval
• Examples: calendar dates, temperatures in Celsius or
Fahrenheit.
– Ratio
• Examples: temperature in Kelvin, length, counts, elapsed
time (e.g., time to run a race)
Properties of Attribute Values
• The type of an attribute depends on which of the following
properties/operations it possesses:
– Distinctness: = 
– Order: < >
– Differences are + -
meaningful :
– Ratios are * /
meaningful
– Nominal attribute: distinctness
– Ordinal attribute: distinctness & order
– Interval attribute: distinctness, order & meaningful
differences
– Ratio attribute: all 4 properties/operations
Difference Between Ratio and
Interval
• Is it physically meaningful to say that a
temperature of 10 ° is twice that of 5° on
– the Celsius scale?
– the Fahrenheit scale?
– the Kelvin scale?
• Consider measuring the height above average
– If Bill’s height is 20 cm above average and Bob’s
height is 40 cm above average, then would we say
that Bob is twice as tall as Bill?
– Is this situation analogous to that of temperature?
Discrete and Continuous Attributes
• Discrete Attribute
– Has only a finite or countably infinite set of values
– Examples: zip codes, counts, or the set of words in a collection
of documents
– Often represented as integer variables.
– Note: binary attributes are a special case of discrete attributes
• Continuous Attribute
– Has real numbers as attribute values
– Examples: 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.
Asymmetric Attributes
• Only presence (a non-zero attribute value) is regarded
as important
• Words present in documents
• Items present in customer transactions
• If we met a friend in the grocery store would we ever
say the following?

“I see our purchases are very similar since we didn’t


buy most of the same things.”
Key Messages for Attribute Types
• The types of operations you choose should be “meaningful”
for the type of data you have

– Distinctness, order, meaningful intervals, and meaningful ratios


are only four (among many possible) properties of data

– The data type you see – often numbers or strings – may not
capture all the properties or may suggest properties that are not
present

– Analysis may depend on these other properties of the data


• Many statistical analyses depend only on the distribution

– In the end, what is meaningful can be specific to domain


Important Characteristics of Data
– Dimensionality (number of attributes)
• High dimensional data brings a number of challenges

– Sparsity
• Only presence counts

– Resolution
• Patterns depend on the scale

– Size
• Type of analysis may depend on size of data
Types of data sets
• Record
– Data Matrix
– Document Data
– Transaction Data
• Graph
– World Wide Web
– Molecular Structures
• Ordered
– Spatial Data
– Temporal Data
– Sequential Data
– Genetic Sequence Data
Record Data
• Data that consists of a collection of records, each
of which consists of a fixed set of attributes
Tid Refund Marital Taxable
Status Income Cheat

1 Yes Single 125K No


2 No Married 100K No
3 No Single 70K No
4 Yes Married 120K No
5 No Divorced 95K Yes
6 No Married 60K No
7 Yes Divorced 220K No
8 No Single 85K Yes
9 No Married 75K No
10 No Single 90K Yes
10
Data Matrix
• If data objects have the same fixed set of numeric attributes,
then the data objects can be thought of as points in a multi-
dimensional space, where each dimension represents a
distinct attribute

• Such a 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 Projection Distance Load Thickness


of x Load of y load

10.23 5.27 15.22 2.7 1.2


12.65 6.25 16.22 2.2 1.1
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.

timeout

season
coach

game
score
play
team

win
ball

lost
Document 1 3 0 5 0 2 6 0 2 0 2

Document 2 0 7 0 2 1 0 0 3 0 0

Document 3 0 1 0 0 1 2 2 0 3 0
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.
item

transaction

1
Graph Data
• Examples: Generic graph, a molecule, and webpages

2
5 1
2
5

Benzene Molecule: C6H6


Ordered Data
• Sequences of transactions
Items/Events

An element of
the sequence
Ordered Data
• Genomic sequence data
GGTTCCGCCTTCAGCCCCGCGCC
CGCAGGGCCCGCCCCGCGCCGTC
GAGAAGGGCCCGCCTGGCGGGCG
GGGGGAGGCGGGGCCGCCCGAGC
CCAACCGAGTCCGACCAGGTGCC
CCCTCTGCTCGGCCTAGACCTGA
GCTCATTAGGCGGCAGCGGACAG
GCCAAGTAGAACACGCGAAGCGC
TGGGCTGCCTGCTGCGACCAGGG
Ordered Data
• Spatio-Temporal Data

Average Monthly
Temperature of
land and ocean
Data Quality
• Poor data quality negatively affects many data processing
efforts

• Data mining example: a classification model for detecting


people who are loan risks is built using poor data
– Some credit-worthy candidates are denied loans
– More loans are given to individuals that default
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
– Wrong data
– Fake data
– Missing values
– Duplicate data
Noise
• For objects, noise is an extraneous object
• For attributes, noise refers to modification of original values
– Examples: distortion of a person’s voice when talking on a poor phone and
“snow” on television screen
– The figures below show two sine waves of the same magnitude and
different frequencies, the waves combined, and the two sine waves with
random noise
• The magnitude and shape of the original signal is distorted
Missing Values
• Reasons for missing values
– Information is not collected
(e.g., people decline to give their age and weight)
– Attributes may not be applicable to all cases
(e.g., annual income is not applicable to children)

• Handling missing values


– Eliminate data objects or variables
– Estimate missing values
• Example: time series of temperature
• Example: census results
– Ignore the missing value during analysis
How to Handle Noisy Data?
• Binning method:
– first sort data and partition into (equi-depth) bins
– then one can smooth by bin means, smooth by bin boundaries, etc.
• Clustering
– detect and remove outliers
• Combined computer and human inspection
– detect suspicious values and check by human (e.g., deal with
possible outliers)
Binning Methods for Data
Smoothing
• Unsorted data for price: 8, 15, 4, 9, 24, 21, 26, 21, 25, 34, 28, 29
• Sorted data for price: 4, 8, 9, 15, 21, 21, 24, 25, 26, 28, 29, 34
• Partition into (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
Duplicate Data
• Data set may include data objects that are duplicates,
or almost duplicates of one another
– Major issue when merging data from heterogeneous
sources

• Examples:
– Same person with multiple email addresses

• Data cleaning
– Process of dealing with duplicate data issues

• When should duplicate data not be removed?


Similarity and Dissimilarity
Measures
• Similarity measure
– Numerical measure of how alike two data objects are.
– Is higher when objects are more alike.
– Often falls in the range [0,1]
• Dissimilarity measure
– Numerical measure of how different two data objects
are
– Lower when objects are more alike
– Minimum dissimilarity is often 0
– Upper limit varies
• Proximity refers to a similarity or dissimilarity
Similarity/Dissimilarity for Simple
Attributes
The following table shows the similarity and dissimilarity
between two objects, x and y, with respect to a single, simple
attribute.
Euclidean Distance
• Euclidean Distance

where n is the number of dimensions (attributes)


and xk and yk are, respectively, the kth attributes
(components) or data objects x and y.

Standardization is necessary, if scales differ.


Euclidean Distance
3
point x y
2 p1
p1 0 2
p3 p4
1
p2 2 0
p2 p3 3 1
0 p4 5 1
0 1 2 3 4 5 6

p1 p2 p3 p4
p1 0 2.828 3.162 5.099
p2 2.828 0 1.414 3.162
p3 3.162 1.414 0 2
p4 5.099 3.162 2 0
Distance Matrix
Minkowski Distance
• Minkowski Distance is a generalization of Euclidean Distance

1
n
dist = (  | pk − qk r r
|)
k =1
where r is a parameter, n is the number of dimensions
(attributes) and pk and qk are, respectively, the kth attributes
(components) or data objects p and q.
Minkowski Distance
L1 p1 p2 p3 p4
p1 0 4 4 6
p2 4 0 2 4
p3 4 2 0 2
p4 6 4 2 0
point x y
p1 0 2 L2 p1 p2 p3 p4
p2 2 0 p1 0 2.828 3.162 5.099
p3 3 1 p2 2.828 0 1.414 3.162
p4 5 1 p3 3.162 1.414 0 2
p4 5.099 3.162 2 0

L p1 p2 p3 p4
p1 0 2 3 5
p2 2 0 1 3
p3 3 1 0 2
p4 5 3 2 0

Distance Matrix
Common Properties of a Similarity
• Similarities, also have some well known
properties.
1. s(x, y) = 1 (or maximum similarity) only if x =
y.
(does not always hold, e.g., cosine)
2. s(x, y) = s(y, x) for all x and y. (Symmetry)

where s(x, y) is the similarity between points (data


objects), x and y.
Similarity Between Binary Vectors
• Common situation is that objects, x and y, have only
binary attributes

• Compute similarities using the following quantities


f01 = the number of attributes where x was 0 and y was 1
f10 = the number of attributes where x was 1 and y was 0
f00 = the number of attributes where x was 0 and y was 0
f11 = the number of attributes where x was 1 and y was 1

• Simple Matching and Jaccard Coefficients


SMC = number of matches / number of attributes
= (f11 + f00) / (f01 + f10 + f11 + f00)

J = number of 11 matches / number of non-zero attributes


= (f11) / (f01 + f10 + f11)
SMC versus Jaccard: Example
x= 1000000000
y= 0000001001

f01 = 2 (the number of attributes where x was 0 and y was 1)


f10 = 1 (the number of attributes where x was 1 and y was 0)
f00 = 7 (the number of attributes where x was 0 and y was 0)
f11 = 0 (the number of attributes where x was 1 and y was 1)

SMC = (f11 + f00) / (f01 + f10 + f11 + f00)


= (0+7) / (2+1+0+7) = 0.7

J = (f11) / (f01 + f10 + f11) = 0 / (2 + 1 + 0) = 0


Cosine Similarity
• If d1 and d2 are two document vectors, then
cos( d1, d2 ) = <d1,d2> / ||d1|| ||d2|| ,
where <d1,d2> indicates inner product or vector dot product of
vectors, d1 and d2, and || d || is the length of vector d.
• 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.481
|| 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.449
cos(d1, d2 ) = 5 / (6.481*2.449) = 0.3150
Comparison of Proximity Measures
• Domain of application
– Similarity measures tend to be specific to the type of attribute
and data
– Record data, images, graphs, sequences, 3D-protein structure,
etc. tend to have different measures
• However, one can talk about various properties that you
would like a proximity measure to have
– Symmetry is a common one
– Tolerance to noise and outliers is another
– Ability to find more types of patterns?
– Many others possible
• The measure must be applicable to the data and produce
results that agree with domain knowledge
Information Based Measures
• Information theory is a well-developed and
fundamental disciple with broad applications

• Some similarity measures are based on


information theory
– Mutual information in various versions
– Maximal Information Coefficient (MIC) and related
measures
– General and can handle non-linear relationships
– Can be complicated and time intensive to compute
Information and Probability
• Information relates to possible outcomes of an event
– transmission of a message, flip of a coin, or measurement
of a piece of data

• The more certain an outcome, the less information that


it contains and vice-versa
– For example, if a coin has two heads, then an outcome of
heads provides no information
– More quantitatively, the information is related the
probability of an outcome
• The smaller the probability of an outcome, the more information it
provides and vice-versa
Discretization
• Discretization is the process of converting a
continuous attribute into an ordinal attribute
– A potentially infinite number of values are
mapped into a small number of categories
– Discretization is used in both unsupervised and
supervised settings
Unsupervised Discretization

Data consists of four groups of points and two outliers. Data is one-
dimensional, but a random y component is added to reduce overlap.
Unsupervised Discretization

Equal interval width approach used to obtain 4 values.


Unsupervised Discretization

Equal frequency approach used to obtain 4 values.


Unsupervised Discretization

K-means approach to obtain 4 values.


Binarization
• Binarization maps a continuous or categorical
attribute into one or more binary variables
Attribute Transformation
• An attribute transform is 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 functions: xk, log(x), ex, |x|
– Normalization
• Refers to various techniques to adjust to
differences among attributes in terms of
frequency of occurrence, mean, variance, range
• Take out unwanted, common signal, e.g.,
seasonality

You might also like