Why this code is showing an error

class svm:
def init(self,c=1.0):
self.c=c
self.W=0
self.b=0
def hingeloss(self,W,b,X,Y):
loss=0.0
loss+= .5np.dot(W,W.T)
m=X.shape[0]
for i in range(m):
ti=Y[i]
(np.dot(W,X[i].T)+b)
loss+= self.c*max(0,(1-ti))
return loss
def fit(self,X,Y,batch_size=100,learning_rate=0.0001):
no_of_features=X.shape[1]
no_of_samples=X.shape[0]
n=learning_rate
c=self.c
W=np.zeros((1,no_of_features))
bias=0
print(hingeloss(X,Y,W,bias))
mysvm=svm()
mysvm.fit(X,Y)

Hey @Aashi-Agarwal-2380268668952871, match your code line by line from this link,

Hope this resolved your doubt.
Don’t forget to mark it as resolved. :blush: