61
Akuisisi, Akuisisi, Integrasi dan Integrasi dan Eksplorasi Eksplorasi Data Data Bahan 2013::::Dr.Eng. Taufik Djatna Darajat, STP, MSi 1

Kuliah 2 - Data dan Eksplorasi Data.ppt

  • Upload
    brilili

  • View
    160

  • Download
    16

Embed Size (px)

Citation preview

Page 1: Kuliah 2 - Data dan Eksplorasi Data.ppt

Akuisisi, Integrasi Akuisisi, Integrasi dan Eksplorasi dan Eksplorasi

DataData

Bahan 2013::::Dr.Eng. Taufik Djatna Darajat, STP, MSi1

Page 2: Kuliah 2 - Data dan Eksplorasi Data.ppt

What is Data?Collection of data objects and

their attributesAn 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

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

Page 3: Kuliah 2 - Data dan Eksplorasi Data.ppt

Attribute valuesAttribute values are numbers or symbols

assigned to an attribute

Distinction between attributes and attribute valuesSame 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 value3

Page 4: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 5: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 6: Kuliah 2 - Data dan Eksplorasi Data.ppt

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 Data6

Page 7: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 8: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 9: Kuliah 2 - Data dan Eksplorasi Data.ppt

Ordered DataTemporal 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

Page 10: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 11: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

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

Page 12: Kuliah 2 - Data dan Eksplorasi Data.ppt

Noise 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

Two Sine Waves Two Sine Waves + Noise12

Page 13: Kuliah 2 - Data dan Eksplorasi Data.ppt

Outliers Outliers are data objects with characteristics that are

considerably different than most of the other data objects in the data set

13

Page 14: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 15: Kuliah 2 - Data dan Eksplorasi Data.ppt

Duplicate DataData set may include data objects that are

duplicates, or almost duplicates of one anotherMajor issue when merging data from heterogonous

sourcesExamples: 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 cleaningProcess of dealing with duplicate data issues

15

Page 16: Kuliah 2 - Data dan Eksplorasi Data.ppt

07/05/08

SUMBER DATASUMBER DATA

1.Transaksi Sistem operasi:: 2.Data Warehouse dan Datamart3.Aplikasi-aplikasi OLAP / Business

Intelligence4.Survey

1.Jumlah partisipan2.Bentuk kuisioner langsung ke ide

5.Database Rumah tangga dan Demografik

Page 17: Kuliah 2 - Data dan Eksplorasi Data.ppt

Data Pre-processingData Pre-processingAggregationAggregationSamplingSamplingDimensionality ReductionDimensionality ReductionFeature subset selectionFeature subset selectionFeature creationFeature creationDiscretization and BinarizationDiscretization and BinarizationAttribute TransformationAttribute Transformation

17

Page 18: Kuliah 2 - Data dan Eksplorasi Data.ppt

AggregationCombining 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

Page 19: Kuliah 2 - Data dan Eksplorasi Data.ppt

Several motivations for aggregationSmaller 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

Page 20: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 21: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 22: Kuliah 2 - Data dan Eksplorasi Data.ppt

Types of SamplingSimple Random Sampling

There is an equal probability of selecting any particular item

Sampling without replacementAs each item is selected, it is removed from the

population

Sampling with replacementObjects 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 once22

Page 23: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 24: Kuliah 2 - Data dan Eksplorasi Data.ppt

Dimensionality ReductionDimensionality ReductionPurpose:Reduce amount of time and memory

required by data mining algorithmsAllow data to be more easily visualizedMay help to eliminate irrelevant

features or reduce noise

TechniquesPrinciple Component Analysis

24

Page 25: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 26: Kuliah 2 - Data dan Eksplorasi Data.ppt

26

Feature Selection for Correlated Feature Selection for Correlated Numerical MeasurementNumerical Measurement

Page 27: Kuliah 2 - Data dan Eksplorasi Data.ppt

27

F1 F2 F3 … FM C

I1 60 0 21 .. 61

I2 10 1 30 .. 51

I3 31 10 1 .. 41

I4 2 11 0 .. 1

.. .. … .. … .. …

.. .. .. .. … .. …

… … .. .. … … …

IN 21 21 30 … 50

Goal:Goal:Find the most compact and Find the most compact and informative attributesinformative attributes

Target Class Type (C) in Numerical Database:

Categorical Classification

Continues Regression

Attribute Selection Problem DefinitionAttribute Selection Problem Definition

Page 28: Kuliah 2 - Data dan Eksplorasi Data.ppt

07/05/08

Pelatihan Teknik Dasar Data mining dan Data Warehousing

Page 29: Kuliah 2 - Data dan Eksplorasi Data.ppt

29

Conventional Attribute Selection TechniqueConventional Attribute Selection Technique

Distance Based :

RELIEF (Kira and Rendel 1992)

Correlation Based:

CFS (Hall, 1998)

Page 30: Kuliah 2 - Data dan Eksplorasi Data.ppt

30

Distance Based : ReliefDistance Based : Relief

nearest hit (H) between same classnearest miss (M) between different class

Hhit

Mmiss

Hhit

Mmiss

Wx1= (-10/10+6/10 -1/10+5/10

-3/10+2/10

Wx2= (-3/9+1/9 -5/9+2/9

-4/9+4/9

Max x1=12, min x1=2 range =10

Max x2=14, min x2=5range=9

Sample =5

Wx1 > Wx2 select x1

X1 X2 Class

2 5

8 7

5 10

12 10

6 14

2 1285 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

Page 31: Kuliah 2 - Data dan Eksplorasi Data.ppt

31

Correlation Based : CFSCorrelation Based : CFS

1

;( 1)

; ( ) 2

# . 2

1 attribute

0

cfF

f f

k

XY xy i biix y

ibi

krScore

k k k r

xyr r p X x rX Y

k cat value k

X xX binary

otherwise

(2,5)

(8,7)

(12,10)(5,10)

(6,14)Sum(x1.x2)=(2*5+ ….+ 6*14)= 310,

x1=3.71; x2=4.08

rx1x2=310/(2(3.71*4.08))= 29.14

rx1.class=2/5(2+0+0+12+0)+ 3/5(0+8+5+0+6)=85/5= 17

rx2.class=2/5(5+0+0+10+0)+ 3/5(0+7+10+0+14) =123/5= 24.6

Score x2> Score x1 Select x2

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

Page 32: Kuliah 2 - Data dan Eksplorasi Data.ppt

32

2.1.4 Problem of Conventional Methods 2.1.4 Problem of Conventional Methods healthy

Ignore the existence of correlated attributesNo mechanism to revive correlated attributesHard to find knowledge in correlated attributes

Wei

ght

(kg)

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

Page 33: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 34: Kuliah 2 - Data dan Eksplorasi Data.ppt

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 useful34

Page 35: Kuliah 2 - Data dan Eksplorasi Data.ppt

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 valuesSimple functions: xk, |x|Standardization and Normalization

35

Page 36: Kuliah 2 - Data dan Eksplorasi Data.ppt

Summary StatisticsSummary 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

Page 37: Kuliah 2 - Data dan Eksplorasi Data.ppt

Frequency and ModeThe 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

Page 38: Kuliah 2 - Data dan Eksplorasi Data.ppt

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.

Page 39: Kuliah 2 - Data dan Eksplorasi Data.ppt

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.

Page 40: Kuliah 2 - Data dan Eksplorasi Data.ppt

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 trendsCan detect outliers and unusual patterns

Page 41: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 42: Kuliah 2 - Data dan Eksplorasi Data.ppt

RepresentationIs the mapping of information to a visual formatData 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 pointsTheir 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.

Page 43: Kuliah 2 - Data dan Eksplorasi Data.ppt

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:

Page 44: Kuliah 2 - Data dan Eksplorasi Data.ppt

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)

Page 45: Kuliah 2 - Data dan Eksplorasi Data.ppt

Two-Dimensional Histograms Show the joint distribution of the values of two attributes Example: petal width and petal length

What does this tell us?

Page 46: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

10th percentile

25th percentile

75th percentile

50th percentile

10th percentile

Page 47: Kuliah 2 - Data dan Eksplorasi Data.ppt

Example of Box Plots Box plots can be used to compare attributes

Page 48: Kuliah 2 - Data dan Eksplorasi Data.ppt

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

Page 49: Kuliah 2 - Data dan Eksplorasi Data.ppt

Scatter Plot Array of Iris Attributes

Page 50: Kuliah 2 - Data dan Eksplorasi Data.ppt

OLAPOn-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 fieldsThere are a number of data analysis and data

exploration operations that are easier with such a data representation.

Page 51: Kuliah 2 - Data dan Eksplorasi Data.ppt

Creating a Multidimensional ArrayTwo 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.

Page 52: Kuliah 2 - Data dan Eksplorasi Data.ppt

Example: Iris dataWe 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

Page 53: Kuliah 2 - Data dan Eksplorasi Data.ppt

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.

Page 54: Kuliah 2 - Data dan Eksplorasi Data.ppt

Example: Iris data (continued) Slices of the multidimensional array are shown by the

following cross-tabulations What do these tables tell us?

Page 55: Kuliah 2 - Data dan Eksplorasi Data.ppt

OLAP Operations: Data CubeThe key operation of a OLAP is the formation of a data

cubeA 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.

Page 56: Kuliah 2 - Data dan Eksplorasi Data.ppt

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-dimensionalaggregates (3 choose 2 ),3 one-dimensional aggregates,and 1 zero-dimensional aggregate (the overall total)

Data Cube Example

Page 57: Kuliah 2 - Data dan Eksplorasi Data.ppt

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)

Page 58: Kuliah 2 - Data dan Eksplorasi Data.ppt

OLAP Operations: Slicing and DicingSlicing 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.

Page 59: Kuliah 2 - Data dan Eksplorasi Data.ppt

OLAP Operations: Roll-up and Drill-downAttribute 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 latticeA year contains months which contains dayA country contains a state which contains a city

Page 60: Kuliah 2 - Data dan Eksplorasi Data.ppt

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.

Page 61: Kuliah 2 - Data dan Eksplorasi Data.ppt

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