Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP_Gradient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raphael.stouder
TP_Gradient
Commits
bf336d1d
Commit
bf336d1d
authored
7 months ago
by
raphael.stouder
Browse files
Options
Downloads
Patches
Plain Diff
[fix] Path index
parent
9019caeb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tpGradient.py
+9
-9
9 additions, 9 deletions
tpGradient.py
with
9 additions
and
9 deletions
tpGradient.py
+
9
−
9
View file @
bf336d1d
...
...
@@ -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.
000
01
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment