Im getting an error while executing

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

i am still getting the same error and not able to proceed

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.

i have tried printing the shape of Y and not able to proceed ,my doubt is still not cleared

Hey @sankalparora5, save your complete code as ipynb and than share the link here.