Skip to content
Snippets Groups Projects
Commit bf336d1d authored by raphael.stouder's avatar raphael.stouder
Browse files

[fix] Path index

parent 9019caeb
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,7 @@ def terminal_loading():
def compute_choices(func_choice, grad_choice, i_choice, sg_choice):
global done
momentum = 0.8
learn_rate = 0.01
learn_rate = 0.00001
maxIter = 10000
tolerance = 1e-05
......@@ -251,16 +251,16 @@ def create_plots(function, initialPoint, path, trueMinPoints,show_gradients):
ax2.set_ylabel('y')
# Ajouter les points initiaux et finaux aux plots
ax1.plot([initialPoint[0]], [initialPoint[1]], [function(initialPoint[0], initialPoint[1])], 'mp')
ax2.plot([initialPoint[0]], [initialPoint[1]], 'mp')
ax1.plot([path[-1][0]], [path[-1][1]], [function(path[-1][0], path[-1][1])], 'cd')
ax2.plot([path[-1][0]], [path[-1][1]], 'cd')
ax1.plot([initialPoint[0]], [initialPoint[1]], [function(initialPoint[0], initialPoint[1])], 'mp', zorder=7)
ax2.plot([initialPoint[0]], [initialPoint[1]], 'mp', zorder=7)
ax1.plot([path[-1][0]], [path[-1][1]], [function(path[-1][0], path[-1][1])], 'cd', zorder=7)
ax2.plot([path[-1][0]], [path[-1][1]], 'cd', zorder=7)
# Ajouter les points de minimums globaux aux plots
if trueMinPoints:
for point in trueMinPoints:
ax1.plot([point[0]], [point[1]], [function(point[0], point[1])], 'kX')
ax2.plot([point[0]], [point[1]], 'kX')
ax1.plot([point[0]], [point[1]], [function(point[0], point[1])], 'kX', zorder=7)
ax2.plot([point[0]], [point[1]], 'kX', zorder=7)
# Créer l'animation du chemin de descente de gradient
lines1 = []
......@@ -292,8 +292,8 @@ def create_plots(function, initialPoint, path, trueMinPoints,show_gradients):
colors = np.array([custom_cmap(1 - min(step_size / max_step_size, 1)) for step_size in step_sizes])
for _ in range(len(filtered_path)):
line1, = ax1.plot([], [], [], 'r.-', markersize=5, lw=1)
line2, = ax2.plot([], [], 'r.-', markersize=5, lw=1)
line1, = ax1.plot([], [], [], 'r.-', markersize=5, lw=1, zorder=6)
line2, = ax2.plot([], [], 'r.-', markersize=5, lw=1, zorder=6)
lines1.append(line1)
lines2.append(line2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment