exemple python gradient
import numpy as np
exemple python gradient
import numpy as np
class Model():
def __call__(self, x):
return 2 * (2 * x ** 2 - 10) * 4 * x
alpha = 0.005
x = 5.0
norme_epsilon= 100
seuil_epsilon = 0.001
ma_fonction = Model()
while norme_epsilon > seuil_epsilon:
dfx_dx = ma_fonction(x)
norme_epsilon = np.abs(dfx_dx)
x = x - alpha * dfx_dx
print(x)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us