What is wron here , i have asked this doubt , i have not been answered till now

def hingeloss(self,X,Y,W,b):

loss=0.0

loss+=0.5*np.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

i am getting the error as ‘int’ object is not subscriptable in the line ti=Y[i]*(np.dot(W,X[i].T)+b) But i think the code is correct, can you please check

Hey @sankalparora5, print the shape of Y before this line, and check if its correct or not.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.