Skip to content

Instantly share code, notes, and snippets.

@tarlanahad
Created March 21, 2020 18:02
Show Gist options
  • Save tarlanahad/7b23f52904fa86475687fd504901dc83 to your computer and use it in GitHub Desktop.
Save tarlanahad/7b23f52904fa86475687fd504901dc83 to your computer and use it in GitHub Desktop.
def fit(self):
for i in range(self.num_of_epochs):
L, dw = self.get_cost_grads(self.X, self.w, self.y)
self.w = self.w - self.lr * dw
if i % 1000 == 0:
print(i, ' | ', L)
def predict(self, X):
X = np.column_stack((np.ones(len(X)), X))
return np.sign(X @ self.w)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment