Created
November 12, 2019 22:45
-
-
Save kpko/1bd8655b94f49fa903ce1d1d4d3bf280 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 armijo_step(xi,alpha,beta,gamma): | |
k = 1 | |
c = 0 | |
s = - grad(xi) | |
left lambda: cost(xi + alpha*k*s) - cost(xi) | |
right lambda: alpha*k*gamma*np.dot(grad(xi).T,alpha*s) | |
while left() > right(): | |
k = k * beta | |
print(str(alpha*k)) | |
print(str(c)) | |
c = c + 1 | |
print(str(c)) | |
return alpha*k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment