Neural Networks
Neural Networks
AGENDA
• Definition – Motivation – History – Math used –Why NNs?
• What is Deep learning, its purpose and DNN?
• Architecture of NN?
• Types of NN?
• Neurons – Activation functions?
• Problem in NN
• Loss and Cost functions?
• Optimization and Regularization?
• Feed forward NN & Back Propagation?
• Gradient Descent
CREDITS: • Applications, Advantages and Disadvantages of NN
PPT also contains slides from
DeepLearning.AI and Dr Andrew Ng’s
classes
Gist of Neural Networks
- Definition, motivation, Architecture, working and applications
• Neural networks, also called artificial • Training data teach neural networks and
neural networks (ANNs) or simulated help improve their accuracy over time.
neural networks (SNNs), are a subset of Once the learning algorithms are
machine learning and are the backbone of fined-tuned, they become powerful
deep learning algorithms. computer science and AI tools because
• They are called “neural” because they they allow us to very quickly classify and
mimic how neurons in the brain signal cluster data.
one another.
• Neural networks are made up of node • Using neural networks, speech and image
layers – an input layer, one or more recognition tasks can happen in minutes
hidden layers, and an output layer. instead of the hours they take when done
• Each node is an artificial neuron that manually. Google’s search algorithm is a
connects to the next, and each has a well-known example of a neural network.
weight and threshold value.
• When one node’s output is above the
threshold value, that node is activated and
sends its data to the network’s next layer.
If it’s below the threshold, no data passes
along.
MOTIVATION IN DETAIL
The neuronal perception of deep learning is
generally motivated by two main ideas:
Perceptrons can be viewed as building blocks in a single layer in a neural network, made up of four different
parts:
1. Input Values or One Input Layer
2. Weights and Bias
3. Net sum
4. Activation function
A neural network, which is made up of perceptrons, can be perceived as a complex logical statement (neural
network) made up of very simple logical statements (perceptrons) of “AND” and “OR” statements. A
statement can only be true or false, but never both at the same time. The goal of a perceptron is to determine
from the input whether the feature it is recognizing is true, in other words whether the output is going to be a
0 or 1. A complex statement is still a statement, and its output can only be either a 0 or 1.
HOW A PERCEPTRON FUNCTIONS
• Summing up the weighted inputs (product of each input from the previous layer
multiplied by their weight), and adding a bias (value hidden in the circle), will produce a
weighted net sum. The inputs can either come from the input layer or perceptrons in a
previous layer. The weighted net sum is then applied to an activation function which then
standardizes the value, producing an output of 0 or 1. This decision made by the
perceptron is then passed onto the next layer for the next perceptron to use in their
decision.
• Together, these pieces make up a single perceptron in a layer of a neural network. These
perceptrons work together to classify or predict inputs successfully, by passing on
whether the feature it sees is present (1) or is not (0). The perceptrons are essentially
messengers, passing on the ratio of features that correlate with the classification vs the
total number of features that the classification has. For example, if 90% of those features
exist then it is probably true that the input is the classification, rather than another input
that only has 20% of the features of the classification.
• It’s just as Helen Keller once said, “Alone we can do so little; together we can do so
much.” and this is very true for perceptrons all around.
BASIC NN ARCHITECTURE AND
INNER WORKING OF NN
Difference in No. of. Layers makes a
difference
• In Perceptron, there are no • A neural network of more
hidden layers, hence it takes than three layers, including
an input and calculates the the inputs and the output,
weighted input for each input can be considered a
node. This weighted input is deep-learning algorithm.
then passed through an • Thus, That is where Deep
activation function to Neural Networks appear
generate the output. (when Total number of layers
• The Shallow neural network in a NN >3)
has only one hidden layer
between the input and
output.
Deep Learning (DL)
• Deep learning is a specific subfield of machine learning:
a new take on learning representations from data that
puts an emphasis on learning successive layers of
increasingly meaningful representations.
• The ‘deep’ in deep learning stands for this idea of
successive layers of representations.
• How many layers contribute to a model of the data is
called the depth of the model.
• Modern deep learning often involves tens or even
hundreds of successive layers of representations— and
they’re all learned automatically from exposure to
training data.
• Meanwhile, other approaches to machine learning tend
to focus on learning only one or two layers of
representations of the data; hence, they’re sometimes
called shallow learning.
• In deep learning, these layered representations are
(almost always) learned via models called neural
networks, structured in literal layers stacked on top of
each other.
Why NNs? NN vs DL?
Neural networks excel at Thanks to its fewer layers and
handling high-dimensional connections, you can train a
data and can automate simple neural network more
feature extraction, reducing quickly. However, their
simplicity also limits the extent
the need for manual feature
to which you can teach them.
engineering. This makes them They cannot perform complex
crucial for solving tasks that analysis. Deep learning systems
involve intricate patterns that have a much greater capacity
traditional algorithms might to learn complex patterns and
struggle to capture skills.
effectively.
Purpose of Deep Learning?
DECISIONS TO MAKE
• There are two key architecture decisions to be made about such a
stack of Dense NN layers:
1. How many layers to use
2. How many hidden units to choose for each layer
INNNER WORKINGS OF A NN with an
example
NN TYPES
FEEDFORWARD NN
• A feedforward network consists of an • When a neural network is first trained, it is
input layer, one or more hidden layers, first fed with input. Since the neural
and an output layer. The input layer network isn’t trained yet, we don’t know
receives the input into the neural which weights to use for each input. And
network, and each input has a weight so, each input is randomly assigned a
attached to it. weight. Since the weights are randomly
assigned, the neural network will likely
make the wrong predictions. It will give
• The weights associated with each input out the incorrect output.
are numerical values. These weights are
an indicator of the importance of the
input in predicting the final output. For • When the neural network gives out the
example, an input associated with a large incorrect output, this leads to an output
weight will have a greater influence on the error.
output than an input associated with a
small weight.
FEEDFORWARD NN
• This error is the difference
between the actual and predicted
outputs. A cost function measures
this error.