You are on page 1of 61

Akuisisi, Integrasi

dan Eksplorasi
Data
Bahan 2013::::Dr.Eng. Taufik Djatna Darajat, STP, MSi
1
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 an object
Object is also known as record,
point, case, sample, entity, or
instance

Tid Refund Marital
Status
Taxable
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

Attributes
Objects
Attribute values
Attribute values are numbers or symbols
assigned to an attribute

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 values can be different
ID has no limit but age has a maximum and minimum value
3
4
Tipe atribut Deskripsi Contoh
Kategori
(kualitatif)
Nominal Nilai dari atribut nominal adalah nama-
nama yang berbeda, yaitu nilai nominal
hanya menyediakan informasi yang cukup
untuk membedakan satu objek dengan objek
yang lain. (= dan =)
Kode pos, ID
Number
karyawan,
warna mata,
jenis kelamin
Ordinal Nilai dari atribut ordinal menyediakan
informasi yang cukup mengurutkan objek.
(<, >)
Nomor jalan,
grade
Numerik
(Kuantitatif)
Interval Untuk atribut interval, perbedaan antarnilai
adalah sesuatu yang berarti, adanya unit
pengukuran. (+,)
Tanggal pada
kalender
Ratio Untuk variabel rasio, perbedaan dan rasio
merupakan hal yang berarti. (*, /)
Kuantitas
moneter, count,
umur, panjang,
arus listrik
Tipe-tipe atribut yang berbeda
Discrete and Continuous Attributes
Discrete Attribute
Has only a finite or count ably 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.

5
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

6
Record Data
Data that consists of a collection of records, each of which
consists of a fixed set of attributes


Tid Refund Marital
Status
Taxable
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

7
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 Bread, Coke, Milk
2 Beer, Bread
3 Beer, Coke, Diaper, Milk
4 Beer, Bread, Diaper, Milk
5 Coke, Diaper, Milk

8
Ordered Data
Temporal Data
Temporal data is data whose
objects have attributes that
represent measurements
taken over time.
For example, financial data
set are time series that give
the daily prices of various
stocks.
A time series is a sequence of
measurements of some
attribute
e.g., stock price or rainfall,
taken at (usually regular)
points in time.)
9
Ordered Data
Sequences of transactions
An element of
the sequence
Items/Events
The data still consists of
a set of transactions and
items, but time and
customer ID attributes
are associated with each
transaction.
10
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
11
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


Two Sine Waves Two Sine Waves +
Noise
12
Outliers
Outliers are data objects with characteristics that are
considerably different than most of the other data objects
in the data set

13
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
Estimate Missing Values the missing values can be estimated
(interpolated) by using the remaining values.
Ignore the Missing Value During Analysis
e.g., suppose that objects are being clustered and the similarity between
pairs of data objects.
the similarity can be calculated by using only the non-missing attributes
14
Duplicate Data
Data set may include data objects that are
duplicates, or almost duplicates of one another
Major issue when merging data from heterogonous
sources
Examples: Same person with multiple email addresses
That care needs to be taken to avoid accidentally
combining data objects that are similar, but not
duplicates.
Data cleaning
Process of dealing with duplicate data issues
15
07/05/08
SUMBER DATA
1.Transaksi Sistem operasi::
2.Data Warehouse dan Datamart
3.Aplikasi-aplikasi OLAP / Business
Intelligence
4.Survey
1.Jumlah partisipan
2.Bentuk kuisioner langsung ke ide
5.Database Rumah tangga dan Demografik
Data Pre-processing
Aggregation
Sampling
Dimensionality Reduction
Feature subset selection
Feature creation
Discretization and Binarization
Attribute Transformation
17
Aggregation
Combining two or more attributes (or objects)
into a single attribute (or object)
Purpose
Data reduction
Reduce the number of attributes or objects
Change of scale
Cities aggregated into regions, states, countries, etc
More stable data
Aggregated data tends to have less variability
18
Several motivations for aggregation
Smaller data sets require less memory and
processing time.
if the aggregation is done properly then the
aggregation can act as a change of scope or
scale, providing a high level view of the data
instead of a low level view.
the behaviour of groups of objects or
attributes is often more stable that that of
individual objects or attributes.

19
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.
20
Sampling
The key principle for effective sampling is the
following:
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

if the standard deviation is the property of interest,
then a sample is representative if the sample has a
standard deviation that is close to that of the original
data
21
Types of Sampling
Simple Random Sampling
There is an equal probability of selecting any particular
item

Sampling without replacement
As each item is selected, it is removed from the
population

Sampling with replacement
Objects are not removed from the population as they
are selected for the sample.
In sampling with replacement, the same object can be picked
up more than once

22
Sample Size
8000 points 2000 Points 500 Points
Larger sample sizes increase the probability that a sample
will be representative, but also eliminate much of the
advantage of sampling.
Conversely, with smaller sample sizes, patterns may be
missed or erroneous patterns detected.
23
Dimensionality Reduction
Purpose:
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

Techniques
Principle Component Analysis
24
Feature Subset Selection
Another way to reduce dimensionality of data

Redundant features
duplicate much or all of the information contained in one or more
other attributes
Example: purchase price of a product and the amount of sales tax
paid

Irrelevant features
contain no information that is useful for the data mining task at
hand
Example: students' ID is often irrelevant to the task of predicting
students' GPA
25
26
Feature Selection for Correlated
Numerical Measurement
27
F
1
F
2
F
3


F
M
C
I
1
60 0 21 .. 61
I
2
10 1 30 .. 51
I
3
31 10 1 .. 41
I
4
2 11 0 .. 1
.. .. .. ..
.. .. .. .. ..
.. ..
I
N
21 21 30 50
Goal:
Find the most compact and
informative attributes
Target Class Type (C) in
Numerical Database:
Categorical Classification
Continues Regression
Attribute Selection Problem Definition

07/05/08
Pelatihan Teknik Dasar Data mining dan Data Warehousing
29
Conventional Attribute Selection Technique
Distance Based :
RELIEF (Kira and Rendel 1992)
Correlation Based:
CFS (Hall, 1998)
30
Distance Based : Relief
nearest hit (H) between same class
nearest miss (M) between different class
H
hit
M
miss
H
hit
M
miss
W
x1
= (-10/10+6/10 -1/10+5/10
-3/10+2/10
W
x2
=
(-3/9+1/9 -5/9+2/9
-4/9+4/9
Max x
1
=12, min x
1
=2 range =10
Max x
2
=14, min x
2
=5range=9
Sample =5
Wx
1
> Wx
2
select x
1
X1 X2 Class
2 5
8 7
5 10
12 10
6 14
2
12 8
5
6
5
7
10
14
-1/10+6/10
-10/10+4/10)/5= -0.04
-5/9+3/9
-4/9+4/9)/5= -0.133
31
Correlation Based : CFS
1
;
( 1)
; ( )
2
# . 2
1
attribute
0
cf
F
f f
k
XY xy i bi
i
x y
i
bi
kr
Score
k k k r
xy
r r p X x rX Y
k cat value k
X x
X binary
otherwise
o o
=
=
+
= = =
= =
=

(2,5)
(8,7)
(12,10)
(5,10)
(6,14)
Sum(x
1
.x
2
)=(2*5+.+6*14)= 310,
o
x1
=3.71; o
x2
=4.08
r
x1x2
=310/(2(3.71*4.08))= 29.14

r
x1.class
=2/5(2+0+0+12+0)+
3/5(0+8+5+0+6)=85/5= 17
r
x2.class
=2/5(5+0+0+10+0)+
3/5(0+7+10+0+14) =123/5= 24.6
Score x
2
> Score x
1
Select x
2
2 5 6 8 12
5
7
10
14
X1 X2 Class
2 5
8 7
5 10
12 10
6 14
1
2
2*17
2 2(2 1)29.14
2*24.6
2 2(2 1)29.14
= =
+
= =
+
4.38
6.34
X
X
Score
Score
32
2.1.4 Problem of Conventional Methods









