Skip to content

Instantly share code, notes, and snippets.

@Muhammad-Yunus
Created April 10, 2020 08:04
Show Gist options
  • Save Muhammad-Yunus/04fbdc6fd3f106d9b7e1f4aab6de382a to your computer and use it in GitHub Desktop.
Save Muhammad-Yunus/04fbdc6fd3f106d9b7e1f4aab6de382a to your computer and use it in GitHub Desktop.
for i in range(NUM_ITER):
y_pred = np.dot(x, W) + b
#activation sigmoid
y_pred = 1.0 / (1.0 + np.exp(-y_pred))
err = y - y_pred
delta_W = learning_rate * np.dot(np.transpose(x) , err)
delta_b = learning_rate * np.sum(err)
W = W + delta_W
b = b + delta_b
print ("Iterasi ke-" + str(i), err, W, b, "Error :" + str(np.abs(np.sum(err) / np.sum(y))))
if np.abs(np.sum(err) / np.sum(y)) <= 0.1:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment