48
Data Mining Chapter3 Data Preprocessing

Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

Data Mining

Chapter3 Data Preprocessing

Page 2: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

2

Why Data Preprocessing ?

CRISP-DM = Cross-Industry Standard Process for Data Mining

• Workflow มาตรฐานส าหรบการท า DM • ประกอบดวย 6 ขนตอน • พฒนาโดย บรษท DaimlerChryler, SPSS,NCR

Business Understanding + Data Understanding + Data Preparation ใชเวลาถง 80% ของทงหมด

2

Page 3: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

3

เปนขนตอนกอนท ำเหมองขอมล เนองจำกขอมลในควำมเปนจรงมควำมบกพรอง คอ

- ขอมลไมสมบรณ (incomplete data) เชน คำของคณลกษณะขำดหำย

(missing value) ขำดคณลกษณะทนำสนใจหรอขำดรำยละเอยดของขอมล

- ขอมลรบกวน (noisy data) เชน ขอมลมคำผดพลำด (error) หรอมคำ

ผดปกต (Outliers)

- ขอมลไมสอดคลอง (Inconsistent data) เชน ขอมลเดยวกน แตตงชอตำงกน หรอ

ใชคำแทนขอมลทตำงกน

กำรเตรยมขอมล

Page 4: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

4

Data Cleaning Data Integration Data Transformation Data Reduction

Data Preprocessing Technique

Page 5: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

5 Forms of data preprocessing 5

Page 6: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

6

Real-world data tend to be incomplete, noisy and incosistent.

Data cleaning(or data cleansing) routines attempt to fill in missing values, smooth out noise while identifying outlier and correct inconsistencies in the data.

Data Cleaning

Page 7: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

7

ถำนกศกษำ เปนผจดกำรของบรษทแหงหนง และตองกำรวเครำะหขอมล

กำรขำยสนคำ และขอมลของลกคำ

นกศกษำ พบวำ มหลำยๆรำยกำร ไมมกำรบนทกคำในแตละฟลด หรอ แอททรบวต เชน ไมมกำรบนทกขอมลรำยไดของลกคำ

ค ำถำม ???

นกศกษำจะมวธกำรจดกำรคำทขำดหำยเหลำนไดอยำงไร

กำรจดกำร missing value

Page 8: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

8

1. Ignore the tuple 2. Fill in the missing value manually 3. Use a global constant to fill in the missing value 4. Use the attribute mean to fill in the missing value 5. Use the attribute mean for all samples belonging to the

same class as the given tuple 6. Use the most propable value to fill in the missing value

วธกำรจดกำรคำทขำดหำย

Page 9: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

9

ตดทงรำยกำรทมขอมลสญหำย นยมใชกบกำรท ำเหมองขอมลแบบจ ำแนกประเภท (Classification) ในกรณทคำคณลกษณะขำดหำยไปเปนจ ำนวนมำก

Ignore the tuple

Page 10: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

10

เตมคำทขำดหำยดวยมอ วธนไมเหมำะสมกรณทชดขอมลมขนำดใหญ และมขอมลขำดหำยจ ำนวนมำก

Fill in the missing value manually

Page 11: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

11

เตมคำคณลกษณะของขอมลทขำดหำยทกคำ ดวยคำคงทคำหนง เชน ไมรคำ หรอ unknown

Use a global constant to fill in the missing value

Page 12: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

12

ใชคำเฉลยของคณลกษณะ เตมคำขอมลทขำดหำย เชน ถำทรำบวำลกคำทรำยไดเฉลยเดอนละ 12,000 บำท จะใชคำนแทนคำรำยไดของลกคำทขำดหำย

Use the attribute mean to fill in the missing value

Page 13: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

13

ใชคำเฉลยคณลกษณะของตวอยำงทจดอยในประเภทเดยวกน เพอเตมคำขอมลทขำดหำย เชน

เตมคำรำยไดของลกคำทขำดหำย ดวยคำเฉลยของลกคำทอยในกลมอำชพ เดยวกน

Use the attribute mean for all samples belonging to the same class as the given tuple

Page 14: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

14

ใชคำทเปนไปไดมำกทสด เตมแทนคำขอมลทขำดหำย เชน คำทไดจำกสมกำรควำมถดถอย (Regression) คำทไดจำกกำรอนมำน โดยใชสตรของเบย (Bayesian formula) หรอตนไมตดสนใจ (Decision tree) เชน

ใชขอมลลกคำ มำสรำงตนไมตดสนใจ เพอท ำนำยรำยไดของลกคำ แลวน ำไปแทนคำทขำดหำย

วธนนยมกนแพรหลำย เนองจำกท ำนำยคำขอมลทขำดหำย โดยพจำรณำจำกคำของขอมลชดปจจบน และควำมสมพนธระหวำงคณลกษณะในชดขอมล

Use the most propable value to fill in the missing value

Page 15: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

15

ขอมลรบกวน เปนขอมลทมควำมผดพลำดแบบสม หรอคลำดเคลอนจำกกำรวด สำเหตของควำมผดพลำด อำจสบเนองมำจำก

- อปกรณเกบรวบรวมขอมลท ำหนำทผดพลำด - ปญหำกำรบนทกหรอปอนคำขอมล - ปญหำกำรสงขอมล (data transmission)ผดพลำด - ขอจ ำกดทำงเทคโนโลย เชน ขอจ ำกดของขนำดบฟเฟอร

ขอมลรบกวน (Noisy data)

Page 16: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

16

ท ำไดหลำยวธ เชน Binning Methods Regression Clustering

กำรจดกำรขอมลรบกวน

Page 17: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

17

กำรปรบขอมลใหเรยบดวยวธกำรแบบ binning ท ำโดย

-เรยงล ำดบขอมล แลวใชหลกกำรตดแบง (partition) แบงขอมลออกเปนสวนแตละสวนเรยกวำ bin แลวท ำกำรปรบขอมลในแตละ bin โดยใชคำทไดจำกเพอนบำนใกลเคยง (neighborhood) ใน bin หรอ bucket เดยวกนเชน คำเฉลยของ bin (bin means) คำกลำงของ bin (bin medians) หรอคำขอบของ bin (bin boundaries)

Binning Methods

Page 18: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

18 Binning methods for data smoothing.

Page 19: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

19

วธควำมถดถอย ใชกำรท ำนำยคำของตวแปรจำกสมกำรควำมถดถอยทหำได ดวยวธควำมผดพลำดนอยทสด (Least-square error) จำกชดตวอยำงตวแปร สมกำรควำมถดถอยแบงเปนควำมสมพนธระหวำง 2 ตวแปร หรอมำกกวำ ไดแก

- ควำมถดถอยเชงเสน (Linear Regression)

- ควำมถดถอยพหเชงเสน (Multiple Linear Regression)

Regression

Page 20: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

20

ควำมถดถอยเชงเสน (Linear Regression)

Regression method เปนวธกำรอธบำย (explanatory) โดยมตวแปรอนทสมพนธกบตวแปรทเรำตองกำรพยำกรณ และสำมำรถสรำง model เพอแสดงควำมสมพนธนนได สมกำรควำมถดถอยเชงเสน เขยนในรปสมกำร y = w0 + w1x 1

Page 21: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

21

ถำก ำหนด D แทนเซตของขอมลทประกอบดวยคำตวแปร x ทสมพนธกบ คำตวแปร y ซงแทนดวยคล ำดบ (x1,y1),(x2,y2),..,(xD,yD) คำสมประสทธควำมถดถอย หำไดจำกสมกำร

3

2

Page 22: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

22

Straight-line regression using the method of least square. Table below shows a set of paired data where x is a number of years of work experience of a college graduate and y is the number of salary .

Example

X years experience Y salary (in $1000s)

3 30

8 57

9 64

13 72

3 36

6 43

11 59

21 90

1 20

16 83 22

Page 23: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

23

Although the points do not fall on a straight line, the overall pattern suggests a linear relationship between x (years experience) and y (salary)

Page 24: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

24

Page 25: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

25

กำรวเครำะหกำรจดกลม จะชวยตรวจหำ และก ำจดคำทผดปกต เชน คำทสงหรอต ำกวำปกต จะไมสำมำรถจดอยในกลมใดๆ และตกอยนอกกลม

Clustering

Page 26: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

26

Outliers may be detected by clustering, where similar values are organized into groups, or “clusters.” Intuitively, values that fall outside of the set of clusters may be considered outliers (Figure 2.12)

Page 27: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

27

Page 28: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

28

เปนกำรรวบรวมขอมลจำกแหลงทเกบตำงๆมำไวทเดยวกน กำรผสำนขอมลจำกแหลงตำงๆ เพอชวย

1. ลดหรอหลกเลยงควำมซ ำซอนของขอมล (Data Redundancies) ซงจะ

น ำไปสปญหำควำมไมสอดคลองกนของขอมล (Data inconsistencies)

2. เพมควำมเรวและคณภำพในกำรท ำเหมองขอมล

กำรผสำนขอมล (Data Integration)

