Created
May 27, 2017 11:13
-
-
Save slchangtw/34e9404f604ad453c0e5a6817241594e to your computer and use it in GitHub Desktop.
This file contains 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
from ad import adnumber | |
from ad import admath | |
import numpy as np | |
# ref: http://cs231n.github.io/optimization-2/ | |
w = adnumber(np.array([2, -3, -3])) | |
x = adnumber(np.array([-1, -2, 1])) | |
f = 1 / (1 + admath.exp(-sum(w * x))) | |
f.gradient(w) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment