SlideShare a Scribd company logo
Biomedical Informatics 260
Machine Learning for Images: Introduction
Lecture 11
Spring 2014
Review: Feature Extraction
Today: Machine learning to classify, predict
1. We have a rich set of semantic and
computational features
2. We want to harness these features to
build tools for medical decision support
Machine Learning
• What is machine learning?
• How do I prepare my data?
• Types of Learning Algorithms
• How do I evaluate performance?
http://www.vbmis.com/learn/some-link-here
More details on methods
(formulas, written out explanations, etc.)
What is machine learning?
Real world
phenomenon
Model
Data 1.2 ‘green’ 234.5 10
1.4 ‘red’ 160.8 11
.05 ‘red 150.3 10
What is
machine
learning?
Where do I start?
• Identify a question
– Can I predict candy type from image features?
• Ideal data?
– High resolution images for all candy in the world
• Available data
– 100 pictures of peanut and regular M&M’s
• Explore and visualize
• Create model
• Evaluate results
What is
machine
learning?
Look at your data
Start with simple methods first
Always evaluate
Good ideas:
What is
machine
learning?
How do I prepare my data?
Data
Learning
Algorithm
Classifier
Features
Evaluation
GOAL:
How do I
prepare my
data?
Prepare data for feature extraction
How do I prepare my data?
Filtering
Quality Analysis
Registration
Segmentation
How do I
prepare my
data?
Filtering
Do we need to smooth edges?
Smooth pixels for noise reduction?
Filter out a threshold of interest?
How do I
prepare my
data?
http://www.vbmis.com/learn/category/medical-imaging/image-
processing/filtering/
Quality Analysis
Are any images still not good enough?
Is the data biased in any way?
Do we have representation of all classes?
How do I
prepare my
data?
Registration
Functional data aligned with structural?
Alignment to a standard space?
Alignment to a group template?
How do I
prepare my
data?
http://www.vbmis.com/learn/category/medical-imaging/image-
processing/registration-image-processing/
Segmentation
What is background vs.
region of interest?
How do I
prepare my
data?
http://www.vbmis.com/learn/category/medical-imaging/image-
processing/segmentation/
How do I prepare my data?
Features
Data
Learning
Algorithm
Classifier
Features
Evaluation
Feature Space Representations
Most algorithms work with general vectors
2.9 0.2
0.1 1.9
7.2 2.1
Image 1
Image 2
Image 3
X1 X2 Y
“green peanut”
“red regular”
“red peanut”
How do I
prepare my
data?
Feature Normalization
Here is our vector
v = <x,y>
Calculate the norm
|v| = +
For example,
N=<4,-3>
|v| = 4 +3 = 5
Then divide vector by the norm to
make the unit vector
v / |v|
How do I
prepare my
data?
How do I build a classifier?
Choosing a learning algorithm
Data
Learning
Algorithm
Classifier
Features
Evaluation
Three Types of Learning Algorithms
1. Supervised Classification
2. Unsupervised Clustering
3. Regression
How do I
build a
classifier?
1. Supervised Classification
• K-nearest neighbor (KNN)
• Naïve Bayes
• Support vector machines (SVM)
How do I
build a
classifier?
1. Supervised Classification
K-Nearest Neighbor
1. For each unlabeled point, compute the distance to all other points (order N)
2. sort the distances so we have a sorted list of the neighbors, including labels
3. determine the closest K neighbors (take top K off the list)
4. combine the neighbors labels to make a decision **
1. MUST have a way to resolve K neighbors that don't agree!
How do I
build a
classifier?
http://www.vbmis.com/learn/k-nearest-neighbor-clustering-knn/
1. Supervised Classification
KNN with K=1
How do I
build a
classifier?
1. Supervised Classification
KNN with K=15
How do I
build a
classifier?
1. Supervised Classification
KNN with K=100
How do I
build a
classifier?
1. Supervised Classification
KNN with K=400
How do I
build a
classifier?
1. Supervised Classification
K-Nearest Neighbor
How do I
build a
classifier?
1. Supervised Classification
Naïve Bayes
Estimate the probability of belonging to each class, and assign to highest
probable class
1. Assume conditions are independent: observing a feature says nothing about others
2. We typically sum the log of probabilities instead of multiplying probabilities
( | ) =
∗ ( )
( )
How do I
build a
classifier?
http://www.vbmis.com/learn/naive-bayes/
1. Supervised Classification
Naïve Bayes
( == 	| ) =
== ∗ ( )
( )
( == 	| ) =
== ∗ ( )
( )
How do I
build a
classifier?
( == 	| ) =
== ∗ ( )
( )
1. Supervised Classification
Naïve Bayes
!"# $| ==
If the hypothesis were true, what would the features look like?
How do I
build a
classifier?
1. Supervised Classification
Naïve Bayes
( == 	| ) =
== ∗ ( )
( )
== ∗ + == ∗ ( )
!"# $
The overall probability of observing the features in the data, regardless of candy type
How do I
build a
classifier?
( == 	| ) =
== ∗ ( )
( )
1. Supervised Classification
Naïve Bayes
The probability of the hypothesis before looking at the data
How do I
build a
classifier?
1. Supervised Classification
Naïve Bayes
( == 	| ) =
== ∗ ( )
( )
( == 	| ) =
== ∗ ( )
( )
How do I
build a
classifier?
1. Supervised Classification
Naïve Bayes
( == 	| ) =
== ∗ ( )
( )
( == 	| ) =
== ∗ ( )
( )
How do I
build a
classifier?
1. Supervised Classification
Support Vector Machines
1. a way to transform dots into higher dimensional space (kernel mapping)
2. looking for a best boundary line that best distinguishes classes
3. the points that form the boundary line are called the support vectors
How do I
build a
classifier?
http://www.vbmis.com/learn/support-vector-machines-svms/
2. Regression
1. Supervised learning method
2. Assume that relationship between data points X, and Y, is linear
3. We can solve with the least squares approach (min sum of squared error)
Linear Regression
& = '( + ')
)
+ ')
)
+ . . . 	+	'*
*
How do I
build a
classifier?
http://www.vbmis.com/learn/linear-regression/
3. Unsupervised Clustering
• K-means clustering
• Hierarchical clustering
How do I
build a
classifier?
Unsupervised Clustering
K-Means
1. Generate K random points (cluster centers) in the space of the objects to be clustered.
2. Compute the distance of each data point (objects) to all the cluster centers
3. Assign each object to the closest cluster center (CC)
4. Compute a new position for the cluster center as the sum average of the assigned
objects (lots of ways to do average)
Loop to step 2, until bored or the cluster centers don't change significantly
(less than or equal to some epsilon that we set)
How do I
build a
classifier?
http://www.vbmis.com/learn/k-means-clustering/
Unsupervised Clustering
Hierarchical
1. Computer a matrix of all distances between objects (not order N, calculate N squared
distances)
2. Find the two closest nodes
3. Merge them by "averaging" (multiple strategies for averaging, usually is a weighted
average) positions
4. Compute the distance of new merged node to all others
This leaves N-1 nodes
5. Repeat until all nodes merged (there is one node)
6. Draw cluster boundaries as you see fit
How do I
build a
classifier?
http://www.vbmis.com/learn/hierarchical-clustering/
Data
Learning
Algorithm
Classifier
Features
Evaluation
How do I build a classifier?
Ok, now build it!
What data do I use to build?
Training vs. Testing Data
Data
Learning
Algorithm
?
?
? Classifier
Orange
M&M
Yellow M&M
Blue Peanut
M&M
Features
1.2 ‘green’ 234.5 10
1.4 ‘red’ 160.8 11
.05 ‘red 150.3 10
TRAINING
building model
The algorithm “learns” the optimal
parameters for the model
How do I
build a
classifier?
Data
Learning
Algorithm
?
?
? Classifier
Orange
M&M
Yellow M&M
Blue Peanut
M&M
Features
1.2 ‘green’ 234.5 10
1.4 ‘red’ 160.8 11
.05 ‘red 150.3 10
TESTING
evaluating model
We give the classifier new data to
predict class labels
How do I
build a
classifier?
How do I use the data
to obtain reliable estimates?
How do I obtain reliable estimates?
• Holdout: if you have enough data
• Cross Validation: If you don’t
How do I
build a
classifier?
• Ideal: We have new data to test on
• Reality: We don’t
How do I obtain reliable estimates?
• Holdout
– 2/3 for training
– 1/3 for testing
How do I
build a
classifier?
How do I obtain reliable estimates?
• Cross Validation
– Partition into N sets
– Train on N-1
– Test on “held out” set
How do I
build a
classifier?
How do I choose the right model
complexity?
Overfitting and Underfitting
Bishop, et al. Pattern Recognition and Machine Learning
What Model Complexity to Choose?
generated
data model
fitted models of
different orders
data
How do I
build a
classifier?
What Model Complexity to Choose?
Gareth, et al. An Intro to Statistical Learning with Applications in R
How do I
build a
classifier?
How to evaluate performance?
Data
Learning
Algorithm
Classifier
Features
Evaluation
How do I evaluate performance?
of a classification model
• Focus on predictive ability of the model
Confusion Matrix
Predicted Class
Actual Class
Yes No
Yes TP FN
No FP TN
How do I
assess
performance?
How do I evaluate performance?
of a classification model
+,,-./,0 =
12 + 13
12 + 13 + 42 + 43
Predicted Class
Actual Class
Yes No
Yes TP FN
No FP TN
How do I
assess
performance?
How do I evaluate performance?
of a classification model
1.-5	267898:5	;/95 =
12
12 + 43
(Sensitivity)
1.-5	35</98:5	;/95 =
13
13 + 42
(Specificity)
How do I
assess
performance?
How do I evaluate performance?
of a clustering model
• Ideal Clustering: finding "optimal" (best that we can do) grouping of
objects such that the within group distance is low (minimized) and
the between group distance is high (maximized).
How do I
assess
performance?
http://www.vbmis.com/learn/cluster-validation/
• Internal Measures
– stability validation
– connectivity
– compactness
– separation
– the Dunn Index
– silhouette width
How do I evaluate performance?
of a clustering model
How do I
assess
performance?
• External Measures
– Biological Homogeneity Index
– Biological Stability Index
How do I evaluate performance?
of a clustering model
How do I
assess
performance?
Evaluation:
Comparing to Competitor Methods
ROC Curve Analysis
=5>7898:890 = 12; =
12
12 + 43
We care a lot about missing something – FP are expensive
=?5,8@8,890 = 13; =	
13
13 + 42
We don’t care about missing something that might be true
How do I
assess
performance?
What if our classifier sucks?
Find some subset of features (predictor
variables) that are most informative about a
class label
Feature Selection:
How do I
assess
performance?
Feature Selection
Methods for dimensionality reduction
• Criterion
– mean squared error (regression)
– misclassification rate (classification)
How do I
assess
performance?
Feature Selection
Methods for dimensionality reduction
1. Best Subset Selection
2. Sequential Forward Search
3. Sequential Backward Search
4. Shrinkage Methods
5. Dimensionality Reduction
How do I
assess
performance?
Best Subset Selection
• Only feasible when number of features (p) is small
P1 P2 P3
How do I
assess
performance?
Sequential Forward Search
• Sequentially add features to an empty candidate set
until the addition of further features doesn’t
decrease our criterion
P1 P2 P3
How do I
prepare my
data?
Sequential Backward Search
• features are sequentially removed from a full
candidate set until the removal of further features
increase the criterion
P1 P2 P3
How do I
prepare my
data?
Summary
Machine learning is using methods
from statistics and computer science
to predict an outcome
What is
machine
learning?
How do I
prepare my
data?
We should visualize, normalize, and
clean our data before turning it into a
vector to train a learning algorithm
We should choose a method based on
our data, perform intelligent feature
selection, and take advantage of
Matlab’s built in functions
How do I
build a
classifier?
Generally, we should evaluate with a
separate test data set, and look at ROC
curve metrics, and internal and
external validation for clustering
How do I
assess
performance?
What does it mean for me?
• First identify your question
• Come up with “the ideal” data
• Find “actual” data
• Explore it, visualize it!
• Experiment with different classifiers
• Evaluate and write up your results
Courses to Take
• Statistics:
– 116, 200, 202
• Computer Science:
– CS229
Next Time:
Advanced Machine Learning for Imaging
Thank you!
Introduction to Machine Learning Lecture

More Related Content

PPTX
Supervised learning and Unsupervised learning
PPTX
Supervised learning
PPT
2.8 accuracy and ensemble methods
PPTX
Data mining 5 klasifikasi decision tree dan random forest
PDF
Sentiment analysis of tweets using Neural Networks
PPTX
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
PPTX
What is Machine Learning
Supervised learning and Unsupervised learning
Supervised learning
2.8 accuracy and ensemble methods
Data mining 5 klasifikasi decision tree dan random forest
Sentiment analysis of tweets using Neural Networks
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
What is Machine Learning

What's hot (12)

PPTX
Supervised and unsupervised learning
PPTX
Think-Aloud Protocols
PDF
L13. Cluster Analysis
PDF
Machine learning
PDF
Lecture 9: Machine Learning in Practice (2)
PPT
Chapter - 6 Data Mining Concepts and Techniques 2nd Ed slides Han &amp; Kamber
PPT
Machine Learning presentation.
PPTX
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
PDF
Clustering Methods with R
PPTX
Project prSentiment Analysis of Twitter Data Using Machine Learning Approach...
ODP
Introduction to Machine learning
Supervised and unsupervised learning
Think-Aloud Protocols
L13. Cluster Analysis
Machine learning
Lecture 9: Machine Learning in Practice (2)
Chapter - 6 Data Mining Concepts and Techniques 2nd Ed slides Han &amp; Kamber
Machine Learning presentation.
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
Clustering Methods with R
Project prSentiment Analysis of Twitter Data Using Machine Learning Approach...
Introduction to Machine learning
Ad

Viewers also liked (13)

PPTX
ENFERMEDADES
PDF
TC_Electronic_S6000
PDF
ROC - PICTURES
PDF
ashraf
PPTX
Diapositivas kari
PDF
143307 evidencia que_exige_um_veredito
PDF
L'Oreal- Going Global
PDF
Advertisements suggestions
PPT
(4) applications of newton's law
PPTX
71 77 neurons
PPTX
Presentation1
PPT
Stem Cell Presentation
DOCX
Internship Report
ENFERMEDADES
TC_Electronic_S6000
ROC - PICTURES
ashraf
Diapositivas kari
143307 evidencia que_exige_um_veredito
L'Oreal- Going Global
Advertisements suggestions
(4) applications of newton's law
71 77 neurons
Presentation1
Stem Cell Presentation
Internship Report
Ad

Similar to Introduction to Machine Learning Lecture (20)

PPT
Machine Learning Deep Learning Machine learning
PPTX
How Machine Learning Helps Organizations to Work More Efficiently?
PPT
594503964-Introduction-to-Classification-PPT-Slides-1.ppt
PPT
Machine Learning workshop by GDSC Amity University Chhattisgarh
PPT
[ppt]
PPT
[ppt]
PPTX
Lecture 09(introduction to machine learning)
PPT
i i believe is is enviromntbelieve is is enviromnt7.ppt
PDF
Computer Vision: Algorithms and Applications Richard Szeliski
PPT
PPT-3.ppt
PPT
MAchine learning
PPT
Machine Learning Machine Learnin Machine Learningg
PDF
Carolina AI Meetup Nov 2018
PDF
Machine Learning ebook.pdf
PDF
1_5_AI_edx_ml_51intro_240204_104838machine learning lecture 1
PDF
CPSC 340: Machine Learning and Data Mining K-Means Clustering Andreas Lehrman...
PDF
An Introduction to Supervised Machine Learning and Pattern Classification: Th...
PDF
know Machine Learning Basic Concepts.pdf
PPT
Computational Biology, Part 4 Protein Coding Regions
Machine Learning Deep Learning Machine learning
How Machine Learning Helps Organizations to Work More Efficiently?
594503964-Introduction-to-Classification-PPT-Slides-1.ppt
Machine Learning workshop by GDSC Amity University Chhattisgarh
[ppt]
[ppt]
Lecture 09(introduction to machine learning)
i i believe is is enviromntbelieve is is enviromnt7.ppt
Computer Vision: Algorithms and Applications Richard Szeliski
PPT-3.ppt
MAchine learning
Machine Learning Machine Learnin Machine Learningg
Carolina AI Meetup Nov 2018
Machine Learning ebook.pdf
1_5_AI_edx_ml_51intro_240204_104838machine learning lecture 1
CPSC 340: Machine Learning and Data Mining K-Means Clustering Andreas Lehrman...
An Introduction to Supervised Machine Learning and Pattern Classification: Th...
know Machine Learning Basic Concepts.pdf
Computational Biology, Part 4 Protein Coding Regions

More from Vanessa S (20)

PDF
The Stories We Tell Ourselves
PDF
Singularity Registry HPC
PPTX
Introduction to Singularity and Data Containers
PPTX
Research Software Engineering at Stanford University
PPTX
Research Software Engineering at Stanford
PPTX
Adding An Operator to Airflow: A Contributor Overflow Exception
PPTX
The Research Software Encyclopedia
PDF
The Scientific Filesystem
PDF
Singularity Containers for Scientific Compute
PPTX
Laboratory of NeuroGenetics QA (8/2010)
PDF
PEARC17: Reproducibility and Containers: The Perfect Sandwich
PPTX
Building Tools for Neuroimaging
PPTX
Brain Maps like Mine
PPTX
Qualifying Exam Presentation
PDF
Pre-Proposal Presentation
PDF
Independent component analysis
PDF
Subnetworks in Schizophrenia, fMRI
PPTX
Research in Progress April 2014
PDF
Research in Progress Presentation
PDF
Introduction to Neuroimaging Informatics
The Stories We Tell Ourselves
Singularity Registry HPC
Introduction to Singularity and Data Containers
Research Software Engineering at Stanford University
Research Software Engineering at Stanford
Adding An Operator to Airflow: A Contributor Overflow Exception
The Research Software Encyclopedia
The Scientific Filesystem
Singularity Containers for Scientific Compute
Laboratory of NeuroGenetics QA (8/2010)
PEARC17: Reproducibility and Containers: The Perfect Sandwich
Building Tools for Neuroimaging
Brain Maps like Mine
Qualifying Exam Presentation
Pre-Proposal Presentation
Independent component analysis
Subnetworks in Schizophrenia, fMRI
Research in Progress April 2014
Research in Progress Presentation
Introduction to Neuroimaging Informatics

