The idea of Neural Network
The basic idea behind a neural network is to simulate lots of densely interconnected brain cells inside a computer so you can get it to learn things, recognize patterns, and make decisions in a human-like way. The amazing thing about a neural network is that you don't have to program it to learn explicitly: it learns all by itself, just like a brain!
It's important to note that neural networks are (generally) software simulations: they're made by programming very ordinary computers, working in a very traditional fashion with their ordinary transistors and serially connected logic gates, to behave as though they're built from billions of highly interconnected brain cells working in parallel. No-one has yet attempted to build a computer by wiring up transistors in a densely parallel structure exactly like the human brain.
Building Dense Layer from scratch:
Single Layer Neural Network:
A single hidden layer is fed into a single output layer. The states of the hidden layer are not directly observed. We can probe inside the network and see them but we don’t actually enforce.
Since we have a transformation between the inputs & hidden layer and hidden layer & output layer, each of those transformations will have their own weight matrices i.e. W1 and W2.
If we take a single unit inside of that hidden layer, we take z2, it’s a single perceptron taking a weighted sum of all inputs that feed into it and it applies non-linearity and feeds it on to the next layer.
If we want to implement this intensive flow, we have defined two of these dense layers i.e. first as a hidden layer and second as output layer. We can join them together as a wrapper which is called TF sequential model.
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Densse(n),
tf.keras.layers.Densse(2),
])
The sequential model is the idea of composing neural networks using a sequence of layers. It’s very nice to allow information to propagate through that model.
A deep neural network is composed of multiple levels of nonlinear operations, such as neural nets with many hidden layers.
The code of deep neural network sequential model:
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Densse(n1),
tf.keras.layers.Densse(n2),
.
.
tf.keras.layers.Densse(2),
])
Comments
Post a Comment