class SigmoidNeuron:

def __init__(self):

```
self.w =None
self.b =None
```

def perceptron(self,x):

```
return np.dot(x,self.w.T)+self.b
```

def sigmoid(self,x):

```
return 1.0/(1.0+np.exp(-x))
```

def grad_w(self,x,y): # as per the calculation we derived

```
y\_pred = self.sigmoid(self.perceptron(x))
return (y\_pred-y)\*y\_pred\*(1-y\_pred)\*x
```

def grad_b(self,x,y): # as per the calculation we derived

```
y\_pred = self.sigmoid(self.perceptron(x))
return (y\_pred-y)\*y\_pred\*(1-y\_pred)
```

def fit(self,X,Y,epochs=1,learning_rate =1,initialize =True):

```
#initialize w and b
if initialize :
self.w = np.random.randn(1,X.shape\[1\])
self.b =0
for i in range(epochs):
dw =0
db =0
for x,y in zip(X,Y):
dw+=self.grad\_w(x,y)
db+=self.grad\_b(w,y)
self.w -= learning\_rate\*dw
self.b -= learning\_rate\*db
```

X= np.asarray([[2.5,2.5],[4,-1],[1,-4],[3,1.25],[2,4],[1,5]])

Y=[1,1,1,0,0,0]

sn =SigmoidNeuron()

sn.fit(X,Y,1,0.25,True)

ValueError: shapes (100,) and (2,1) not aligned: 100 (dim 0) != 2 (dim 0)

From where I am getting this 100