Recently uploaded (20)

PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PDF
AlphaEarth Foundations and the Satellite Embedding dataset
PPTX
2. Earth - The Living Planet earth and life
PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PDF
diccionario toefl examen de ingles para principiante
PPTX
Microbiology with diagram medical studies .pptx
PDF
MIRIDeepImagingSurvey(MIDIS)oftheHubbleUltraDeepField
PPTX
famous lake in india and its disturibution and importance
PPTX
2. Earth - The Living Planet Module 2ELS
PPTX
Introduction to Fisheries Biotechnology_Lesson 1.pptx
PDF
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
PDF
Sciences of Europe No 170 (2025)
PDF
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
Cell Membrane: Structure, Composition & Functions
PPTX
INTRODUCTION TO EVS | Concept of sustainability
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
7. General Toxicologyfor clinical phrmacy.pptx
AlphaEarth Foundations and the Satellite Embedding dataset
2. Earth - The Living Planet earth and life
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
Phytochemical Investigation of Miliusa longipes.pdf
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
diccionario toefl examen de ingles para principiante
Microbiology with diagram medical studies .pptx
MIRIDeepImagingSurvey(MIDIS)oftheHubbleUltraDeepField
famous lake in india and its disturibution and importance
2. Earth - The Living Planet Module 2ELS
Introduction to Fisheries Biotechnology_Lesson 1.pptx
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
Sciences of Europe No 170 (2025)
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
ECG_Course_Presentation د.محمد صقران ppt
Cell Membrane: Structure, Composition & Functions
INTRODUCTION TO EVS | Concept of sustainability

