Docsity

Data Preprocessing: Why, How, and What for?, Slides of Data Warehousing

Partial preview of the text

Download Data Preprocessing: Why, How, and What for? and more Slides Data Warehousing in PDF only on Docsity!

2

Why Do We Preprocess Data?•

Raw data often incomplete, noisy

May contain:– Obsolete fields– Missing values– Outliers– Data in form not suitable for data mining– Erroneous values

3

Why Do We Preprocess Data?(cont’d)•

For data mining purposes, database values mustundergo data cleaning and data transformation

Data often from legacy databases where values:– Not looked at in years– Expired– No longer relevant– Missing

Minimize GIGO

(Garbage In Garbage Out)

  • IF garbage input minimized

THEN garbage in results

minimized

Data preparation is 60% of effort for data miningprocess

(Pyle)

5

Data CleaningData errors in Table 2.1 examined:•

Five-numeral U.S. Zip Code?– Not all countries use same zip code format, 90210 (U.S.) vs.

J2S7K7 (Canada)

  • Should expect unusual values in some fields– For example, global commerce

Four Digit Zip Code?– Leading zero truncated, 6269 vs. 06269 (New England states)– Database field numeric and chopped-off leading zero

6

Data Cleaning

(cont’d)

Income Field Contains $10,000,000?– Assumed to measure gross annual income– Possibly valid– Still considered outlier (extreme data value)– Some statistical and data mining methods affected by outliers

Income Field Contains -$40,000?– Income less than $0?– Value beyond bounds for expected income, therefore an error– Caused by data entry error?– Discuss anomaly with database administrator

8

Data Cleaning

(cont’d)

Age Field Contains “C”?– Other records have numeric values for field– Record categorized into group labeled “C”– Value must be resolved– Data mining software expects numeric values for field

Age Field Contains 0?– Zero-value used to indicate missing/unknown value?– Customer refused to provide their age?

9

Data Cleaning

(cont’d)

Age Field?– Date-type fields may become obsolete– Use date of birth, then derive

Age

Marital Status Field Contains “S”?– What does this symbol mean?– Does “S” imply single or separated?– Discuss anomaly with database administrator

July 19, 2012

11

How to Handle Missing Data?

-^

Ignore the tuple: usually done when class label is missing (assumingthe tasks in classification—not effective when the percentage ofmissing values per attribute varies considerably.

-^

Fill in the missing value manually: tedious + infeasible?

-^

Fill in it automatically with– a global constant : e.g., “unknown”, a new class?!– the attribute mean– the attribute mean for all samples belonging to the same class:

smarter

  • the most probable value: inference-based such as Bayesian

formula or decision tree

docsity.com

Sample Data

12

14

Handling Missing Data

(cont’d)

(1) Replace Missing Values with User-defined Constant– Missing numeric values replaced with 0.0– Missing categorical values replaced with “Missing”

15

Handling Missing Data

(cont’d)

(2) Replace Missing Values with Mode or Mean– Mode of categorical field

cylinders = 4

  • Missing values replaced with this value– Mean for non-missing values in numeric field

cubicinches =

  • Missing values replaced with 200.

17

Handling Missing Data

(cont’d)

(3) Replace Missing Values with Random Values– Values randomly taken from underlying distribution– Value for

cylinders,

cubicinches, and

hp randomly drawn

proportionately from each field’s distribution

  • Method superior compared to mean substitution– Measures of location and spread remain closer to original

18

Handling Missing Data

(cont’d)

  • No guarantee resulting records make sense– Suppose randomly-generated values

cylinders = 8 and

cubicinches = 82

  • A strange engine size?– Alternate methods strive to replace values more precisely– What is likely value, given record’s other attribute values?– For example, American car has 300 cubic inches and 150

horsepower

  • Japanese car has 100 cubic inches and 90 horsepower– American car expected to have more cylinders