Hello,

The video in which Pratyush Sir had made a class for MP Neuron Model, he used many functions which i couldn’t understand.

The class is given below:

```
class MPNeuron:
def __init__(self):
self.b = None
def model(self, x):
return(sum(x) >= self.b)
def predict(self, X):
Y = []
for x in X:
result = self.model(x)
Y.append(result)
return np.array(Y)
def fit(self, X, Y):
accuracy = {}
for b in range(X.shape[1] + 1):
self.b = b
Y_pred = self.predict(X)
accuracy[b] = accuracy_score(Y_pred, Y)
best_b = max(accuracy, key = accuracy.get)
self.b = best_b
print('Optimal value of b is', best_b)
print('Highest accuracy is', accuracy[best_b])
```

Please explain the functions.

–Bilal