Docsity

Data Preparation for Knowledge Discovery - Minning Data - Lecture Slides, Slides of Computer Fundamentals

Partial preview of the text

Download Data Preparation for Knowledge Discovery - Minning Data - Lecture Slides and more Slides Computer Fundamentals in PDF only on Docsity!

Data Preparation

for Knowledge

Discovery

Outline: Data Preparation

  • Data Understanding
  • Data Cleaning
    • Metadata
    • Missing Values
    • Unified Date Format
    • Nominal to Numeric
    • Discretization
  • Field Selection and “False Predictors”
  • Unbalanced Target Distribution

Knowledge Discovery Process,

in practice

4

Data Preparation estimated to take 70-80% of the time and effort

Monitoring

Data Preparation

Data Understanding:

Relevance

  • What data is available for the task?
  • Is this data relevant?
  • Is additional relevant data available?
  • How much historical data is available?
  • Who is the data expert?

Data Cleaning Steps

  • Data acquisition and metadata
  • Missing values
  • Unified date format
  • Converting nominal to numeric
  • Discretization of numeric data
  • Data validation and statistics

Data Cleaning: Acquisition

  • Data can be in DBMS
    • ODBC, JDBC protocols
  • Data in a flat file
    • Fixed-column format
    • Delimited format: tab, comma “,” , other
    • E.g. C4.5 and Weka “arff” use comma-delimited data
    • Attention: Convert field delimiters inside strings
  • Verify the number of fields before and after

Data Cleaning: Metadata

  • Field types:
    • binary, nominal (categorical), ordinal, numeric, …
    • For nominal fields: tables translating codes to full descriptions
  • Field role:
    • input : inputs for modeling
    • target : output
    • id/auxiliary : keep, but not use for modeling
    • ignore : don’t use for modeling
    • weight : instance weight
    • …
  • Field descriptions

Data Cleaning: Reformatting

Convert data to a standard format (e.g. arff or csv)

  • Missing values
  • Unified date format
  • Binning of numeric data
  • Fix errors and outliers
  • Convert nominal fields whose values have order

to numeric.

  • Q: Why?

Data Cleaning: Missing Values

  • Missing data can appear in several forms:
    • “0” “.” “999” “NA” …
  • Standardize missing value code(s)
  • How can we dealing with missing values?

Data Cleaning: Missing Values, 2

  • Dealing with missing values:
    • ignore records with missing values
    • treat missing value as a separate value
    • Imputation: fill in with mean or median values

Data Cleaning:

Unified Date Format, 2

  • Problems with YYYYMMDD dates:
    • YYYYMMDD does not preserve intervals:
    • 20040201 - 20040131 /= 20040131 – 20040130
    • This can introduce bias into models

Unified Date Format Options

  • To preserve intervals, we can use
    • Unix system date: Number of seconds since 1970
    • Number of days since Jan 1, 1960 (SAS)
  • Problem:
    • values are non-obvious
    • don’t help intuition and knowledge discovery
    • harder to verify, easier to make an error

Y2K issues: 2 digit Year

  • 2-digit year in old data – legacy of Y2K
  • E.g. Q: Year 02 – is it 1902 or 2002?
    • A: Depends on context (e.g. child birthday or year of house construction)
    • Typical approach: CUTOFF year, e.g. 30
    • if YY < CUTOFF , then 20YY, else 19YY

Conversion: Nominal to Numeric

  • Some tools can deal with nominal values internally
  • Other methods (neural nets, regression, nearest neighbor) require only numeric inputs
  • To use nominal fields in such methods need to convert them to a numeric value - Q: Why not ignore nominal fields altogether? - A: They may contain valuable information
  • Different strategies for binary, ordered, multi- valued nominal fields