συμπληρωματικό σύνολο διαφανειών

Προεπεξεργασία Δεδομένων
Εξόρυξη Δεδομένων και Αλγόριθμοι Μάθησης
2o Φροντιστήριο
Σκούρα Αγγελική
[email protected]
2
Η Διαδικασία Εξόρυξης Γνώσης
Ορισμός προβλήματος
Συλλογή δεδομένων
Προεπεξεργασία δεδομένων
Εφαρμογή αλγορίθμου εξόρυξης
γνώσης
Ερμηνεία αποτελεσμάτων
3
Βασικά βήματα προεπεξεργασίας
A. Καθαρισμός δεδομένων (Data cleaning)
Συμπλήρωση των χαμένων τιμών,
απαλοιφή θορύβου, απομάκρυνση
των outliers, διόρθωση ασυνεπειών,
απαλοιφή πλεονασμού
B. Ενοποίηση δεδομένων (Data integration)
Ενοποίηση πολλαπλών βάσεων
δεδομένων, κύβων δεδομένων ή
αρχείων, απαλοιφή πλεονασμού
Γ. Μετασχηματισμός δεδομένων (Data
transformation) και Διακριτοποίηση
δεδομένων (Data discretization)
Κανονικοποίηση, Μετατροπή των
numerical τιμών σε nominal
Δ. Μείωση δεδομένων (Data reduction)
Μείωση διαστατικότητας, μείωση
πληθυκότητας, συμπίεση δεδομένων
4
Εντοπισμός ακραίων τιμών (outlier
detection)
• Ορισμός outlier
▫ An outlier is an observation that lies an abnormal distance from other
values in a random sample from a population.
• Τεχνικές για εντοπισμό outlier
▫ Στατιστικές μέθοδοι:
 Grubbs' Test ή Studentized Deviate (GESD) Test (is the recommended test
when testing for a single outlier)
 Tietjen-Moore Test (is a generalization of the Grubbs' test to the case of more
than one outlier. It has the limitation that the number of outliers must be
specified exactly)
 Generalized Extreme Studentized Deviate (GESD) Test (this test requires only
an upper bound on the suspected number of outliers and is the recommended
test when the exact number of outliers is not known)
▫ Γραφικές μέθοδοι:
 scatter plots
 box plots
5
Παράδειγμα ανίχνευσης outliers με Grubbs' Test
• Έστω τα δεδομένα =[10, 15, 30, 22, 16, 74]
• Στόχος είναι να ποσοτικοποιήσουμε πόσο μακριά είναι ο outlier από
τα υπόλοιπα στοιχεία.
• Υπολογισμός Z, που είναι το πηλίκο της διαφοράς μεταξύ του outlier
από τη μεσαία τιμή (mean) προς την τυπική απόκλιση. Αν η τιμή του
Z είναι μεγάλη, τότε θεωρείται ως outlier.
▫ Σημείωση: για τον υπολογισμό της μεσαίας τιμής και της τυπικής
απόκλισης χρησιμοποιείται και το φερόμενο στοιχείο ως outlier.
• Για τη μέθοδο Grubb's υπάρχει πίνακας με κρίσιμες τιμές του Z, Ν=
το πλήθος των τιμών
6
Critical values for Z
• Look up the critical
value of Z in the table
below, where N is the
number of values in the
group. If your value of
Z is higher than the
tabulated value, the P
value is less than 0.05
N
Critical Z
N
Critical Z
3
1.15
27
2.86
4
1.48
28
2.88
5
1.71
29
2.89
6
1.89
30
2.91
7
2.02
31
2.92
8
2.13
32
2.94
9
2.21
33
2.95
10
2.29
34
2.97
11
2.34
35
2.98
12
2.41
36
2.99
13
2.46
37
3.00
14
2.51
38
3.01
15
2.55
39
3.03
16
2.59
40
3.04
17
2.62
50
3.13
18
2.65
60
3.20
19
2.68
70
3.26
20
2.71
80
3.31
21
2.73
90
3.35
22
2.76
100
3.38
23
2.78
110
3.42
24
2.80
120
3.44
25
2.82
130
3.47
26
2.84
140
3.49
7
Υπολογισμός outliers
Descriptive Statistics
• Mean: 27.83
• SD: 23.63
• # of values: 6
• Outlier detected? Yes
• Significance level: 0.05 (twosided)
• Critical value of Z: 1.89
Row
Value
Z
1
10.
0.75
2
15.
0.54
3
30.
0.09
4
22.
0.25
5
16.
0.50
6
Ιστοσελίδα με on line Grubb's test:
http://graphpad.com/quickcalcs/Grubbs1.cfm
74.
1.95
Significant
Outlier?
Significant
outlier. P <
0.05
8
Ανίχνευση outliers με Box plots
• Definition
▫ The box plot is a useful graphical
display for describing the behavior of
the data in the middle as well as at
the ends of the distributions.
▫ The box plot uses the median and the
lower and upper quartiles (defined as
the 25th and 75th percentiles).
▫ If the lower quartile is Q1 and the
upper quartile is Q3, then the
difference (Q3 - Q1) is called the
interquartile range or IQ.
• Construction
▫ A box plot is constructed by drawing a
box between the upper and lower
quartiles with a solid line drawn
across the box to locate the median.
9
Box plots with fences
• The following quantities (called fences) are
needed for identifying extreme values in the tails
of the distribution
▫
▫
▫
▫
lower inner fence: Q1 - 1.5*IQ
upper inner fence: Q3 + 1.5*IQ
lower outer fence: Q1 - 3*IQ
upper outer fence: Q3 + 3*IQ
10
Outlier detection criteria
• A point beyond an inner fence on either side is considered a mild
outlier.
• A point beyond an outer fence is considered an extreme outlier.
11
Example of an outlier box plot
• The data set of N = 90 ordered observations as shown below is
examined for outliers:
30, 171, 184, 201, 212, 250, 265, 270, 272, 289, 305, 306, 322, 322,
336, 346, 351, 370, 390, 404, 409, 411, 436, 437, 439, 441, 444, 448,
451, 453, 470, 480, 482, 487, 494, 495, 499, 503, 514, 521, 522, 527,
548, 550, 559, 560, 570, 572, 574, 578, 585, 592, 592, 607, 616, 618,
621, 629, 637, 638, 640, 656, 668, 707, 709, 719, 737, 739, 752, 758,
766, 792, 792, 794, 802, 818, 830, 832, 843, 858, 860, 869, 918,
925, 953, 991, 1000, 1005, 1068, 1441
12
Example of an outlier box plot
• The computations are as follows:
▫
▫
▫
▫
▫
▫
▫
▫
Median = (n+1)/2 largest data point = the average of the 45th and 46th ordered points = (559
+ 560)/2 = 559.5
Lower quartile = .25(N+1)= .25*91= 22.75th ordered point = 411 + .75(436-411) = 429.75
Upper quartile = .75(N+1)=0.75*91= = 68.25th ordered point = 739 +.25(752-739) = 742.25
Interquartile range = 742.25 - 429.75 = 312.5
Lower inner fence = 429.75 - 1.5 (312.5) = -39.0
Upper inner fence = 742.25 + 1.5 (312.5) = 1211.0
Lower outer fence = 429.75 - 3.0 (312.5) = -507.75
Upper outer fence = 742.25 + 3.0 (312.5) = 1679.75
• From an examination of the fence points and the data, one point (1441) exceeds the
upper inner fence and stands out as a mild outlier; there are no extreme outliers.