Page 29: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

29

กำรผสำนโครงสรำงกำรเกบขอมล (Schema Integration) โดยใช metadata ชวยในกำรบงช entities ในแหลงเกบขอมลตำงๆ เชน คณลกษณะ Custid ในแหลงขอมล A เปนคณลกษณะเดยวกบ CustNumber ในแหลงขอมล B หรอไม

ตรวจหำและแกไข คำขอมลทขดแยง เชน คำคณลกษณะเดยวกน แตใชหนวยวดตำงๆกน ในแตละแหลงขอมล

กำรก ำจดคำขอมลซ ำซอน เชน คำคณลกษณะในแหลงขอมลหนง อำจเปนคำทไดจำกกำรค ำนวณในอกแหลงขอมลหนง อำท คำรำยไดรำยป

คำสหสมพนธ เปน 0 หมำยถง ตวแปรทงสองเปนอสระ ไมมควำมสมพนธ ระหวำงกน

งำนทตองท ำในกำรผสำนขอมล

Page 30: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

30

กำรแปลงขอมลทพบบอยในกำรท ำเหมองขอมลคอ กำรท ำนอรมอลไลซ (Normalization) โดยแปลงคำขอมลใหอยในชวงสนๆ ทอลกอรทมกำรท ำเหมองขอมลสำมำรถน ำไปใชประมวลผลได

วธกำรท ำนอรมอลไลซขอมลไดแก Min-Max Normalization Decimal Scaling Z-Score

กำรแปลงขอมล (Data Transformation)

Page 31: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

31

เปนกำรแปลงขอมลเชงเสนจำกชวงทเปนไปไดเดมของคำอนพต ใหเปนชวงขอมลใหมทก ำหนด ปกต ชวง 0-1

สมมต v คอคำคณลกษณะเดม v’ คอคำคณลกษณะใหม minA , maxA คอคำต ำสดและสงสดเดมของคณลกษณะ A new_minA , new_maxA คอคำต ำสดและสงสดใหมของคณลกษณะ A

Min-Max Normalization

จะไดวำ

Page 32: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

32

Example

- Min-max normalization. Suppose that the minimum and maximum values for the attribute income are $12,000 and $98,000 respectively. We would like to map income to the range [0.0, 1.0]. By min-max normalization, a value of $73,600 for income is transformed

to 73,600−12,000

98,000−12,000 (1.0 - 0)+0 = 0.716

Page 33: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

33

เปนกำรปรบกำรกระจำยของขอมลใหมคำเทำกบ 0 และคำเบยงเบนมำตรฐำนเทำกบ 1

หำไดจำกสตร

Z-Score

Page 34: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

34

Example Z-score normalization

Suppose that the mean and standard deviation of the values for

the attribute income are $54,000 and $16,000 respectively.

With z-score normalization,a value of $73,600 for income is

transformed to 73,600−54,00016,000 = 1.225

Page 35: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

35

เปนกำรแปลงคำขอมลเดมใหเปนเลขทศนยม ต ำแหนงทศนยมก ำหนดโดยคำสมบรณทมคำมำกทสด เชน คำทเปนไปไดของคณลกษณะ A อยในชวงระหวำง -999 ถง 997 จะไดวำคำสมบรณทมำกทสดคอ |-999| = 999 ดงนนเรำจะหำรขอมลแตละคำดวย 1000 ผลลพธคอคำ -999 จะถกแปลงเปน -0.999

Decimal scaling

Page 36: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

36

Example Decimal scaling

Page 37: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

37

กำรลดรปขอมล (Data Reduction)

• คลงขอมลเกบขอมลจ ำนวนมำก ขนำดเปน เทรำไบต ดงนนกำรวเครำะห หรอกำรท ำเหมองขอมลทซบซอน ตองใชเวลำนำนในกำรประมวลผลขอมล ปรมำณมำกๆ • กำรลดรป เปนกำรกระท ำเพอแทนขอมล ดวยรปแบบกะทดรด กนเนอท นอยกวำ แตสำมำรถน ำไปใชวเครำะห แลวเกดผลลพธทเทำกนหรอเทยบเทำ กน กบกำรวเครำะหจำกขอมลทงหมด

Page 38: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

38

วธกำรในกำรลดรปขอมล

• Data Aggregation • Dimensionality Reduction • Numerosity Reduction • Discretization and Concept Hierarchy Generation

Page 39: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

39

เปนกำรลดรปขอมลทมกพบใน Data Cube ซงเปนแบบจ ำลองขอมลหลำยมต (Multidimensional data model)

