chapter 2 introduction to data mining - wipawan's blog · chapter 2 introduction to data...

38
Chapter 2 Introduction to Data Mining 01/06/57 1 Introduction to Data Mining โดย ผศ.วิภาวรรณ บัวทอง

Upload: others

Post on 14-Mar-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 2 Introduction to Data Mining

01/06/571 Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง2

ววฒนาการ

เทคโนโลยฐานขอมล

ววฒนาการของ Data Mining

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง3

ป ค.ศ. 1960 : Data Collection คอการน าขอมลมาจดเกบอยางเหมาะสมในอปกรณทนาเชอถอ เพอปองกนการสญหาย ป ค.ศ. 1980 : Data Access คอการน าขอมลทจดเกบมาสราง

ความสมพนธระหวางกน เพอน าไปวเคราะหและตดสนใจอยางมประสทธภาพ ป ค.ศ. 1990 : Data Warehouse and Decision Support คอ

การน าขอมลมาเกบลงในฐานขอมลขนาดใหญ ครอบคลมการใชงานทงหมดขององคกรเพอชวยสนบสนนการตดสนใจ ป ค.ศ. 2000 : Data Mining คอการน าขอมลจากฐานขอมลมา

วเคราะหและประมวลผลโดยสรางแบบจ าลองและความสมพนธ

วตถประสงคในการใช Data Mining

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง4

เพอการคนพบองคความรใหมในฐานขอมล (Knowledge discovery in database) เพอการสกดองคความรทซอนเรนอย (Knowledge Extraction) เพอจดการกบขอมลในอดต (Data archeology) เพอส ารวจขอมล (Data exploration) เพอคนหา Pattern ของขอมลทซอนอย (Data pattern

processing) เพอใชขดเจาะขอมล (Data dredging) เพอเกบเกยวผลประโยชนใหไดมาซงสารสนเทศทมประโยชน

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง5

Data Mining—What’s in a Name?

Data MiningKnowledge Mining

Knowledge Discoveryin Databases

Data Archaeology

Data Dredging

Database MiningKnowledge Extraction

Data Pattern Processing

Information Harvesting

Siftware

The process of discovering meaningful new correlations, patterns, and trends by

sifting through large amounts of stored data, using pattern recognition

technologies and statistical and mathematical techniques

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง6

Data Mining

Machine learning

DBMS

Statistics

Visuali

zation

Artificial

Intelligence

Algorithms

Integration of Multiple Technologies

What is Data Mining ?

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง7

“Extraction of interesting patterns or knowledge from huge amount of data” “การคนหาความสมพนธและรปแบบทงหมด ซงมอยจรงใน

ฐานขอมลแตไดถกซอนไวภายในขอมลจ านวนมาก” “เปนการสงเคราะหขอมลอยางละเอยดจากฐานขอมลขนาดใหญ

หรออาจวเคราะหมาจากรายการ Transaction โดยเรยนรขอมลจากอดตหรอปจจบน” “เทคนคทผใชสามารถปฏบตการไดโดยอตโนมตกบขอมลทไมรจก

ซงเปนการเพมคณคา ใหกบขอมลทม”

Knowledge Discovery in Databases: Process

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง8

DataTargetData

Selection

Knowledge

PreprocessedData

Patterns

Data Mining

Interpretation/Evaluation

Preprocessing

adapted from:

U. Fayyad, et al. (1995), “From Knowledge Discovery to Data

Mining: An Overview,” Advances in Knowledge Discovery and

Data Mining, U. Fayyad et al. (Eds.), AAAI/MIT Press

ขนตอนการคนหาความรใหม (Steps of a KDD Process)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง9

1) คดเลอกขอมล (data selection) เปนการระบถงแหลงขอมลทจะน ามาท าเหมอง รวมถงการน าขอมลทตองการออกจากฐานขอมล เพอสรางกลมขอมลส าหรบพจารณาเบองตน

2) การกรองขอมลและประมวลผล (data cleaning and preprocessing) ขอมลทเกบไวจ านวนมากจะถกน ามากรองเพอเลอกขอมลทตรงประเดนเพอน าไปวเคราะห

3) การแปลงรปแบบขอมล(data reduction and transformation) เปนการลดรปและจดขอมลใหอยในรปแบบเดยวกนทไดมาตรฐาน และเหมาะสมทจะน าไปใชกบอลกอรทมและแบบจ าลองทใชท าเหมองขอมล

ขนตอนการคนหาความรใหม (Steps of a KDD Process)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง10

4) เ ลอก Functions ของ data mining เ ชน summarization, classification, regression, association และ clustering เปนตน โดยทวไปประเภทของงานตามลกษณะของแบบจ าลองทใชในการท าเหมองขอมลนน สามารถแบงกลมไดเปน 2 ประเภทใหญๆ คอ4.1 Predictive data mining เปนการท านาย คาดคะเนลกษณะหรอ ประมาณคาของขอมลโดยใชขอมลจากอดตทผานมา สรางตนแบบทสามารถใชท านายกบขอมลใหม หรอขอมลทเกดขนภายหลง4.2 Descriptive data mining เปนการหาแบบจ าลองเพออธบายลกษณะบางอยางของขอมลทมอย ใชเปนแนวทางในการตดสนใจ โดยสวนมากจะเปนการแบงกลม

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง11

5) ท าการคนหา patterns ทเราสนใจ

6) ประเมนผล patterns และน าเสนอองคความร ในขนตอนนเปนการวเคราะหผลลพธทไดและแปลความหมายวาผลลพธนนเหมาะสมหรอตรงวตถประสงคหรอไมและน าเสนอ

7) ใชองคความรทคนพบ (Use of discovered knowledge)

ขนตอนการคนหาความรใหม (Steps of a KDD Process)

ชนดขององคความรทคนพบ (Type of knowledge to be mined)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง12

คณลกษณะของขอมล (Characterization) เชน รวาคนทสามารถเรยนตอในระดบปรญญาเอกไดจะพจารณาจากคณลกษณะใด การจ าแนกขอมล (Discrimination) ความสมพนธของขอมล (Association) เชน มความสมพนธของการ

ซอสนคา พบวา ถาลกคาซอปอบคอรน จะตองซอโคกดวย การแยกประเภทขอมลและการพยากรณ (Classification/prediction) การจดกลมขอมล (Clustering) การวเคราะหขอมลจากภายนอก (Outlier analysis) ขอมลอนๆ ในงานทคนพบ (Other data mining tasks)

สถาปตยกรรมของ Data Mining

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง13

User Interface

Pattern Evaluation

Data Mining Engine

Database or Data

Warehouse Server

Data cleaning, integration and selection

DatabaseWorld Wide

Web

Data

Warehouse

Other Info

Repositories

Knowledge

Base

Data Mining Concepts and Techniques

Supervised learning Unsupervised learning

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง14

Classification เปนการจ าแนกขอมลออกเปน

ประเภทตางๆ อาศยการเรยนรจากขอมลเกา

Regression การประมาณคาจ านวนหรอ

ปรมาณทเปนตวเลข อาศยการเรยนรจากขอมลเกา

Clustering แบงขอมลออกเปนหลายๆ

กลม อาศยความคลายคลงกนของ

ขอมล Association อาศยความสมพนธของขอมล

ทเกดรวมกน สรางเปนกฎความสมพนธ

ประเภทของขอมลทใชใน Data Mining

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง15

ฐานขอมลเชงสมพนธ คลงขอมล ฐานขอมลรายการปรบปรง ฐานขอมลพเศษหรอทเกบขาวสารพเศษ ไดแก

- ฐานขอมลเชงวตถ- ขอมลเกยวกบเวลา- ฐานขอมลขอความ (Text database) และฐานขอมลมลตมเดย- ฐานขอมลแบบเกาในอดตหรอขอมลทมาจากตางฐานขอมลกน

- ขอมลจากแหลง www และอนๆ

Relational Database

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง16

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

Transaction Data

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง17

A special type of record data, where each record (transaction) involves a set of items.

TID Items

1 Bread, Coke, Milk

2 Beer, Bread

3 Beer, Coke, Diaper, Milk

4 Beer, Bread, Diaper, Milk

5 Coke, Diaper, Milk

Data Matrix

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง18

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

1.12.216.226.2512.65

1.22.715.225.2710.23

Thickness LoadDistanceProjection

of y load

Projection

of x Load

1.12.216.226.2512.65

1.22.715.225.2710.23

Thickness LoadDistanceProjection

of y load

Projection

of x Load

Ordered Data

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง19

Spatio-Temporal Data

Average Monthly

Temperature of

land and ocean

Document Data

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง20

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.

Document 1

se

aso

n

time

ou

t

lostwin

ga

me

sco

re

ba

ll

pla

y

co

ach

tea

m

Document 2

Document 3

3 0 5 0 2 6 0 2 0 2

0

0

7 0 2 1 0 0 3 0 0

1 0 0 1 2 2 0 3 0

Graph Data

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง21

Examples: Generic graph and HTML Links

5

2

1

2

5

<a href="papers/papers.html#bbbb">

Data Mining </a>

<li>

<a href="papers/papers.html#aaaa">

Graph Partitioning </a>

<li>

<a href="papers/papers.html#aaaa">

Parallel Solution of Sparse Linear System of Equations </a>

<li>

<a href="papers/papers.html#ffff">

N-Body Computation and Dense Linear System Solvers

Chemical Data

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง22

Benzene Molecule: C6H6

Ordered Data

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง23

Genomic sequence data

GGTTCCGCCTTCAGCCCCGCGCC

CGCAGGGCCCGCCCCGCGCCGTC

GAGAAGGGCCCGCCTGGCGGGCG

GGGGGAGGCGGGGCCGCCCGAGC

CCAACCGAGTCCGACCAGGTGCC

