Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Good data preparation is key to
producing valid and reliable modelsโ€ฆ
Deriving Knowledge from Data at Scale
Lecture 7 Agenda
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Heads Up, Lecture 8 Agenda
Deriving Knowledge from Data at Scale
Course Project
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
https://www.kaggle.com/c/springleaf-marketing-response
not
Determine whether to send a direct mail piece to a customer
Deriving Knowledge from Data at Scale
The Data
Deriving Knowledge from Data at Scale
The Rules
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
what is the data telling you
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
The Tragedy of the Titanic
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Does the new data point x* exactly match a previous point xi?
If so, assign it to the same class as xi
Otherwise, just guess.
This is the โ€œroteโ€ classifier
Deriving Knowledge from Data at Scale
Does the new data point x* match a set pf previous points xi on some specific attribute?
If so, take a vote to determine class.
Example: If most females survived, then assume every female survives
But there are lots of possible rules like this.
And an attribute can have more than two values.
If most people under 4 years old survive, then assume everyone under 4 survives
If most people with 1 sibling survive, then assume everyone with 1 sibling survives
How do we choose?
Deriving Knowledge from Data at Scale
IF sex=โ€˜femaleโ€™ THEN survive=yes
ELSE IF sex=โ€˜maleโ€™ THEN survive = no
confusion matrix
no yes <-- classified as
468 109 | no
81 233 | yes
(468 + 233) / (468+109+81+233) = 79% correct (and 21% incorrect)
Not bad!
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
IF pclass=โ€˜1โ€™ THEN survive=yes
ELSE IF pclass=โ€˜2โ€™ THEN survive=yes
ELSE IF pclass=โ€˜3โ€™ THEN survive=no
confusion matrix
no yes <-- classified as
372 119 | no
177 223 | yes
(372 + 223) / (372+119+223+177) = 67% correct (and 33% incorrect)
a little worse
Deriving Knowledge from Data at Scale
Support Vector Machines
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
fx yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
How would you
classify this data?
Estimation:
w: weight vector
x: data vector
Deriving Knowledge from Data at Scale
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
How would you
classify this data?
Deriving Knowledge from Data at Scale
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
How would you
classify this data?
Deriving Knowledge from Data at Scale
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
How would you
classify this data?
Deriving Knowledge from Data at Scale
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
Any of these
would be fine..
..but which is best?
Deriving Knowledge from Data at Scale
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
Define the margin of a linear classifier
as the width that the boundary could
be increased by before hitting a
datapoint.
Deriving Knowledge from Data at Scale
O
X
O
O
O
X
X
X
SUPPORT VECTORS
Deriving Knowledge from Data at Scale
O
X
X
O
O
O
X
X
X
SUPPORT VECTORS
Deriving Knowledge from Data at Scale
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
The maximum margin
linear classifier is the
linear classifier with the,
um, maximum margin.
This is the simplest kind
of SVM (Called an LSVM)
Linear SVM
Deriving Knowledge from Data at Scale2016/4/12 37
fx
a
yest
denotes +1
denotes -1
f(x,w,b) = sign(w. x + b)
The maximum margin
linear classifier is the
linear classifier with the,
um, maximum margin.
This is the simplest kind
of SVM (Called an LSVM)Support Vectors
are those
datapoints that
the margin
pushes up
against
Linear SVM
Deriving Knowledge from Data at Scale
denotes +1
denotes -1
f(x,w,b) = sign(w. x - b)
Support Vectors
are those
datapoints that
the margin
pushes up
against
1. Intuitively this feels safest.
2. If weโ€™ve made a small error in the location of
the boundary this gives us least chance of
causing a misclassification.
3. LOOCV (leave one out cross validation) is
easy since the model is immune to removal
of any nonsupport-vector data points.
5. Empirically it works very well.
Deriving Knowledge from Data at Scale
Class 1
Class 2
m
Deriving Knowledge from Data at Scale
This is going to be a problem!
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
What if the data looks like that below?...
kernel function
Deriving Knowledge from Data at Scale
What if the data looks like that below?...
Deriving Knowledge from Data at Scale
Everything you need to know in one slideโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Probably the most tricky part of using SVM
RBF is a good first optionโ€ฆ
Depends on your dataโ€”try several.
โ€ข Kernels have even been developed for nonnumeric data like sequences,
structures, and trees/graphs.
May help to use a combination of several kernels.
Donโ€™t touch your evaluation data while youโ€™re trying out different
kernels and parameters.
โ€“ Use cross-validation for this if youโ€™re short on data
Deriving Knowledge from Data at Scale
Complexity of the optimization problem remains only dependent on the dimensionality of
the input space and not of the feature space!
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
โ€ข SVM 1 learns โ€œOutput==1โ€ vs โ€œOutput != 1โ€
โ€ข SVM 2 learns โ€œOutput==2โ€ vs โ€œOutput != 2โ€
โ€ฆ.
โ€ข SVM N learns โ€œOutput==Nโ€ vs โ€œOutput != Nโ€
Deriving Knowledge from Data at Scale2016/4/12 51
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
โ€ข weka.classifiers.functions.SMO
โ€ข weka.classifiers.functions.libSVM
โ€ข weka.classifiers.functions.SMOreg
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
IF pclass=โ€˜1โ€™ THEN survive=yes
ELSE IF pclass=โ€˜2โ€™ THEN survive=yes
ELSE IF pclass=โ€˜3โ€™ THEN survive=no
confusion matrix
no yes <-- classified as
372 119 | no
177 223 | yes
(372 + 223) / (372+119+223+177) = 67% correct (and 33% incorrect)
a little worse
Deriving Knowledge from Data at Scale
Support Vector Machine Model, Titanic Data, Linear Kernel
Deriving Knowledge from Data at Scale
Support Vector Machine Model, RBF Kernel
Titanic Data
Deriving Knowledge from Data at Scale
Support Vector Machine Model, RBF Kernel
Titanic Data
overfitting?
Deriving Knowledge from Data at Scale
Bill Howe, UW 63
Support Vector Machine Model, RBF Kernel
Titanic Data
A gamma, parameter that controls/balances model complexity against accuracy
Deriving Knowledge from Data at Scale
How They Won It!
Lessons from data mining
the past Kaggle contestsโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
10 Minute Breakโ€ฆ
Deriving Knowledge from Data at Scale
Data
Wrangling
Deriving Knowledge from Data at Scale
gold standard
data sets
Deriving Knowledge from Data at Scale
one dominant attribute even
distribution
Deriving Knowledge from Data at Scale
โ€ข Rule of thumb: 5,000 or more desired
โ€ข Rule of thumb: for each attribute, 10 or more instances
โ€ข Rule of thumb: >100 for each class
Deriving Knowledge from Data at Scale
Data cleaning
Data integration
Data transformation
Data reduction
Data discretization
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
1. Missing values
2. Outliers
3. Coding
4. Constraints
Deriving Knowledge from Data at Scale
ReplaceMissingValues
โ€ข RemoveMisclassified
โ€ข MergeTwoValues
Deriving Knowledge from Data at Scale
Missing values โ€“ UCI machine learning repository, 31 of 68 data sets
reported to have missing values. โ€œMissingโ€ can mean many thingsโ€ฆ
MAR: "Missing at Random":
โ€“ usually best case
โ€“ usually not true
Non-randomly missing
Presumed normal, so not measured
Causally missing
โ€“ attribute value is missing because of other attribute values (or because of
the outcome value!)
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Representation mattersโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Bank Data A
Bank Data B
Q
Q
Deriving Knowledge from Data at Scale
Simple transformations can often have a large impact in performance
Example transformations (not all for performance improvement):
โ€ข Difference of two date attributes, distance between coordinate,โ€ฆ
โ€ข Ratio of two numeric (ratioscale) attributes, average for smoothing,โ€ฆ.
โ€ข Concatenating the values of nominal attributes
โ€ข Encoding (probabilistic) cluster membership
โ€ข Adding noise to data (for robustness tests)
โ€ข Removing data randomly or selectively
โ€ข Obfuscating the data (for anonymity)
Intuition: add features that increase class discrimination (E, IG)โ€ฆ
Data Transformation
Deriving Knowledge from Data at Scale
โ€ข Combine attributes
โ€ข Normalizing data
โ€ข Simplifying data
Deriving Knowledge from Data at Scale
Change of scale
1
1
1
1
1
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Aggregated data tends to have less variability and potentially more
information for better predictionsโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
fills in the missing values for an instance with the expected
values
Deriving Knowledge from Data at Scale
Specify the new orderingโ€ฆ
2-last, 1
1-5, 7-last, 6
Deriving Knowledge from Data at Scale
instance
Resample, a random subsample
with or without replacement;
To replace or notโ€ฆ
Same random seed, will result in
same (repeatable) sample.
Sample size, as percentage of
original data set size.
Deriving Knowledge from Data at Scale
Suggestions for you to tryโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Curse of Dimensionality
exponentially
In many cases the information that is lost by
discarding variables is made up for by a more
accurate mapping/sampling in the lower-
dimensional space !
Deriving Knowledge from Data at Scale
โ€ข Sampling
Deriving Knowledge from Data at Scale
work almost as well as using the entire
data set
the same
property (of interest) as the original set of data
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
โ€ข Principle Component Analysis
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
find k โ‰ค n new features
(principal components) that can best represent data
๏ƒ  Works for numeric data onlyโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Attribute Selection
(feature selection)
Deriving Knowledge from Data at Scale
What is Feature selection ?
DIMENSIONALITY REDUCTION
Deriving Knowledge from Data at Scale
Problem: Where to focus attention?
Deriving Knowledge from Data at Scale
Feature Selection, starts with youโ€ฆ
smallest subset of attributes
Deriving Knowledge from Data at Scale
What is Evaluated?
Attributes
Subsets of
Attributes
Evaluation
Method
Independent
Filters Filters
Learning
Algorithm Wrappers
Deriving Knowledge from Data at Scale
What is Evaluated?
Attributes
Subsets of
Attributes
Evaluation
Method
Independent
Filters Filters
Learning
Algorithm Wrappers
Deriving Knowledge from Data at Scale
list of attributes
evaluated individually
select
subset
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
A correlation coefficient shows the degree of linear dependence of x and y. In other words, the coefficient shows
how close two variables lie along a line. If the coefficient is equal to 1 or -1, all the points lie along a line. If the
correlation coefficient is equal to zero, there is no linear relation between x and y. However, this does not
necessarily mean that there is no relation between the two variables. There could e.g. be a non-linear relation.
Deriving Knowledge from Data at Scale
Tab for selecting attributes in a data setโ€ฆ
Deriving Knowledge from Data at Scale
Interface for classes that evaluate attributesโ€ฆ
Interface for ranking or searching for a subset of attributesโ€ฆ
Deriving Knowledge from Data at Scale
Select CorrelationAttributeEval for Pearson Correlationโ€ฆ
False, doesnโ€™t return R score
True, returns R scores;
Deriving Knowledge from Data at Scale
Ranks attributes by their individual evaluations, used in
conjunction with GainRatio, Entropy, Pearson, etcโ€ฆ
Number of attributes to return,
-1 returns all ranked attributes;
Attributes to ignore (skip) in the
evaluation forma: [1, 3-5, 10];
Cutoff at which attributes can
be discarded, -1 no cutoff;
Deriving Knowledge from Data at Scale
Predicting Self-Reported Health Status
The Data Set, NHANES_data.csv (National Health and Nutrition Examination Survey)
How would you say your health in general is?
Excellent predictor of mortality, health care utilization & disability
How I processed itโ€ฆ
โ€ข 4000 variables;
โ€ข Attributes with > 30% missing values removed (dropped column);
โ€ข 105 variables remaining;
โ€ข Chi-square test, variable and target, remove variables with P value < .20;
โ€ข Impute all missing values using expectation minimization;
โ€ข 85 variables remaining;
Pearson Correlation Exerciseโ€ฆ
Deriving Knowledge from Data at Scale
NHANES_data.csv
Deriving Knowledge from Data at Scale
NHANES_data.csv
โ€ข Convert the last column from numeric to nominal
โ€ข Find the top 15 features using Pearson Correlation
Deriving Knowledge from Data at Scale
โ€ข OneRAttributeEval
โ€ข GainRatioAttributeEval
โ€ข InfoGainAttributeEval
โ€ข ChiSquaredAttributeEval
โ€ข ReliefFAttributeEval
Deriving Knowledge from Data at Scale
โ€ข Right Click on the new line in the Result list;
โ€ข From the pop-up menu, select the item
Save reduced dataโ€ฆ
Deriving Knowledge from Data at Scale
โ€ข Right Click on the new line in the Result list;
โ€ข From the pop-up menu, select the item
Save reduced dataโ€ฆ
โ€ข Save the dataset with 15 selected attributes
to file NHanesPearson.arff
Deriving Knowledge from Data at Scale
โ€ข Right Click on the new line in the Result list;
โ€ข From the pop-up menu, select the item
Save reduced dataโ€ฆ
โ€ข Save the dataset with 15 selected attributes
to file NHanesPearson.arff
โ€ข Switch to the Preprocess mode in Explorer
โ€ข Click on Open fileโ€ฆ and open the file
NHanesPearson.arff
โ€ข Switch to the Classify submode
โ€ข Click on Choose, select classifier and use this
feature set and data to build a predictive
model;
Deriving Knowledge from Data at Scale
โ€ข Anything below 0.3 isnโ€™t highly
correlated with the targetโ€ฆ
Deriving Knowledge from Data at Scale
What is Evaluated?
Attributes
Subsets of
Attributes
Evaluation
Method
Independent
Filters Filters
Learning
Algorithm Wrappers
Deriving Knowledge from Data at Scale
given the already picked features
independent
Deriving Knowledge from Data at Scale
all
makes the least contribution
independent
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Interface for classes that evaluate attributesโ€ฆ
Interface for ranking or searching for a subset of attributesโ€ฆ
Deriving Knowledge from Data at Scale
Deriving Knowledge from Data at Scale
Forward, Backward, Bi-Directional
Attributes to โ€œseedโ€ the search,
listed individually or by range.
Cutoff for backtrackingโ€ฆ
Deriving Knowledge from Data at Scale
True: Adds features that are correlated
with class and NOT intercorrelated with
other features already in selection.
False: Eliminates redundant features.
Precompute the correlation matrix in
advance, useful for fast backtracking, or
compute lazily. When given a large
number of attributes, compute lazilyโ€ฆ
CfsSubsetEval
Deriving Knowledge from Data at Scale
NHANES_data.csv
โ€ข Convert the last column from numeric to nominal
โ€ข Set the search method as Best First, Forward
โ€ข Set the attribute evaluator as CfsSubsetEval
โ€ข Run across all attributes in data setโ€ฆ
Deriving Knowledge from Data at Scale
โ€ข Feature selection can significantly increase the performance of a learning
algorithm (both accuracy and computation time) โ€“ but it is not easy!
โ€ข Relevance <-> Optimality
โ€ข Correlation and Mutual information between single variables and the target are
often used as Ranking-Criteria of variables.
Important points 1/2
Deriving Knowledge from Data at Scale
Important points 2/2
โ€ข One can not automatically discard variables with small scores โ€“ they may still be
useful together with other variables.
โ€ข Filters โ€“ Wrappers - Embedded Methods
โ€ข How to search the space of all feature subsets ?
โ€ข How to asses performance of a learner that uses a particular feature subset ?
Deriving Knowledge from Data at Scale
not all about accuracy
โ€ข Filtering is fast linear intuitive
โ€ข Filtering model oblivious
may not be optimal
โ€ข Wrappers model-aware slow nonintuitive
โ€ข PCA and SVD are lossy
work on the entire data set
start
with fast feature filtering first
NOT to use any feature selection
Deriving Knowledge from Data at Scale
Thatโ€™s all for tonightโ€ฆ

