Skip to content

Instantly share code, notes, and snippets.

@curiousily
Created March 31, 2019 06:20
Show Gist options
  • Save curiousily/281020b53e2ac1e4766c138270a9892d to your computer and use it in GitHub Desktop.
Save curiousily/281020b53e2ac1e4766c138270a9892d to your computer and use it in GitHub Desktop.
def fit(X, y, n_iter=100000, lr=0.01):
W = np.zeros(X.shape[1])
for i in range(n_iter):
z = np.dot(X, W)
h = sigmoid(z)
gradient = np.dot(X.T, (h - y)) / y.size
W -= lr * gradient
return W
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment