Lesson 3: Deep Learning
The Learning Process
Multiple layers of connected neurons exist in a neural network. As data passes through the layers, the neurons change state and "learn". The following diagram shows the learning process:
Types of Neural Network
Besides ANNs, common neural network types that are used for specific tasks include:
- Convolutional neural network (CNN)—CNNs are especially useful for image or video recognition.
- Recurrent neural network (RNN)—Used for time-series data such as daily weather reports. RNNs are also used as part of text-to-speech conversion.
Many of these Network types are freely available from TensorFlow, an open source platform for machine learning.
Training a neural network
At a high level training a neural network involves the following steps:
Design a network architecture consisting of:
- Input Layer size
- Number of hidden layers and type (for example, ReLU)
- Output Layer (for example, Softmax)
Convert source data in-to features. If you are using an image then each pixel typically becomes a feature.
- Train the model for n iterations (epochs).
- Test the model with unseen data and estimate its accuracy.
- Save the trained model and use it to classify any inputs
Try it!
Brain.js is a library for Neural Networks written in JavaScript.
const trainingData = [
{ input: 'I feel great about the world!', output: 'happy' },
{ input: 'What a pill!', output: 'sarcastic' },
{ input: 'The world is a terrible place!', output: 'sad' },
{ input: 'Are you there yet?', output: 'excited' }
];
const net = new brain.recurrent.LSTM();
net.train(trainingData, {
iterations: 100,
errorTresh: 0.011
});
console.log(net.run('I am unhappy!'));
console.log(net.run('I am happy!'));
sad; happy
Select a file or take a picture on a mobile phone. The underlying CNN assesses the image and predicts what objects are visible. In our example, a model was trained on the ImageNet dataset. Not all possible objects are detectable with this small model.
CLASSNAME | PROBABILITY |
---|---|
Border Terrier | 92.2% |
Airedale,Airedale Terrier | 4.5% |
Lakeland Terrier | 1.4% |