Lec 06 Feature Selection and Extraction
Lec 06 Feature Selection and Extraction
Feature Selection
and Extraction
Machine Learning
Ivan Smetannikov
15.06.2016
Lecture plan
• Dimensionality Reduction
• Feature Selection
• Feature Extraction
• Speeds up algorithms
• Reduces space used by data for them
Example:
• Redundant data set –
different units for
same attribute
• Reduce data to 1D
(2D -> 1D)
Another Example
• Helicopter flying - do a survey of pilots
(x1 = skill, x2 = pilot enjoyment) These
features may be highly correlated
• This correlation can be combined into a
single attribute called aptitude (for
example)
So what does
dimensionality
reduction mean?
• Let plot a line
• Take exact example
and record
position on that
line
• So we can present
x1 as 1D number
Machine learning. Lecture 6. Feature Selection and Extraction. 15.06.2016. 8
Dimensionality Reduction
Motivation:
Collect a large data set (50 dimensions)
Filter methods:
Evaluate the quality of certain attributes and
remove the worst of them.
+ Simple to compute, easy to scale
- Ignore the relationships between attributes
or features used by classifier
Weka:
ASEvaluation evaluator = new CorrelationAttributeEval();
Ranker ranker = new Ranker();
// ranker.setThreshold(0.05); or ranker.setNumToSelect(10);
selection.setInputFormat(heavyInstances);
selection.setEvaluator(evaluator);
selection.setSearch(ranker);
Instances lightInstances = Filter.useFilter(heavyInstances, selection);
Wrapper methods:
Get a subset of attributes of the source
+ Higher accuracy than Filtering
+ Consider the relationships between
attributes
+ Direct interaction with the classifier
- Long computing time
- The probability of re-education
Machine learning. Lecture 6. Feature Selection and Extraction. 15.06.2016. 21
Feature Selection
SVM-RFE
• Train SVM on training subset
• Rank features by received weights
• Throw out last features
• Repeat until the necessary amount of
features will left
Embedded
Random Forest:
Random Forest:
• Select a subsample of size N for each tree
with replacement
• Build decision trees. To select next feature
to split the considered
• Choose the best for a given criteria
rf.buildClassifier(trainData);
Evaluation evaluation = new Evaluation(trainData);
evaluation.crossValidateModel(rf, trainData, numFolds, new Random(1));
IG and IG
Redundancy
Regularization
Feature Extraction
• Reducing the amount of resources
required to describe a large set of data
• New features
• Linear and nonlinear
Feature Extraction
• Reducing the amount of resources
required to describe a large set of data
• New features
• Linear and nonlinear
PCA
We have 2D dataset which we wish to
reduce to 1D
PCA (Weka)
pca.setInputFormat(trainingData);
pca.setMaximumAttributes(100);
newData = Filter.useFilter(newData, pca);