healthy
Ignore the existence of correlated attributes
No mechanism to revive correlated attributes
Hard to find knowledge in correlated attributes
W
e
i
g
h
t

(
k
g
)

Height (cm)
140 150 160 170
50
40
60
70
Target attribute /
(health status) is
only decided by both
attributes
Mapping
Data in two
dimension
HOME WORK
Compute which attribute the most relevant one to classify
the target?, compare Relief`
a1 a2 a3 a4 target
2 3 2 1 Star
3 4 4 1 Circle
4 3 3 16 Star
1 4 7 5 Circle
1 3 9 9 Star
1 2 3 6 Star
3 2 2 0 Star
4 2 1 6 Circle
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
the creation of a new, smaller set of features from the original set of
features.
E.g., consider a set of photographs, where each photograph is to be
classified according to whether it contains a human face or not
Mapping Data to New Space
e.g. for each time series, the Fourier transform produces a
new data object, whose attributes are related to frequencies.
Feature Construction
combining features
one or more new features constructed out of the original features may
be more useful
34
Attribute 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 functions: x
k
, |x|
Standardization and Normalization
35
Summary Statistics
Summary statistics are numbers that
summarize properties of the data

Summarized properties include frequency, location
and spread
Examples: location - mean
spread - standard deviation

Most summary statistics can be calculated in a single
pass through the data

Frequency and Mode
The frequency of an attribute value is the
percentage of time the value occurs in the
data set
For example, given the attribute gender and a representative
population of people, the gender female occurs about 50%
of the time.
The mode of a an attribute is the most frequent
attribute value
The notions of frequency and mode are typically used
with categorical data
Measures of Location: Mean and Median
The mean is the most common measure of the location of
a set of points.
However, the mean is very sensitive to outliers.
Thus, the median or a trimmed mean is also commonly
used.
Measures of Spread: Range and Variance
Range is the difference between the max and min
The variance or standard deviation is the most common
measure of the spread of a set of points.


However, this is also sensitive to outliers, so that other
measures are often used.

Visualization
Visualization is the conversion of data into a
visual or tabular format so that the
characteristics of the data and the relationships
among data items or attributes can be analysed
or reported.

Visualization of data is one of the most
powerful and appealing techniques for data
exploration.
Can detect general patterns and trends
Can detect outliers and unusual patterns

Example: Sea Surface Temperature
The following shows the Sea Surface Temperature (SST) for
July 1982
Tens of thousands of data points are summarized in a single
figure



Representation
Is the mapping of information to a visual format
Data objects, their attributes, and the
relationships among data objects are translated
into graphical elements such as points, lines,
shapes, and colors.
Example:
Objects are often represented as points
Their attribute values can be represented as the
position of the points or the characteristics of the
points, e.g., color, size, and shape
If position is used, then the relationships of points,
i.e., whether they form groups or a point is an outlier,
is easily perceived.
Arrangement
Is the placement of visual elements within a display
Can make a large difference in how easy it is to understand
the data
Example:


Visualization Techniques: Histograms
Histogram
Usually shows the distribution of values of a single variable
Divide the values into bins and show a bar plot of the number of objects in
each bin.
The height of each bar indicates the number of objects
Shape of histogram depends on the number of bins
Example: Petal Width (10 and 20 bins, respectively)

Two-Dimensional Histograms
Show the joint distribution of the values of two attributes
Example: petal width and petal length
What does this tell us?
Visualization Techniques: Box Plots
Box Plots
Invented by J. Tukey
Another way of displaying the distribution of data
Following figure shows the basic part of a box plot


outlier
10
th
percentile
25
th
percentile
75
th
percentile
50
th
percentile
10
th
percentile
Example of Box Plots
Box plots can be used to compare attributes


Visualization Techniques: Scatter Plots
Scatter plots
Attributes values determine the position
Two-dimensional scatter plots most common, but can have
three-dimensional scatter plots
Often additional attributes can be displayed by using the size,
shape, and color of the markers that represent the objects
It is useful to have arrays of scatter plots can compactly
summarize the relationships of several pairs of attributes
See example on the next slide


Scatter Plot Array of Iris Attributes
OLAP
On-Line Analytical Processing (OLAP) was
proposed by E. F. Codd, the father of the
relational database.
Relational databases put data into tables, while
OLAP uses a multidimensional array
representation.
Such representations of data previously existed in
statistics and other fields
There are a number of data analysis and data
exploration operations that are easier with such
a data representation.

Creating a Multidimensional Array
Two key steps in converting tabular data into a
multidimensional array.
First, identify which attributes are to be the dimensions and
which attribute is to be the target attribute whose values
appear as entries in the multidimensional array.
The attributes used as dimensions must have discrete
values
The target value is typically a count or continuous value,
e.g., the cost of an item
Can have no target variable at all except the count of
objects that have the same set of attribute values
Second, find the value of each entry in the multidimensional
array by summing the values (of the target attribute) or
count of all objects that have the attribute values
corresponding to that entry.
Example: Iris data
We show how the attributes, petal length, petal width,
and species type can be converted to a
multidimensional array
First, we discretized the petal width and length to have
categorical values: low, medium, and high
We get the following table - note the count attribute

Example: Iris data (continued)
Each unique tuple of petal width, petal length, and species
type identifies one element of the array.
This element is assigned the corresponding count value.
The figure illustrates
the result.
All non-specified
tuples are 0.

Example: Iris data (continued)
Slices of the multidimensional array are shown by the
following cross-tabulations
What do these tables tell us?

OLAP Operations: Data Cube
The key operation of a OLAP is the formation of a data
cube
A data cube is a multidimensional representation of
data, together with all possible aggregates.
By all possible aggregates, we mean the aggregates
that result by selecting a proper subset of the
dimensions and summing over all remaining
dimensions.
For example, if we choose the species type dimension
of the Iris data and sum over all other dimensions, the
result will be a one-dimensional entry with three
entries, each of which gives the number of flowers of
each type.
Consider a data set that records the sales of products at a
number of company stores at various dates.
This data can be represented
as a 3 dimensional array
There are 3 two-dimensional
aggregates (3 choose 2 ),
3 one-dimensional aggregates,
and 1 zero-dimensional
aggregate (the overall total)

Data Cube Example
The following figure table shows one of the two
dimensional aggregates, along with two of the one-
dimensional aggregates, and the overall total

Data Cube Example (continued)
OLAP Operations: Slicing and Dicing
Slicing is selecting a group of cells from the
entire multidimensional array by specifying a
specific value for one or more dimensions.
Dicing involves selecting a subset of cells by
specifying a range of attribute values.
This is equivalent to defining a subarray from the
complete array.
In practice, both operations can also be
accompanied by aggregation over some
dimensions.
OLAP Operations: Roll-up and Drill-down
Attribute values often have a hierarchical
structure.
Each date is associated with a year, month, and week.
A location is associated with a continent, country,
state (province, etc.), and city.
Products can be divided into various categories, such
as clothing, electronics, and furniture.
Note that these categories often nest and form a
tree or lattice
A year contains months which contains day
A country contains a state which contains a city
OLAP Operations: Roll-up and Drill-down
This hierarchical structure gives rise to the roll-
up and drill-down operations.
For sales data, we can aggregate (roll up) the sales
across all the dates in a month.
Conversely, given a view of the data where the time
dimension is broken into months, we could split the
monthly sales totals (drill down) into daily sales
totals.
Likewise, we can drill down or roll up on the
location or product ID attributes.
References
Chakrabarti, S., et.a l. 2009. Data Mining
know It All. Morgan Kaufmann Publishers.
Elsevier, Amsterdam.
Tan P., Michael S., & Vipin K. 2006.
Introduction to Data mining. Pearson
Education, Inc.
Han J & Kamber M. 2012. Data mining
Concept and Techniques.Morgan-Kauffman,
San Diego
61

You might also like