- Apr 16, 2021
- 3 minutes

# PREMIUM MP Neuron Model

*Dendrites are to bring inputs from other neurons or the sensory organs.**Synapses are the strength of the interaction between two neurons.**Soma is some kind of processing unit it takes all the neurons and does some kind of processing on top of it.*

## Artificial Neuron

*x1, x2, and x3 are the inputs that correspond to dendrites in the biological neuron.**w1, w2, and w3 stand for weights that correspond to synapse.**The circular part corresponds to the 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 take 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 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 a 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 the 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 the 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 the same or as close as the true value.
- In the case of the MP Neuron model, we can only have one parameter so we can use the
**brute 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 basis of accuracy which is the Number of correct predictions divided by the Total no. of predictions.

In the above example, the accuracy on the test set will be 3/4 which is equivalent to 75%.

## The geometry behind MP Neuron

- 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

- 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 the breast cancer dataset from sci-kit-learn and training it using the MPNeuron model*

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

Learn with the best. Get access to all existing and future courses and articles created by Tanuj shrivastava.