CCCTCTGCTCGGCCTAGACCTGA

GCTCATTAGGCGGCAGCGGACAG

GCCAAGTAGAACACGCGAAGCGC

TGGGCTGCCTGCTGCGACCAGGG

Type of Data Sets

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง24

Ordered Spatial Data Temporal Data Sequential Data Genetic Sequence Data

Record Data Matrix Document Data Transaction Data

Graph World Wide Web Molecular Structures

Attributes Data Types แบงเปน 2 ชนด

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง25

o ตวแปรแบบ Categorical 1. Nominal variable ขอมลทถกอางถงไมมล าดบความส าคญ ในคาทสามารถ

เปนไปได เชน สถานการณแตงงาน (โสด, แตงงาน, หยา, หมาย) หรอ เพศ (ชาย, หญง) หรอระดบการศกษา (ป.โท, ป.ตร, ม.ปลาย, ปวช.)

2. Ordinal variable ขอมลทอางถงจะมล าดบส าหรบคาทเปนไปได เชน ล าดบของลกคา (ด, ปานกลาง, ไมด)

o ตวแปรแบบ Quantitative 1. Continuous (คาทตอเนอง) เชน รายได, เฉลยจ านวนครงทซอ ฯลฯ2. Discrete (คาทเปนจ านวนเตม) เชน จ านวนพนกงาน, เวลาป

What Can Data Mining Do?

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง26

Cluster ClassifyCategorical, Regression

SummarizeSummary statistics,

Summary rules

Visualization

Link Analysis / Model DependenciesAssociation rules

Sequence analysisTime-series analysis,

Sequential associations Detect Deviations

Clustering

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง27

Find groups of similar data items Statistical techniques require some

definition of “distance” (e.g. between travel profiles) while conceptual techniques use background concepts and logical descriptions

Uses: Demographic analysisTechnologies: Self-Organizing Maps Probability Densities Conceptual Clustering

“Group people with similar travel profiles”George, PatriciaJeff, Evelyn, ChrisRob

Clusters

Classification

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง28

Find ways to separate data items into pre-defined groups We know X and Y belong together,

find other things in same group

Requires “training data”: Data items where group is known

Uses: ProfilingTechnologies: Generate decision trees (results are

human understandable) Neural Nets

“Route documents to most likely interested parties”English or non-english?Domestic or Foreign?

Groups

Training Data

tool produces

classifier

Association Rules

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง29

Identify dependencies in the data: X makes Y likely

Indicate significance of each dependency

Bayesian methodsUses: Targeted marketingTechnologies: AIS, SETM, Hugin, TETRAD II

“Find groups of items commonly purchased together” People who purchase fish are

extraordinarily likely to purchase wine

People who purchase Turkey are extraordinarily likely to purchase cranberries

Date/Time/Register Fish Turkey Cranberries Wine …

12/6 13:15 2 N Y Y Y …

12/6 13:16 3 Y N N Y …

คณภาพของขอมล (Data Quality )

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง32

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

ขอมลรบกวน (Noise)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง33

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 + Noise

คาทผดปกต (Outliers)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง34

Outliers are data objects with characteristics that are considerably different than most of the other data objects in the data set

คาทขาดหายไป (Missing Values)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง35

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 Ignore the Missing Value During AnalysisReplace with all possible values (weighted by their

probabilities)

ขอมลซาซอน (Duplicate Data)

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง36

Data set may include data objects that are duplicates, or almost duplicates of one anotherMajor issue when merging data from

heterogeneous sources Examples:Same person with multiple email addresses

Data cleaningProcess of dealing with duplicate data issues

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง37

Exercise

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง38

1. Classify the following attributes as binary discrete or continuous1.1 Age in year 1.2 Time in terms of AM or PM1.3 Brightness as measured by a light meter1.4 Angels as measured in degrees between 00 and 3600

1.5 Bronze, Sliver and Gold medals as awarded at the Olympics1.6 Height above sea level1.7 Number of patients in a hospital1.8 ISBN numbers for books1.9 Military rank1.10 Distance from center of campus

2. Classify the following items as Data Mining or Data Warehouse

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง39

No. QuestionData Mining/

Data Warehouse

2.1 ตองการทราบสาขาทมยอดขายมากทสดและนอยทสด 10 อนดบแรก

2.2 ตองการทราบพฤตกรรมของลกคาทมแนวโนมทจะยกเลกบตรเครดต

2.3 ตองการทราบปรมาณผลผลตออยในอก 3 เดอนถดไป

2.4 ตองการทราบจ านวนลกคาทจองรถและรบรถไปแลวในไตรมาสท 2

2.5 ตองการทราบลกษณะของลกคาทสนใจซอรถ Civic

=

3. The following information is held in an employee database.

01/06/57Introduction to Data Mining โดย ผศ.วภาวรรณ บวทอง40

What is the type of each variable?- Name - Sex- Date of Birth- Weight- Height- Martial Status- Number of Children