This document summarizes the steps and concepts involved in machine learning. It describes a machine learning workshop that will cover an introduction to machine learning, a Python tutorial, and potentially a MATLAB demo. It then discusses the differences between traditional programming and machine learning, noting that machine learning allows computers to learn from data without being explicitly programmed. The rest of the document outlines the basic steps in a machine learning problem: 1) defining the problem, 2) curating and labeling data, 3) selecting a model and algorithm, 4) applying the algorithm to train the model, and 5) evaluating the trained model. It provides examples for each step using an emotion recognition problem from the JAFFE facial image dataset.
2. Outline
• Introduction to Machine Learning
• Python Tutorial
• MATLAB Demo (time permitting)
IDSTEM Workshop: Basics of Coding and Machine Learning
3. Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
IDSTEM Workshop: Basics of Coding and Machine Learning
4. Traditional
Programming
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
IDSTEM Workshop: Basics of Coding and Machine Learning
5. Traditional
Programming
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
IDSTEM Workshop: Basics of Coding and Machine Learning
6. Traditional
Programming
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Model
IDSTEM Workshop: Basics of Coding and Machine Learning
7. Traditional
Programming
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Model
Outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
8. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
IDSTEM Workshop: Basics of Coding and Machine Learning
9. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
IDSTEM Workshop: Basics of Coding and Machine Learning
10. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
11. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Outputs
Model
IDSTEM Workshop: Basics of Coding and Machine Learning
12. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Outputs
Model
New Data
IDSTEM Workshop: Basics of Coding and Machine Learning
13. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Outputs
Model
New Data
Unknown
Outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
14. Machine
Learning
Machine Learning vs Traditional Programming
“Machine learning is a field of study that gives computers the ability to
learn without being explicitly programmed” – A. Samuel 1959
Data
Outputs
Model
*supervised learning
New Data
Unknown
Outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
15. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
16. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
Emotion Recognition
JAFFE
Dataset
17. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
18. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Khashman, A. (2009) Applications of an
emotional neural network to facial recognition.
Neural Comput & Applic 18: 309-320.
Different images may have
different pose, contrast,
lighting conditions, etc.
19. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset Traditional
Programming
Data Model
Outputs
20. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset Traditional
Programming
Data Model
Outputs
?
21. Why use Machine Learning?
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset Traditional
Programming
Data Model
Outputs
?
Machine Learning is useful for modelling
complex relationships with no known
governing equation
22. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
5. Evaluate trained model on
validation data with known
outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
23. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
24. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
25. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
26. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
Regression
(continuous)
27. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
Regression
(continuous)
Inputs
28. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
Regression
(continuous)
Inputs
Class 1
Class 2
29. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
Regression
(continuous)
Inputs
Class 1
Class 2
Class 3
30. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
Regression
(continuous)
Inputs
Class 1
Class 2
Class 3
Inputs
31. Machine Learning: Basic Steps
1. Define the problem
IDSTEM Workshop: Basics of Coding and Machine Learning
Supervised Learning
Classification
(discrete output)
Regression
(continuous)
Inputs
Class 1
Class 2
Class 3
Inputs
32. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
33. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Emotion Recognition
JAFFE
Dataset
34. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
35. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Data
36. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Data
Training Data
Validation Data
Testing Data
37. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
41. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
44. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
45. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Feature
Extraction
46. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Feature
Extraction
47. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Feature
Extraction
Right
eyebrow
(middle)
Left eye
(inner)
Mouth end (right)
48. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Feature
Extraction
Right
eyebrow
(middle)
Left eye
(inner)
Mouth end (right)
x1
y1
x2
y2
x3
y3
…
49. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
IDSTEM Workshop: Basics of Coding and Machine Learning
Neutral Sad Surprised
Emotion Recognition
JAFFE
Dataset
Feature
Extraction
Right
eyebrow
(middle)
Left eye
(inner)
Mouth end (right)
x1
y1
x2
y2
x3
y3
…
*dimensionality reduction
50. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
51. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Neural
Networks
52. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Linear
Regression
Neural
Networks
53. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Decision
Trees
Linear
Regression
Neural
Networks
54. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Decision
Trees
Nearest
Neighbor
Linear
Regression
Neural
Networks
55. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Decision
Trees
Nearest
Neighbor
Linear
Regression
Neural
Networks
Support Vector
Machines (SVM)
56. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Input Layer
(features)
Output Layer
(labels)
Hidden
Layer
Neural
Networks
57. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Input Layer
(features)
Output Layer
(labels)
Hidden
Layer
x1
x0
y
y = f(w0 + w1x1 + w2x2)
Neural
Networks
58. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Input Layer
(features)
Output Layer
(labels)
Hidden
Layer
x1
x0
y
y = f(w0 + w1x1 + w2x2)
learned
weights
Neural
Networks
59. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Input Layer
(features)
Output Layer
(labels)
Hidden
Layer
x1
x0
y
y = f(w0 + w1x1 + w2x2)
activation function
(chosen parameter)
Neural
Networks
60. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Learning
Algorithm
Training Data
Model Class
Model Weights
61. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Learning
Algorithm
Training Data
Model Class
Model Weights
W’ = argminW
1
n
!
i=1
n
Li $
yi(W),yi
62. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Learning
Algorithm
Training Data
Model Class
Model Weights
W’ = argminW
1
n
!
i=1
n
Li $
yi(W),yi
weights
63. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Learning
Algorithm
Training Data
Model Class
Model Weights
W’ = argminW
1
n
!
i=1
n
Li $
yi(W),yi
model
prediction
labels
weights
loss function
64. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
IDSTEM Workshop: Basics of Coding and Machine Learning
Learning
Algorithm
Training Data
Model Class
Model Weights
W’ = argminW
1
n
!
i=1
n
Li $
yi(W),yi
model
prediction
labels
weights
loss function
*regularization?
65. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
IDSTEM Workshop: Basics of Coding and Machine Learning
66. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
IDSTEM Workshop: Basics of Coding and Machine Learning
optimize weights
67. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
5. Evaluate trained model on
validation data with known
outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
68. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
5. Evaluate trained model on
validation data with known
outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
An estimate of how well our
model will generalize to new data
Training data
Validation data
Model
overfitting
69. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
5. Evaluate trained model on
validation data with known
outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
70. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
5. Evaluate trained model on
validation data with known
outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
Repeat with different model
classes, parameters, etc.
71. Machine Learning: Basic Steps
1. Define the problem
2. Curate and label the data
3. Select model class,
learning algorithm, loss
function, and other
parameters
4. Apply learning algorithm to
training data to fit model
5. Evaluate trained model on
validation data with known
outputs
IDSTEM Workshop: Basics of Coding and Machine Learning
Repeat with different model
classes, parameters, etc.
Evaluate best performing
model on testing data
73. Machine Learning Limitations
• Large data, computational requirements
• Can produce unexpected results when
evaluated on data under-represented in
the training set
IDSTEM Workshop: Basics of Coding and Machine Learning
74. Machine Learning Limitations
• Large data, computational requirements
• Can produce unexpected results when
evaluated on data under-represented in
the training set
IDSTEM Workshop: Basics of Coding and Machine Learning