You are on page 1of 48

Challenges@Big Data

 Finding and Fixing Data Quality Issues

Tasks:
• Data cleaning
• Data integration and transformation
• Data reduction
• Discretization and concept hierarchy generation
Challenges@Big Data
Finding and Fixing Data Quality Issues
• Data in the real world is dirty
– Incomplete (Missing): lacking attribute values, lacking
certain attributes of interest, or containing only aggregated
data
– Noisy (inaccurate): containing errors or outliers (values that
deviate from the expected)
– Inconsistent: containing discrepancies in codes or names
( containing discrepancies in the department codes used to
categorize items)
• No quality data, no quality results!
– Quality decisions must be based on quality data
– Data set/ warehouse needs consistent integration of quality data
• A multi-dimensional measure of data quality:
– A well-accepted multi-dimensional view:
• accuracy, completeness, consistency, timeliness, believability,
interpretability, accessibility
Challenges@Big Data
Finding and Fixing Data Quality Issues: Main Tasks

Forms (Tasks) of data


preprocessing
Challenges@Big Data
Finding and Fixing Data Quality Issues: Major Tasks

• Data cleaning
– Fill in missing values, smooth noisy data, identify or remove outliers, and
resolve inconsistencies
• Data integration
– Integration of multiple databases, data cubes, files, or notes
• Data transformation
– Normalization and standardization (scaling to a specific range)
– Data discretization (mostly numerical data), concept hierarchy generation
(categorical numerical data), entropy based discretization. These all are also
forms of data transformation
• Data reduction
– Obtains reduced representation in volume but produces the same or similar
analytical results
– Dimensionality reduction, Numerosity reduction
Finding and Fixing Data Quality Issues: Major Tasks

Agenda

• Data cleaning
• Data integration and transformation
• Data reduction
• Discretization and concept hierarchy generation
• Summary
Finding and Fixing Data Quality Issues: Major Tasks
Finding and Fixing Data Quality Issues: Major Tasks

Data Cleaning
(Data Cleansing)
• Data cleaning tasks
– Fill in missing values
– Identify outliers and smooth out noisy data
– Correct inconsistent data
Finding and Fixing Data Quality Issues: Major Tasks
Missing Data
• Data is not always available
– E.g., many tuples have no recorded value for several attributes, such
as customer income in sales data
• Missing data may be due to
– equipment malfunction
– inconsistent with other recorded data and thus deleted
– data not entered due to misunderstanding
– certain data may not be considered important at the time of entry
• Missing data may need to be inferred
Finding and Fixing Data Quality Issues: Major Tasks
How to Handle Missing Data?
• Ignore the tuple: usually done when class label is missing (assuming the
task is classification—not effective in certain cases)

• Fill in the missing value manually: tedious + infeasible?


• Use a global constant to fill in the missing value: e.g.,
“unknown”, a new class?!

• Use the attribute mean to fill in the missing value


• Use the attribute mean for all samples of the same class to fill
in the missing value: smarter
• Use the most probable value to fill in the missing value:
inference-based such as regression, Bayesian formula, decision tree
Noisy Data
• Q: What is noise?
• A: Random error in a measured variable.
• Incorrect attribute values may be due to
– faulty data collection instruments
– data entry problems
– data transmission problems
– technology limitation
– inconsistency in naming convention
• Noisy data is meaningless data.

• It includes any data that cannot be


understood and interpreted correctly by
machines.

• Noisy data unnecessarily increases the


amount of storage space required and can
also adversely affect the results of any data
mining analysis.
Finding and Fixing Data Quality Issues: Major Tasks
Transformation
• The process of putting different variables on the same
scale
• scaled to fall within a small, specified range
Particularly useful for classification (NNs, distance measurements,
knn classification, LR, etc)

• min-max normalization
v  minA
v'  (new _ maxA  new _ minA)  new _ minA
maxA  minA

Rescaling data to have values between 0


and 1. This is usually called feature
scaling.
• standardization (z-score normalization )
v  mean
v' 
A

stand _ dev A

Standardization is the process of transforming a variable to one


with a mean of 0 and a standard deviation of 1
We use the letter Z to denote it. As we already mentioned, its mean is 0
and its standard deviation: 1. The standardized variable is called a z-
score.
Example
Let’s take an approximately normally
distributed set of numbers: 1, 2, 2, 3,
3, 3, 4, 4, and 5. Its mean is 3 and
its standard deviation: 1.22.

Now, let’s subtract the mean from all data points.


As shown below, we get a new data set of: -2, -1, -1, 0, 0, 0, 1, 1, and 2.
• The new mean is 0, exactly as we anticipated.
• So far, we have a new distribution. It is still normal, but with a mean of 0 and
a standard deviation of 1.22. The next step of the standardization is to
divide all data points by the standard deviation. This will drive the standard
deviation of the new data set to 1
Normalize or Standardize?
The terms normalization and standardization are sometimes used interchangeably, but they usually
refer to different things. Normalization usually means to scale a variable to have a values between
0 and 1, while standardization transforms data to have a mean of zero and a standard deviation of
1.

•Normalization is good to use when you know that the distribution of your data does not follow a
Gaussian distribution. This can be useful in algorithms that do not assume any distribution of the
data like K-Nearest Neighbors and Neural Networks.
•Standardization, on the other hand, can be helpful in cases where the data follows a Gaussian
distribution. Also, unlike normalization, standardization does not have a bounding range.

However, at the end of the day, the choice of using normalization or standardization will depend
on your problem and the machine learning algorithm you are using. There is no hard and fast rule
to tell you when to normalize or standardize your data. You can always start by fitting your
model to raw, normalized and standardized data and compare the performance for best
results.
Finding and Fixing Data Quality Issues: Major Tasks

Discretization
Binning (for discretization and smoothing)
Binning or discretization is the process of transforming numerical
variables into numerical/categorical counterparts. An example is to bin
values for Age into categories such as 20-39, 40-59, and 60-79.
Moreover, binning may improve accuracy of the predictive models by
reducing the noise or non-linearity.

There are two types of binning, unsupervised and supervised.


• Unsupervised Binning
Unsupervised binning methods transform numerical variables into
numerical/categorical counterparts but do not use the target (class)
information. Equal Width and Equal Frequency are two unsupervised
binning methods.
1- Equal Width Binning

The algorithm divides the data into k intervals of equal size. The width
of intervals is:

w = (max-min)/k
And the interval boundaries are:
min+w, min+2w, ... , min+(k-1)w

2- Equal Frequency Binning


The algorithm divides the data into k groups which each group contains
approximately same number of values. For the both methods, the best way of
determining k is by looking at the histogram and try different intervals or
groups.
Example:
Simple Discretization Methods: Binning
• Equal-width (distance) partitioning:
– It divides the range into N intervals of equal size: uniform
grid
– if A and B are the lowest and highest values of the attribute,
the width of intervals will be: W = (B-A)/N.
– The most straightforward
– But outliers may dominate presentation
– Skewed data is not handled well.
• Equal-depth (frequency) partitioning:
– It divides the range into N intervals, each containing
approximately same number of samples
Binning Methods for Data Smoothing
* Sorted data for price (in dollars): 4, 8, 9, 15, 21, 21, 24, 25,
26, 28, 29, 34
* Partition into (equi-depth) bins:
- Bin 1: 4, 8, 9, 15
- Bin 2: 21, 21, 24, 25
- Bin 3: 26, 28, 29, 34
* Smoothing by bin means:
- Bin 1: 9, 9, 9, 9
- Bin 2: 23, 23, 23, 23
- Bin 3: 29, 29, 29, 29
* Smoothing by bin boundaries:
- Bin 1: 4, 4, 4, 15
- Bin 2: 21, 21, 25, 25
- Bin 3: 26, 26, 26, 34
Supervised Binning
Supervised binning methods transform
numerical variables into categorical
counterparts and refer to the target (class)
information when selecting discretization
cut points. Entropy-based binning is an
example of a supervised binning method.

Entropy-based Binning (categorical


variable
Gini Index based binning (continuous
variable
• Entropy of classes (Binary)
• E = -Fc1log2(Fc1) - Fc2log2(Fc2)

• E = -FYeslog2(FYes) – FNolog2(FNo)

• Where, Fc1 and Fc2 are the fraction of different classes (for example YES and
NO) in the class attribute
Gini Index
• Gini index is the cost function used to
evaluate splits in the dataset. Each split
have two important aspects: the first is the
attributes and second is the attribute
value.
Agenda
• Why preprocess the data?
• Data cleaning
• Data integration and transformation
• Data reduction
• Discretization and concept hierarchy generation
• Summary
Data Reduction
• Problem:
Big Data Repository may store terabytes of data:
Complex data analysis/mining may take a very
long time to run on the complete data set

• Solution?
– Data reduction…
Data Reduction
• Obtains a reduced representation of the data
set that is much smaller in volume but yet
produces the same (or almost the same)
analytical results
• Data reduction strategies
1. Dimensionality reduction
2. Numerosity reduction
3. Data compression
4. Discretization and concept hierarchy generation
5. Sampling
1-Dimensionality Reduction
– Attribute subset selection is a method of dimensionality reduction in
which irrelevant, weakly relevant, or redundant attributes or
dimensions are detected and removed.

• Methods: Heuristic methods (due to exponential # of


choices) usually greedy:
– step-wise forward selection
– step-wise backward elimination
– combining forward selection and backward elimination
– decision-tree induction
* all above require first create a model and test it with combination of
feature, try to know less contributing features.
Nice side-effect: reduces # of attributes in the discovered patterns (which
are now easier to understand)
Dimensionality Reduction
• wavelet transforms, correlation analysis and principal components
analysis which transform or project the original data onto a smaller
space.
* all above are not require to create a model.
2. Numerosity Reduction

Techniques replace the original data volume by alternative, smaller


forms of data representation. These techniques may be parametric or
nonparametric.

•For parametric methods, a model is used to estimate the data, so that


typically only the parameters need to be stored, instead of the actual
data. Regression and log-linear models are examples.

•Nonparametric methods for storing reduced representations of the


data include histograms, clustering, sampling, and data cube
aggregation.
3. Data compression

Transformations are applied so as to obtain a reduced or “compressed”


representation of the original data. If the original data can be
reconstructed from the compressed data without any information loss,
the data reduction is called lossless. If, instead, we can reconstruct
only an approximation of the original data, then the data reduction is
called lossy.
Sampling

• Choose a representative subset of the data


– Simple random sampling may have very poor performance
in the presence of skew

• Develop adaptive sampling methods


– Stratified sampling:
• Approximate the percentage of each class (or
subpopulation of interest) in the overall database
• Used in conjunction with skewed data
Sampling

W O R
SRS le random
i m p ho ut
( s e wi t
l
samp ment)
p l a ce
re

SRSW
R

Raw Data
Agenda

• Why preprocess the data?


• Data cleaning
• Data integration and transformation
• Data reduction
• Discretization and concept hierarchy generation
• Summary
Discretization/Quantization
• Types of attributes:
– Nominal — values from an unordered set
– Ordinal — values from an ordered set
– Interval: ordered set + equal difference
– Continuous — real numbers
• Discretization/Quantization:
 divide the range of a continuous attribute into intervals

– Some classification algorithms only accept categorical


attributes.
– Reduce data size by discretization
– Prepare for further analysis
• Categorical/Nominal
A categorical variable (sometimes called a nominal variable) is one that
has two or more categories, but there is no intrinsic ordering to the
categories. For example, gender is a categorical variable having two
categories (male and female) and there is no intrinsic ordering to the
categories. Hair color is also a categorical variable having a number of
categories (black, brown, red, etc.) and again, there is no agreed way to
order these from highest to lowest.

• Ordinal
An ordinal variable is similar to a categorical variable. The difference
between the two is that there is a clear ordering of the variables. For
example, suppose you have a variable, economic status, with three
categories (low, medium and high). In addition to being able to classify
people into these three categories, you can order the categories as low,
medium and high.
Interval
•Interval scales are numeric scales in which we know not only the
order, but also the exact differences between the values. The
classic example of an interval scale is Celsius temperature because
the difference between each value is the same. For example, the
difference between 60 and 50 degrees is a measurable 10 degrees,
as is the difference between 80 and 70 degrees. Time is another
good example of an interval scale in which the increments are
known, consistent, and measurable.

•Ex. Weight, Time


Discretization and Concept Hierarchy
• Discretization
– reduce the number of values for a given continuous
attribute by dividing the range of the attribute into
intervals. Interval labels can then be used to replace actual
data values.
• Concept Hierarchies
– reduce the data by collecting and replacing low level
concepts (such as numeric values for the attribute age) by
higher level concepts.
Discretization and concept hierarchy
generation for numeric data
• Recursive decomposition using:

– Binning (data smoothing)

– Histogram analysis (numerosity reduction)

– Clustering analysis (numerosity reduction)

• Hierarchical decomposition using:


– Entropy-based discretization (Information Gain, Gini

– Index)
Concept hierarchy generation w/o data
semantics - Specification of a set of attributes
Concept hierarchy can be automatically generated
based on the number of distinct values per attribute
in the given attribute set. The attribute with the most
distinct values is placed at the lowest level of the
hierarchy.

country 15 distinct values

province_or_ state 65 distinct


values
city 3567 distinct values

street 674,339 distinct values


Agenda
• Why preprocess the data?
• Data cleaning
• Data integration and transformation
• Data reduction
• Discretization and concept hierarchy generation
• Summary
Summary
• Data preparation is a big issue for Big Data
Analytics
• Data preparation includes
– Data cleaning and data integration
– Data reduction and feature selection
– Discretization

• A lot a methods have been developed but still an


active area of research

You might also like