ขอมลรวม (Data Aggregation)

Page 40: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

40

Page 41: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

41

“Can we reduce the data volume by choosing alternative, ‘smaller’ forms of data representation?” Techniques of numerosity reduction can indeed be applied for this purpose. กำรลดรปขอมลโดยใชเทคนคน ม 2 ประเภทคอ 1. Parametic Methods 2. Non-Parametic Methods

Numerosity Reduction

Page 42: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

42

Parametric Methods

มสมมตฐำนวำ สำมำรถสรำงแบบจ ำลองทเหมำะเขำกบขอมลได จะท ำ กำรประมำณคำพำรำมเตอรของแบบจ ำลอง จดเกบเฉพำะคำพำรำมเตอร วธกำรแบบนไดแก กำรสรำงแบบจ ำลองขอมลดวยวธควำมถดถอย ซงใชเทคนคทำงสถต ในกำรประมำณคำตวแปรตำม

Page 43: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

43

Non-Parametric Methods

วธนไมไดสรำงแบบจ ำลองขอมล แตจะใชเครองมอ เชน แผนภำพ ฮสโตแกรม (Histogram) หรอวธกำรจดกลม (Clustering) แสดงกำร กระจำยของขอมล และเกบคำตวแทนกลม แทนคำขอมลจรง หรอ อำจใชวธทำงสถต เชน กำรสมตวอยำง (Sampling)

Page 44: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

44

การท าใหขอมลเปนแบบไมตอเนอง (Discretization)

คำ Attribute ของขอมลสำมำรถแบงไดเปน 3 ประเภท ไดแก 1. Nominal / Categorical 2. Ordinal 3. Continuous

กำรท ำใหขอมลเปนแบบไมตอเนอง เปนกำรลดรปขอมลเลขจ ำนวนจรง โดยแบงคำขอมลดบออกเปนชวง แลวแทนคำแตละชวงดวยคำชวง (Interval Label) เนองจำกอลกอรทมกำรท ำเหมองขอมลบำงอยำง รบเฉพำะขอมลแบบ Categorical

Page 45: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

45

ล าดบชนแนวคด (Concept Hierarchy)

สำมำรถลดรปขอมล Categorical หรอขอมลทไมตอเนอง ดวยกำรสรำง ล ำดบชนแนวคด โดยกำรนยำมล ำดบกำรเทยบ (mapping) กลมแนวคดใน ระดบลำง ไปส แนวคดในระดบทสงขน แนวคด เปนค ำทใชบรรยำยลกษณะกลมของขอมล ขอมลดบ เชน อำย ซงมหลำกหลำยคำ อำจแทนคำแตละชวงดวยแนวคด เชน วยเยำว วยกลำงคน และวยชรำ

Page 46: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

46

ตวอยาง ล าดบชนแนวคดของทอย

Province

City

Community

Street 674,329 distinct value

3,567 distinct value

65 distinct value

15 distinct value

Page 47: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

47

1. ก ำหนดขอมลทน ำมำวเครำะห ประกอบดวยแอททรบวตอำย (age) ในแตละ เรคอรดประกอบดวยคำของแอททรบวต age ดงน 13, 15, 16, 16, 19, 20, 20, 21, 22, 22, 25, 25, 25, 25, 30, 33, 33, 35, 35,

35, 35, 36, 40, 45, 46, 52, 70 (a) ใชเทคนค min-max normalization เพอแปลงคำอำย 35 ป ใหอยในชวง ตวเลข [0:0;1:0] (b) ใชเทคนค z-score normalization เพอแปลงคำอำย 35 ป ก ำหนดสวน เบยงเบนมำตรฐำนของอำยมคำเทำกบ 12.94 ป (c) ใชเทคนค decimal scaling เพอแปลงคำอำย 35 ป เปนตวเลขทศนยม

แบบฝกหด

Page 48: Data Mining - Wipawan's Blog...2 Why Data Preprocessing ? SPSS,NCR CRISP-DM = Cross-Industry Standard Process for Data Mining • Workflow มาตรฐานส าหร บการท

48

2. ตำรำงทก ำหนดดำนลำง แสดงคะแนนสอบกลำงภำค และปลำยภำค ของนกศกษำกลมหนง

a) ใชวธกำรของ least squares เพอสรำง สมกำรส ำหรบท ำนำยคะแนนปลำยภำค เมอ ก ำหนดคะแนนกลำงภำคมำให - ถำนกศกษำคนหนงไดคะแนนกลำงภำค 85 คะแนน เขำจะไดคะแนนปลำยภำคก คะแนน