Introduction to Machine Learning Lecture

  • 1. Biomedical Informatics 260 Machine Learning for Images: Introduction Lecture 11 Spring 2014
  • 2. Review: Feature Extraction Today: Machine learning to classify, predict 1. We have a rich set of semantic and computational features 2. We want to harness these features to build tools for medical decision support
  • 3. Machine Learning • What is machine learning? • How do I prepare my data? • Types of Learning Algorithms • How do I evaluate performance?
  • 4. http://www.vbmis.com/learn/some-link-here More details on methods (formulas, written out explanations, etc.)
  • 5. What is machine learning?
  • 6. Real world phenomenon Model Data 1.2 ‘green’ 234.5 10 1.4 ‘red’ 160.8 11 .05 ‘red 150.3 10 What is machine learning?
  • 7. Where do I start? • Identify a question – Can I predict candy type from image features? • Ideal data? – High resolution images for all candy in the world • Available data – 100 pictures of peanut and regular M&M’s • Explore and visualize • Create model • Evaluate results What is machine learning?
  • 8. Look at your data Start with simple methods first Always evaluate Good ideas: What is machine learning?
  • 9. How do I prepare my data? Data Learning Algorithm Classifier Features Evaluation
  • 10. GOAL: How do I prepare my data? Prepare data for feature extraction
  • 11. How do I prepare my data? Filtering Quality Analysis Registration Segmentation How do I prepare my data?
  • 12. Filtering Do we need to smooth edges? Smooth pixels for noise reduction? Filter out a threshold of interest? How do I prepare my data? http://www.vbmis.com/learn/category/medical-imaging/image- processing/filtering/
  • 13. Quality Analysis Are any images still not good enough? Is the data biased in any way? Do we have representation of all classes? How do I prepare my data?
  • 14. Registration Functional data aligned with structural? Alignment to a standard space? Alignment to a group template? How do I prepare my data? http://www.vbmis.com/learn/category/medical-imaging/image- processing/registration-image-processing/
  • 15. Segmentation What is background vs. region of interest? How do I prepare my data? http://www.vbmis.com/learn/category/medical-imaging/image- processing/segmentation/
  • 16. How do I prepare my data? Features Data Learning Algorithm Classifier Features Evaluation
  • 17. Feature Space Representations Most algorithms work with general vectors 2.9 0.2 0.1 1.9 7.2 2.1 Image 1 Image 2 Image 3 X1 X2 Y “green peanut” “red regular” “red peanut” How do I prepare my data?
  • 18. Feature Normalization Here is our vector v = <x,y> Calculate the norm |v| = + For example, N=<4,-3> |v| = 4 +3 = 5 Then divide vector by the norm to make the unit vector v / |v| How do I prepare my data?
  • 19. How do I build a classifier? Choosing a learning algorithm Data Learning Algorithm Classifier Features Evaluation
  • 20. Three Types of Learning Algorithms 1. Supervised Classification 2. Unsupervised Clustering 3. Regression How do I build a classifier?
  • 21. 1. Supervised Classification • K-nearest neighbor (KNN) • Naïve Bayes • Support vector machines (SVM) How do I build a classifier?
  • 22. 1. Supervised Classification K-Nearest Neighbor 1. For each unlabeled point, compute the distance to all other points (order N) 2. sort the distances so we have a sorted list of the neighbors, including labels 3. determine the closest K neighbors (take top K off the list) 4. combine the neighbors labels to make a decision ** 1. MUST have a way to resolve K neighbors that don't agree! How do I build a classifier? http://www.vbmis.com/learn/k-nearest-neighbor-clustering-knn/
  • 23. 1. Supervised Classification KNN with K=1 How do I build a classifier?
  • 24. 1. Supervised Classification KNN with K=15 How do I build a classifier?
  • 25. 1. Supervised Classification KNN with K=100 How do I build a classifier?
  • 26. 1. Supervised Classification KNN with K=400 How do I build a classifier?
  • 27. 1. Supervised Classification K-Nearest Neighbor How do I build a classifier?
  • 28. 1. Supervised Classification Naïve Bayes Estimate the probability of belonging to each class, and assign to highest probable class 1. Assume conditions are independent: observing a feature says nothing about others 2. We typically sum the log of probabilities instead of multiplying probabilities ( | ) = ∗ ( ) ( ) How do I build a classifier? http://www.vbmis.com/learn/naive-bayes/
  • 29. 1. Supervised Classification Naïve Bayes ( == | ) = == ∗ ( ) ( ) ( == | ) = == ∗ ( ) ( ) How do I build a classifier?
  • 30. ( == | ) = == ∗ ( ) ( ) 1. Supervised Classification Naïve Bayes !"# $| == If the hypothesis were true, what would the features look like? How do I build a classifier?
  • 31. 1. Supervised Classification Naïve Bayes ( == | ) = == ∗ ( ) ( ) == ∗ + == ∗ ( ) !"# $ The overall probability of observing the features in the data, regardless of candy type How do I build a classifier?
  • 32. ( == | ) = == ∗ ( ) ( ) 1. Supervised Classification Naïve Bayes The probability of the hypothesis before looking at the data How do I build a classifier?
  • 33. 1. Supervised Classification Naïve Bayes ( == | ) = == ∗ ( ) ( ) ( == | ) = == ∗ ( ) ( ) How do I build a classifier?
  • 34. 1. Supervised Classification Naïve Bayes ( == | ) = == ∗ ( ) ( ) ( == | ) = == ∗ ( ) ( ) How do I build a classifier?
  • 35. 1. Supervised Classification Support Vector Machines 1. a way to transform dots into higher dimensional space (kernel mapping) 2. looking for a best boundary line that best distinguishes classes 3. the points that form the boundary line are called the support vectors How do I build a classifier? http://www.vbmis.com/learn/support-vector-machines-svms/
  • 36. 2. Regression 1. Supervised learning method 2. Assume that relationship between data points X, and Y, is linear 3. We can solve with the least squares approach (min sum of squared error) Linear Regression & = '( + ') ) + ') ) + . . . + '* * How do I build a classifier? http://www.vbmis.com/learn/linear-regression/
  • 37. 3. Unsupervised Clustering • K-means clustering • Hierarchical clustering How do I build a classifier?
  • 38. Unsupervised Clustering K-Means 1. Generate K random points (cluster centers) in the space of the objects to be clustered. 2. Compute the distance of each data point (objects) to all the cluster centers 3. Assign each object to the closest cluster center (CC) 4. Compute a new position for the cluster center as the sum average of the assigned objects (lots of ways to do average) Loop to step 2, until bored or the cluster centers don't change significantly (less than or equal to some epsilon that we set) How do I build a classifier? http://www.vbmis.com/learn/k-means-clustering/
  • 39. Unsupervised Clustering Hierarchical 1. Computer a matrix of all distances between objects (not order N, calculate N squared distances) 2. Find the two closest nodes 3. Merge them by "averaging" (multiple strategies for averaging, usually is a weighted average) positions 4. Compute the distance of new merged node to all others This leaves N-1 nodes 5. Repeat until all nodes merged (there is one node) 6. Draw cluster boundaries as you see fit How do I build a classifier? http://www.vbmis.com/learn/hierarchical-clustering/
  • 41. What data do I use to build? Training vs. Testing Data
  • 42. Data Learning Algorithm ? ? ? Classifier Orange M&M Yellow M&M Blue Peanut M&M Features 1.2 ‘green’ 234.5 10 1.4 ‘red’ 160.8 11 .05 ‘red 150.3 10 TRAINING building model The algorithm “learns” the optimal parameters for the model How do I build a classifier?
  • 43. Data Learning Algorithm ? ? ? Classifier Orange M&M Yellow M&M Blue Peanut M&M Features 1.2 ‘green’ 234.5 10 1.4 ‘red’ 160.8 11 .05 ‘red 150.3 10 TESTING evaluating model We give the classifier new data to predict class labels How do I build a classifier?
  • 44. How do I use the data to obtain reliable estimates?
  • 45. How do I obtain reliable estimates? • Holdout: if you have enough data • Cross Validation: If you don’t How do I build a classifier? • Ideal: We have new data to test on • Reality: We don’t
  • 46. How do I obtain reliable estimates? • Holdout – 2/3 for training – 1/3 for testing How do I build a classifier?
  • 47. How do I obtain reliable estimates? • Cross Validation – Partition into N sets – Train on N-1 – Test on “held out” set How do I build a classifier?
  • 48. How do I choose the right model complexity? Overfitting and Underfitting
  • 49. Bishop, et al. Pattern Recognition and Machine Learning What Model Complexity to Choose? generated data model fitted models of different orders data How do I build a classifier?
  • 50. What Model Complexity to Choose? Gareth, et al. An Intro to Statistical Learning with Applications in R How do I build a classifier?
  • 51. How to evaluate performance? Data Learning Algorithm Classifier Features Evaluation
  • 52. How do I evaluate performance? of a classification model • Focus on predictive ability of the model Confusion Matrix Predicted Class Actual Class Yes No Yes TP FN No FP TN How do I assess performance?
  • 53. How do I evaluate performance? of a classification model +,,-./,0 = 12 + 13 12 + 13 + 42 + 43 Predicted Class Actual Class Yes No Yes TP FN No FP TN How do I assess performance?
  • 54. How do I evaluate performance? of a classification model 1.-5 267898:5 ;/95 = 12 12 + 43 (Sensitivity) 1.-5 35</98:5 ;/95 = 13 13 + 42 (Specificity) How do I assess performance?
  • 55. How do I evaluate performance? of a clustering model • Ideal Clustering: finding "optimal" (best that we can do) grouping of objects such that the within group distance is low (minimized) and the between group distance is high (maximized). How do I assess performance? http://www.vbmis.com/learn/cluster-validation/
  • 56. • Internal Measures – stability validation – connectivity – compactness – separation – the Dunn Index – silhouette width How do I evaluate performance? of a clustering model How do I assess performance?
  • 57. • External Measures – Biological Homogeneity Index – Biological Stability Index How do I evaluate performance? of a clustering model How do I assess performance?
  • 59. ROC Curve Analysis =5>7898:890 = 12; = 12 12 + 43 We care a lot about missing something – FP are expensive =?5,8@8,890 = 13; = 13 13 + 42 We don’t care about missing something that might be true How do I assess performance?
  • 60. What if our classifier sucks?
  • 61. Find some subset of features (predictor variables) that are most informative about a class label Feature Selection: How do I assess performance?
  • 62. Feature Selection Methods for dimensionality reduction • Criterion – mean squared error (regression) – misclassification rate (classification) How do I assess performance?
  • 63. Feature Selection Methods for dimensionality reduction 1. Best Subset Selection 2. Sequential Forward Search 3. Sequential Backward Search 4. Shrinkage Methods 5. Dimensionality Reduction How do I assess performance?
  • 64. Best Subset Selection • Only feasible when number of features (p) is small P1 P2 P3 How do I assess performance?
  • 65. Sequential Forward Search • Sequentially add features to an empty candidate set until the addition of further features doesn’t decrease our criterion P1 P2 P3 How do I prepare my data?
  • 66. Sequential Backward Search • features are sequentially removed from a full candidate set until the removal of further features increase the criterion P1 P2 P3 How do I prepare my data?
  • 68. Machine learning is using methods from statistics and computer science to predict an outcome What is machine learning?
  • 69. How do I prepare my data? We should visualize, normalize, and clean our data before turning it into a vector to train a learning algorithm
  • 70. We should choose a method based on our data, perform intelligent feature selection, and take advantage of Matlab’s built in functions How do I build a classifier?
  • 71. Generally, we should evaluate with a separate test data set, and look at ROC curve metrics, and internal and external validation for clustering How do I assess performance?
  • 72. What does it mean for me? • First identify your question • Come up with “the ideal” data • Find “actual” data • Explore it, visualize it! • Experiment with different classifiers • Evaluate and write up your results
  • 73. Courses to Take • Statistics: – 116, 200, 202 • Computer Science: – CS229 Next Time: Advanced Machine Learning for Imaging