Neural Network Classification With
Neural Network Classification With
“What is a classification
problem?”
Example classification problems
“Is this email spam or not spam?” “Is this a photo of sushi, steak or pizza?”
To: [email protected] To: [email protected]
Hey Daniel, Hay daniel…
Machine learning
Representation learning
Arti cial intelligence
fi
fi
fi
• Input shapes and output shapes of a classi cation model (features and labels)
• Steps in modelling
👩🍳 👩🔬
(we’ll be cooking up lots of code!)
How:
ff
fi
fi
fi
fi
fi
🍣 🥩 🍕
[[0.31, 0.62, 0.44…], [[0.97, 0.00, 0.03],
[0.92, 0.03, 0.27…], [0.81, 0.14, 0.05],
[0.25, 0.78, 0.07…], [0.03, 0.07, 0.90],
…, (normalized pixel valu …,
es)
Numerical
Predicted output
encoding (often already ex
ists, if not,
you can build on (comes from looking at lots
e) of these)
224
[[0.31, 0.62, 0.44…], 🍣 🥩 🍕
224 [0.92, 0.03, 0.27…], [0.97, 0.00, 0.03]
[0.25, 0.78, 0.07…], i o n p r ob ab i l i t i e s )
(predict
…,
Architecture of a classification
model (we’re going to be buildin
lots of these)
g
Source: Adapted from page 295 of Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow Book by Aurélien Géron
Sushi 🍣
Steak 🥩
Pizza 🍕
Let’s code!
The machine learning explorer’s
motto
“Visualize, visualize, visualize”
Data
Training
Predictions
Architecture of a classification
model (we’re going to be buildin
lots of these)
g
Source: Adapted from page 295 of Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow Book by Aurélien Géron
Sushi 🍣
Steak 🥩
Pizza 🍕
• Epochs — how many times the model will go through all of the
training examples.
4. Evaluate the model on the test data (how reliable are our model’s
predictions?)
Smaller model
Smaller model
fi
fi
Correct predictions
t i v e s 0 1 (true positives,
e g a
False n Predicted Label true negatives)
1. Turn all data into numbers (neural networks can’t handle strings)
2. Make sure all of your tensors are the right shape (inputs and outputs)
3. Scale features — normalize or standardize, neural networks tend to prefer normalization (values
between 0 & 1)
Outputs to
Outputs to
Outputs to
Outputs to
Learns
Numerical representation Representation
Inputs Outputs
encoding (patterns/features/weights) outputs
👩🍳 👩🔬
(try lots of things an
d see what
tastes good)