DEEP LEARNING

MP Neuron Model

Tanuj Shrivastava
Analytics Vidhya
Published in
5 min readSep 24, 2020

--

Biological Neurons

https://miro.medium.com/max/1030/1*1Oh53dNdPITVnoOVGCCUFA.png
  • Dendrites are to bring inputs from other neurons or the sensory organs .
  • Synapse are the strength of the interaction between two neuron .
  • Soma is some kind of processing unit it takes all the neuron and does some kind of processing on top of it .

Artificial Neuron

  • x1 , x2 and x3 are the inputs which corresponds to dendrites in biological neuron .
  • w1 , w2 and w3 stands for weights which corresponds to synapse .
  • The circular part corresponds to soma and the output arrow corresponds to axon .

McCulloch-Pitts Neuron (MP Neuron)

  • The early model on an artificial neuron is introduced by Warren McCulloch(neuroscientist) and Walter Pitt(logician) in 1943
  • The McCulloch-Pitts Neuron is also known as a linear threshold gate

The Model

  • The inputs can only be boolean .
  • The output can only be boolean .
  • g aggregate the input and f takes the decision based on the aggregation .

Condition

  • As in the above figure g takes the sum of all the inputs and f takes g as a input . And these all are boolean inputs .
  • Here b is some threshold .

Data and task

  • In this example we want our model to predict whether the decision is LBW or not based on certain factors like — ball pitching in line , it’s impact and it is mission the stumps or hitting the stumps .

Loss functions

  • The loss tends to be the error which the model has made at the time of prediction or it can be the difference between the true and the predicted value .
  • We are taking the square of difference between the true and the predicted value in order to remove the negative sign which can occur if the true value is 0 and the predicted value is 1 as we have binary output in the case of MP neuron model .

Note : There can be a question in your mind that why we are not taking the modulus of the value instead the reason is that the modulus value cannot be differentiable and we will come to know later why differentiability is important .

Learning Algorithm

  • We want our loss function to be minimum so we want to plug in the value of b and then start feeding the inputs one by one so the output which we get is same or as close as true value .
  • In the case of MP Neuron model we can only have one parameter so we can use bruit force search technique in order to compute the value of b .
  • So consider we have n features so the value of b must be in range 0 to n , b can have discrete values only, as the inputs are also discrete values .

Evaluation

  • How our model is going to perform on the data which it has not seen before or the testing data .
  • We will evaluate our MP neuron model on the basic of accuracy which is Number of correct prediction divided by Total no. of prediction .
  • In the above example the accuracy on the test set will be 3/4 which is equivalent to 75% .

Geometry behind MP Neuron

figure 1
  • The Eq. of line is : y = mx + c
  • Replace x with x1 and y with x2

=> x2 = mx1 + c

=> mx1 -x2 +c

  • The general Eq. of line can be written as :

ax1 + bx2 +c = 0

  • In the figure the points are taken as : a = 2 , b=1 and c = -2
figure 2
  • In this figure (figure 2) we can see two points (1,2) and (-1,1)
  • Consider the point (1,2), plugging it into the equation gives us the value 2 .
  • If ax1 + bx2 + c > 0 then it is above the line .
  • If ax1 + bx2 + c < 0 then it is below the line .
  • If ax1 + bx2 + c = 0 then it is on the line .

MP Neuron Model

Here we are loading breast cancer dataset from scikit-learn and training it using MPNeuron model

Note : MPNeuron is just a basic model with just one parameter b so we cannot accept more accuracy then what we get , if we move ahead with some more advance models like perceptron , sigmoid neuron we get way better accuracy .

References:

--

--

Tanuj Shrivastava
Analytics Vidhya

Data science , Machine Learning and Deep Learning enthusiast .