Created
March 31, 2019 06:20
-
-
Save curiousily/281020b53e2ac1e4766c138270a9892d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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