Barga Data Science lecture 7

  • 1.
  • 2.
    Deriving Knowledge fromData at Scale Good data preparation is key to producing valid and reliable modelsโ€ฆ
  • 3.
    Deriving Knowledge fromData at Scale Lecture 7 Agenda
  • 4.
  • 5.
  • 6.
  • 7.
    Deriving Knowledge fromData at Scale Heads Up, Lecture 8 Agenda
  • 8.
    Deriving Knowledge fromData at Scale Course Project
  • 9.
  • 10.
    Deriving Knowledge fromData at Scale https://www.kaggle.com/c/springleaf-marketing-response not Determine whether to send a direct mail piece to a customer
  • 11.
    Deriving Knowledge fromData at Scale The Data
  • 12.
    Deriving Knowledge fromData at Scale The Rules
  • 13.
  • 14.
    Deriving Knowledge fromData at Scale what is the data telling you
  • 15.
  • 16.
    Deriving Knowledge fromData at Scale The Tragedy of the Titanic
  • 17.
  • 18.
  • 19.
  • 20.
    Deriving Knowledge fromData at Scale Does the new data point x* exactly match a previous point xi? If so, assign it to the same class as xi Otherwise, just guess. This is the โ€œroteโ€ classifier
  • 21.
    Deriving Knowledge fromData at Scale Does the new data point x* match a set pf previous points xi on some specific attribute? If so, take a vote to determine class. Example: If most females survived, then assume every female survives But there are lots of possible rules like this. And an attribute can have more than two values. If most people under 4 years old survive, then assume everyone under 4 survives If most people with 1 sibling survive, then assume everyone with 1 sibling survives How do we choose?
  • 22.
    Deriving Knowledge fromData at Scale IF sex=โ€˜femaleโ€™ THEN survive=yes ELSE IF sex=โ€˜maleโ€™ THEN survive = no confusion matrix no yes <-- classified as 468 109 | no 81 233 | yes (468 + 233) / (468+109+81+233) = 79% correct (and 21% incorrect) Not bad!
  • 23.
  • 24.
    Deriving Knowledge fromData at Scale IF pclass=โ€˜1โ€™ THEN survive=yes ELSE IF pclass=โ€˜2โ€™ THEN survive=yes ELSE IF pclass=โ€˜3โ€™ THEN survive=no confusion matrix no yes <-- classified as 372 119 | no 177 223 | yes (372 + 223) / (372+119+223+177) = 67% correct (and 33% incorrect) a little worse
  • 25.
    Deriving Knowledge fromData at Scale Support Vector Machines
  • 26.
  • 27.
  • 28.
    Deriving Knowledge fromData at Scale fx yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) How would you classify this data? Estimation: w: weight vector x: data vector
  • 29.
    Deriving Knowledge fromData at Scale fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) How would you classify this data?
  • 30.
    Deriving Knowledge fromData at Scale fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) How would you classify this data?
  • 31.
    Deriving Knowledge fromData at Scale fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) How would you classify this data?
  • 32.
    Deriving Knowledge fromData at Scale fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) Any of these would be fine.. ..but which is best?
  • 33.
    Deriving Knowledge fromData at Scale fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) Define the margin of a linear classifier as the width that the boundary could be increased by before hitting a datapoint.
  • 34.
    Deriving Knowledge fromData at Scale O X O O O X X X SUPPORT VECTORS
  • 35.
    Deriving Knowledge fromData at Scale O X X O O O X X X SUPPORT VECTORS
  • 36.
    Deriving Knowledge fromData at Scale fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) The maximum margin linear classifier is the linear classifier with the, um, maximum margin. This is the simplest kind of SVM (Called an LSVM) Linear SVM
  • 37.
    Deriving Knowledge fromData at Scale2016/4/12 37 fx a yest denotes +1 denotes -1 f(x,w,b) = sign(w. x + b) The maximum margin linear classifier is the linear classifier with the, um, maximum margin. This is the simplest kind of SVM (Called an LSVM)Support Vectors are those datapoints that the margin pushes up against Linear SVM
  • 38.
    Deriving Knowledge fromData at Scale denotes +1 denotes -1 f(x,w,b) = sign(w. x - b) Support Vectors are those datapoints that the margin pushes up against 1. Intuitively this feels safest. 2. If weโ€™ve made a small error in the location of the boundary this gives us least chance of causing a misclassification. 3. LOOCV (leave one out cross validation) is easy since the model is immune to removal of any nonsupport-vector data points. 5. Empirically it works very well.
  • 39.
    Deriving Knowledge fromData at Scale Class 1 Class 2 m
  • 40.
    Deriving Knowledge fromData at Scale This is going to be a problem!
  • 41.
  • 42.
    Deriving Knowledge fromData at Scale What if the data looks like that below?... kernel function
  • 43.
    Deriving Knowledge fromData at Scale What if the data looks like that below?...
  • 44.
    Deriving Knowledge fromData at Scale Everything you need to know in one slideโ€ฆ
  • 45.
  • 46.
  • 47.
    Deriving Knowledge fromData at Scale Probably the most tricky part of using SVM RBF is a good first optionโ€ฆ Depends on your dataโ€”try several. โ€ข Kernels have even been developed for nonnumeric data like sequences, structures, and trees/graphs. May help to use a combination of several kernels. Donโ€™t touch your evaluation data while youโ€™re trying out different kernels and parameters. โ€“ Use cross-validation for this if youโ€™re short on data
  • 48.
    Deriving Knowledge fromData at Scale Complexity of the optimization problem remains only dependent on the dimensionality of the input space and not of the feature space!
  • 49.
  • 50.
    Deriving Knowledge fromData at Scale โ€ข SVM 1 learns โ€œOutput==1โ€ vs โ€œOutput != 1โ€ โ€ข SVM 2 learns โ€œOutput==2โ€ vs โ€œOutput != 2โ€ โ€ฆ. โ€ข SVM N learns โ€œOutput==Nโ€ vs โ€œOutput != Nโ€
  • 51.
    Deriving Knowledge fromData at Scale2016/4/12 51
  • 52.
  • 53.
  • 54.
  • 55.
    Deriving Knowledge fromData at Scale โ€ข weka.classifiers.functions.SMO โ€ข weka.classifiers.functions.libSVM โ€ข weka.classifiers.functions.SMOreg
  • 56.
  • 57.
  • 58.
  • 59.
    Deriving Knowledge fromData at Scale IF pclass=โ€˜1โ€™ THEN survive=yes ELSE IF pclass=โ€˜2โ€™ THEN survive=yes ELSE IF pclass=โ€˜3โ€™ THEN survive=no confusion matrix no yes <-- classified as 372 119 | no 177 223 | yes (372 + 223) / (372+119+223+177) = 67% correct (and 33% incorrect) a little worse
  • 60.
    Deriving Knowledge fromData at Scale Support Vector Machine Model, Titanic Data, Linear Kernel
  • 61.
    Deriving Knowledge fromData at Scale Support Vector Machine Model, RBF Kernel Titanic Data
  • 62.
    Deriving Knowledge fromData at Scale Support Vector Machine Model, RBF Kernel Titanic Data overfitting?
  • 63.
    Deriving Knowledge fromData at Scale Bill Howe, UW 63 Support Vector Machine Model, RBF Kernel Titanic Data A gamma, parameter that controls/balances model complexity against accuracy
  • 64.
    Deriving Knowledge fromData at Scale How They Won It! Lessons from data mining the past Kaggle contestsโ€ฆ
  • 65.
  • 66.
    Deriving Knowledge fromData at Scale 10 Minute Breakโ€ฆ
  • 67.
    Deriving Knowledge fromData at Scale Data Wrangling
  • 68.
    Deriving Knowledge fromData at Scale gold standard data sets
  • 69.
    Deriving Knowledge fromData at Scale one dominant attribute even distribution
  • 70.
    Deriving Knowledge fromData at Scale โ€ข Rule of thumb: 5,000 or more desired โ€ข Rule of thumb: for each attribute, 10 or more instances โ€ข Rule of thumb: >100 for each class
  • 71.
    Deriving Knowledge fromData at Scale Data cleaning Data integration Data transformation Data reduction Data discretization
  • 72.
  • 73.
    Deriving Knowledge fromData at Scale 1. Missing values 2. Outliers 3. Coding 4. Constraints
  • 74.
    Deriving Knowledge fromData at Scale ReplaceMissingValues โ€ข RemoveMisclassified โ€ข MergeTwoValues
  • 75.
    Deriving Knowledge fromData at Scale Missing values โ€“ UCI machine learning repository, 31 of 68 data sets reported to have missing values. โ€œMissingโ€ can mean many thingsโ€ฆ MAR: "Missing at Random": โ€“ usually best case โ€“ usually not true Non-randomly missing Presumed normal, so not measured Causally missing โ€“ attribute value is missing because of other attribute values (or because of the outcome value!)
  • 76.
  • 77.
    Deriving Knowledge fromData at Scale Representation mattersโ€ฆ
  • 78.
  • 79.
  • 80.
    Deriving Knowledge fromData at Scale Bank Data A Bank Data B Q Q
  • 81.
    Deriving Knowledge fromData at Scale Simple transformations can often have a large impact in performance Example transformations (not all for performance improvement): โ€ข Difference of two date attributes, distance between coordinate,โ€ฆ โ€ข Ratio of two numeric (ratioscale) attributes, average for smoothing,โ€ฆ. โ€ข Concatenating the values of nominal attributes โ€ข Encoding (probabilistic) cluster membership โ€ข Adding noise to data (for robustness tests) โ€ข Removing data randomly or selectively โ€ข Obfuscating the data (for anonymity) Intuition: add features that increase class discrimination (E, IG)โ€ฆ Data Transformation
  • 82.
    Deriving Knowledge fromData at Scale โ€ข Combine attributes โ€ข Normalizing data โ€ข Simplifying data
  • 83.
    Deriving Knowledge fromData at Scale Change of scale 1 1 1 1 1
  • 84.
  • 85.
  • 86.
    Deriving Knowledge fromData at Scale Aggregated data tends to have less variability and potentially more information for better predictionsโ€ฆ
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
    Deriving Knowledge fromData at Scale fills in the missing values for an instance with the expected values
  • 94.
    Deriving Knowledge fromData at Scale Specify the new orderingโ€ฆ 2-last, 1 1-5, 7-last, 6
  • 95.
    Deriving Knowledge fromData at Scale instance Resample, a random subsample with or without replacement; To replace or notโ€ฆ Same random seed, will result in same (repeatable) sample. Sample size, as percentage of original data set size.
  • 96.
    Deriving Knowledge fromData at Scale Suggestions for you to tryโ€ฆ
  • 97.
  • 98.
    Deriving Knowledge fromData at Scale Curse of Dimensionality exponentially In many cases the information that is lost by discarding variables is made up for by a more accurate mapping/sampling in the lower- dimensional space !
  • 99.
    Deriving Knowledge fromData at Scale โ€ข Sampling
  • 100.
    Deriving Knowledge fromData at Scale work almost as well as using the entire data set the same property (of interest) as the original set of data
  • 101.
  • 102.
  • 103.
    Deriving Knowledge fromData at Scale โ€ข Principle Component Analysis
  • 104.
  • 105.
    Deriving Knowledge fromData at Scale find k โ‰ค n new features (principal components) that can best represent data ๏ƒ  Works for numeric data onlyโ€ฆ
  • 106.
  • 107.
    Deriving Knowledge fromData at Scale Attribute Selection (feature selection)
  • 108.
    Deriving Knowledge fromData at Scale What is Feature selection ? DIMENSIONALITY REDUCTION
  • 109.
    Deriving Knowledge fromData at Scale Problem: Where to focus attention?
  • 110.
    Deriving Knowledge fromData at Scale Feature Selection, starts with youโ€ฆ smallest subset of attributes
  • 111.
    Deriving Knowledge fromData at Scale What is Evaluated? Attributes Subsets of Attributes Evaluation Method Independent Filters Filters Learning Algorithm Wrappers
  • 112.
    Deriving Knowledge fromData at Scale What is Evaluated? Attributes Subsets of Attributes Evaluation Method Independent Filters Filters Learning Algorithm Wrappers
  • 113.
    Deriving Knowledge fromData at Scale list of attributes evaluated individually select subset
  • 114.
  • 115.
    Deriving Knowledge fromData at Scale A correlation coefficient shows the degree of linear dependence of x and y. In other words, the coefficient shows how close two variables lie along a line. If the coefficient is equal to 1 or -1, all the points lie along a line. If the correlation coefficient is equal to zero, there is no linear relation between x and y. However, this does not necessarily mean that there is no relation between the two variables. There could e.g. be a non-linear relation.
  • 116.
    Deriving Knowledge fromData at Scale Tab for selecting attributes in a data setโ€ฆ
  • 117.
    Deriving Knowledge fromData at Scale Interface for classes that evaluate attributesโ€ฆ Interface for ranking or searching for a subset of attributesโ€ฆ
  • 118.
    Deriving Knowledge fromData at Scale Select CorrelationAttributeEval for Pearson Correlationโ€ฆ False, doesnโ€™t return R score True, returns R scores;
  • 119.
    Deriving Knowledge fromData at Scale Ranks attributes by their individual evaluations, used in conjunction with GainRatio, Entropy, Pearson, etcโ€ฆ Number of attributes to return, -1 returns all ranked attributes; Attributes to ignore (skip) in the evaluation forma: [1, 3-5, 10]; Cutoff at which attributes can be discarded, -1 no cutoff;
  • 120.
    Deriving Knowledge fromData at Scale Predicting Self-Reported Health Status The Data Set, NHANES_data.csv (National Health and Nutrition Examination Survey) How would you say your health in general is? Excellent predictor of mortality, health care utilization & disability How I processed itโ€ฆ โ€ข 4000 variables; โ€ข Attributes with > 30% missing values removed (dropped column); โ€ข 105 variables remaining; โ€ข Chi-square test, variable and target, remove variables with P value < .20; โ€ข Impute all missing values using expectation minimization; โ€ข 85 variables remaining; Pearson Correlation Exerciseโ€ฆ
  • 121.
    Deriving Knowledge fromData at Scale NHANES_data.csv
  • 122.
    Deriving Knowledge fromData at Scale NHANES_data.csv โ€ข Convert the last column from numeric to nominal โ€ข Find the top 15 features using Pearson Correlation
  • 123.
    Deriving Knowledge fromData at Scale โ€ข OneRAttributeEval โ€ข GainRatioAttributeEval โ€ข InfoGainAttributeEval โ€ข ChiSquaredAttributeEval โ€ข ReliefFAttributeEval
  • 124.
    Deriving Knowledge fromData at Scale โ€ข Right Click on the new line in the Result list; โ€ข From the pop-up menu, select the item Save reduced dataโ€ฆ
  • 125.
    Deriving Knowledge fromData at Scale โ€ข Right Click on the new line in the Result list; โ€ข From the pop-up menu, select the item Save reduced dataโ€ฆ โ€ข Save the dataset with 15 selected attributes to file NHanesPearson.arff
  • 126.
    Deriving Knowledge fromData at Scale โ€ข Right Click on the new line in the Result list; โ€ข From the pop-up menu, select the item Save reduced dataโ€ฆ โ€ข Save the dataset with 15 selected attributes to file NHanesPearson.arff โ€ข Switch to the Preprocess mode in Explorer โ€ข Click on Open fileโ€ฆ and open the file NHanesPearson.arff โ€ข Switch to the Classify submode โ€ข Click on Choose, select classifier and use this feature set and data to build a predictive model;
  • 127.
    Deriving Knowledge fromData at Scale โ€ข Anything below 0.3 isnโ€™t highly correlated with the targetโ€ฆ
  • 128.
    Deriving Knowledge fromData at Scale What is Evaluated? Attributes Subsets of Attributes Evaluation Method Independent Filters Filters Learning Algorithm Wrappers
  • 129.
    Deriving Knowledge fromData at Scale given the already picked features independent
  • 130.
    Deriving Knowledge fromData at Scale all makes the least contribution independent
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
    Deriving Knowledge fromData at Scale Interface for classes that evaluate attributesโ€ฆ Interface for ranking or searching for a subset of attributesโ€ฆ
  • 136.
  • 137.
    Deriving Knowledge fromData at Scale Forward, Backward, Bi-Directional Attributes to โ€œseedโ€ the search, listed individually or by range. Cutoff for backtrackingโ€ฆ
  • 138.
    Deriving Knowledge fromData at Scale True: Adds features that are correlated with class and NOT intercorrelated with other features already in selection. False: Eliminates redundant features. Precompute the correlation matrix in advance, useful for fast backtracking, or compute lazily. When given a large number of attributes, compute lazilyโ€ฆ CfsSubsetEval
  • 139.
    Deriving Knowledge fromData at Scale NHANES_data.csv โ€ข Convert the last column from numeric to nominal โ€ข Set the search method as Best First, Forward โ€ข Set the attribute evaluator as CfsSubsetEval โ€ข Run across all attributes in data setโ€ฆ
  • 140.
    Deriving Knowledge fromData at Scale โ€ข Feature selection can significantly increase the performance of a learning algorithm (both accuracy and computation time) โ€“ but it is not easy! โ€ข Relevance <-> Optimality โ€ข Correlation and Mutual information between single variables and the target are often used as Ranking-Criteria of variables. Important points 1/2
  • 141.
    Deriving Knowledge fromData at Scale Important points 2/2 โ€ข One can not automatically discard variables with small scores โ€“ they may still be useful together with other variables. โ€ข Filters โ€“ Wrappers - Embedded Methods โ€ข How to search the space of all feature subsets ? โ€ข How to asses performance of a learner that uses a particular feature subset ?
  • 142.
    Deriving Knowledge fromData at Scale not all about accuracy โ€ข Filtering is fast linear intuitive โ€ข Filtering model oblivious may not be optimal โ€ข Wrappers model-aware slow nonintuitive โ€ข PCA and SVD are lossy work on the entire data set start with fast feature filtering first NOT to use any feature selection
  • 143.
    Deriving Knowledge fromData at Scale Thatโ€™s all for tonightโ€ฆ