Skip to content

Instantly share code, notes, and snippets.

@sunilkumardash9
Created January 30, 2022 12:04
Show Gist options
  • Save sunilkumardash9/8c91bdf0436d9ef86be2751acf5be688 to your computer and use it in GitHub Desktop.
Save sunilkumardash9/8c91bdf0436d9ef86be2751acf5be688 to your computer and use it in GitHub Desktop.
def fit(self,X,y,alpha=0.001,iter=400):
weights,X = self.initialize(X)
cost_list = np.zeros(iter,)
for i in range(iter):
weights = weights-alpha*dot(X.T,self.sigmoid(dot(X,weights))-np.reshape(y,(len(y),1)))
cost_list[i] = cost(weights)
self.weights = weights
return cost_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment