Intro to ML - Making a Multilayered Perceptron

  • code-first
  • tsoding

Making a Multilayered Perceptron

Perceptron ?

Not that guy from Transformers. Its Megatron.

Perceptron is basicaly a brain cell of a neural network.

A neural network is like a brain. It has many brain cells called neurons. Each neuron is connected to other neurons.

  • The x1, x2 and x3 are the inputs.
  • The w1, w2 and w3 are the weights. and the prefix xn is the neuron the weight is connected to..
  • b is the bias. A bias belongs property belongs to each neurons
  • h1, h2 and h3 are the hidden layers.
  • eg: h1=x1∗w1+x2∗w2+x3∗w3+bh_{1} = x_{1}*w_{1} + x_{2}*w_{2} + x_{3}*w_{3} + b
  • The y is the output.

Each one of those circles are a perceptron. A perceptron is a simple neuron. It has some inputs, weights and an output.

class Perceptron():
    def __init__(self, data):
        self.weights = [0, 0, 0] # supposed to be random
        self.bias = 0
        self.data = data

x1, x2, x3 = Perceptron(1), Perceptron(2), Perceptron(3)

We could consider perceptron as a python object with some attributes.

Each of the perceptron has like a “data” property attached to it. That value is passed on to the next neuron.