Aayaan Sahu

SEARCH

Tags

LINKS

Neural Networks Pt. 1

8/1/2022

By Aayaan Sahu

What is a Neural Network?

According to Wikipedia, a neural network is a computing system inspired by the biological neural networks that constitute animal brains. These systems are made up of neurons, also called nodes, which are organized in layers. Together these layers form a network, called the model, that perform computations that help the general model learn.


Quickstart

A node is the smallest functioning part of a neural network. A node has an input, an output, and a set of weights that connect it to other nodes. Some nodes may have biases. Weights and biases are the tunable parameters of a model. A layer is a collection of nodes. Inputs and outputs pass through the layers of the network, till they reach the output layer, which is the final layer, which shows what the model predicted.


Example

We have a simple neural network with layers: aa, bb, cc. aa is the input layer, which receives the input data. bb is the hidden layer, which receives the output of aa. cc is the output layer, which receives the output of bb.

  • Layer aa has 11 node: a1a_1.
  • Layer bb has 33 nodes: b1b_1, b2b_2, b3b_3.
  • Layer cc has 22 nodes: c1c_1, c2c_2.

Now we can declare the weights within this system. The weights are the hidden, tunable parameters of the system, that factor into the output of the system. Let's declare the naming of a weight as the connection between two nodes. For instance the weight between a1a_1 and b1b_1 is called a1b1a_1b_1.

  • Weights between layer aa and layer bb are called a1b1a_1b_1, a1b2a_1b_2, a1b3a_1b_3.
  • Weights between layer bb and layer cc are called b1c1b_1c_1, b1c2b_1c_2, b2c1b_2c_1, b2c2b_2c_2, b3c1b_3c_1, b3c2b_3c_2.

Values propogate through the layers of this neural network, with operations by individual nodes, as they converge in the output node.


Let's find out how this works. Since layer aa is an input layer, it doesn't actually perform any computations. It will just pass values to the next layer. Let's figure out the value of the node b1b_1. The value of b1b_1 is the sum of the weights multiplied by their corresponding input. If this seems confusing, a written out example will help. Let's say the values passed in to the input layer are 11, 22, 33. This means that a1=1a_1 = 1, a2=2a_2 = 2, a3=3a_3 = 3. Let's declare the weights: a1b1=0.5a_1b_1 = 0.5, a2b1=0.2a_2b_1 = 0.2, a3b1=0.1a_3b_1 = 0.1. It's important to realize that the weights connect from all the nodes (a0ana_0 \ldots a_n) in the input layer to one node in the hidden layer (n1n_1).

n1=(1×0.5)+(2×0.2)+(3×0.1)n_1 = (1 \times 0.5) + (2 \times 0.2) + (3 \times 0.1)

Biases

If you've done any research on neural networks before, you might know that the nodes within the model also have what's called biases. Biases are also tunable parameters of the model.

This input layer doesn't have biases, since it just serves to pass inputs to next layer. To see how biases come into play, let's exapnd the example above. Let's say the bias for b1b_1 is 3.53.5.

n1=(1×0.5)+(2×0.2)+(3×0.1)+3.5=4.7n_1 = (1 \times 0.5) + (2 \times 0.2) + (3 \times 0.1) + 3.5 = 4.7

All of the nodes in the hidden layers and output layer follow the same process. The final values at the output layer is what the model predicted.


There is much more to a neural network such as activation functions, loss functions, and optimizers. We will cover these in sections to come.


Keywords


Resources