Skip to content

Instantly share code, notes, and snippets.

@sunilkumardash9
Created January 30, 2022 12:05
Show Gist options
  • Save sunilkumardash9/8f17862aea2559b814378332ee3338e3 to your computer and use it in GitHub Desktop.
Save sunilkumardash9/8f17862aea2559b814378332ee3338e3 to your computer and use it in GitHub Desktop.
def cost_func(self,theta):
z = dot(X,theta)
cost0 = y.T.dot(log(self.sigmoid(z)))
cost1 = (1-y).T.dot(log(1-self.sigmoid(z)))
cost = -(sum(cost1 + cost0))/len(y)
return cos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment