-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
181 lines (155 loc) · 8.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<html>
<head>
<title>Interactive Gradient Decent Method | Ezequiel Leonardo Castaño Personal Website</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification" content="" />
<!-- Feed -->
<link rel="alternate" type="application/atom+xml" href="http://feeds.feedburner.com/ELCWEB"
title="Ezequiel Leonardo Castaño Personal Website Atom Feed" />
<link rel="alternate" type="application/atom+xml" href="http://feeds.feedburner.com/feeds/all.atom.xml"
title="Ezequiel Leonardo Castaño Personal Website Atom Feed" />
<!-- FAVICON -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000">
<meta name="msapplication-TileColor" content="#000000">
<meta name="theme-color" content="#ffffff">
<!-- Social -->
<meta property="article:author" content="Ezequiel Leonardo Castaño" />
<meta property="article:section" content="Programming" />
<meta property="article:published_time" content="2019-11-17" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Interactive Gradient Descent Method | Ezequiel Leonardo Castaño Personal Website" />
<meta property="og:description" content="A visualization tool for the Gradient Descent Method with 2 Variables" />
<meta property="og:site_name" content="Ezequiel Leonardo Castaño Personal Website" />
<meta property="og:url" content="https://elc.github.io/gradient-descent-method/" />
<meta property="og:image" content="https://elc.github.io/gradient-descent-method/media_image.png" />
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Interactive Gradient Descent Method | Ezequiel Leonardo Castaño Personal Website">
<meta name="twitter:description" content="A visualization tool for the Gradient Descent Method with 2 Variables">
<meta name="twitter:url" content="https://elc.github.io/gradient-descent-method/">
<meta name="twitter:image" content="https://elc.github.io/gradient-descent-method/media_image.png">
<script src="https://elc.github.io/interactive-optimization/nerdamer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/function-plot/1.18.1/function-plot.js"></script>
<link href="https://fonts.googleapis.com/css?family=M+PLUS+1p&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href='https://elc.github.io/interactive-optimization/style.css'>
<style>
.header{
display:flex;
flex-direction: column;
justify-content: space-between;
}
.header__title{
margin: 0 0 15px 0;
}
.content{
margin: 15px 0 10px 0;
}
.window{
padding: 12px;
}
.option--results{
padding: 5px 10px 10px 10px;
}
.option--plot{
padding-top: 0;
}
</style>
<script src="https://elc.github.io/interactive-optimization/basic.js"></script>
<script>
function method(fun, evaluate_point, iterations){
var alpha = document.querySelector("#alpha").value;
return gradient_method(fun, evaluate_point, alpha, iterations)
}
function test_function(fun, guess_x, guess_y, alpha, iterations) {
document.querySelector("#function").value = fun;
document.querySelector("#guess_x").value = guess_x;
document.querySelector("#guess_y").value = guess_y;
document.querySelector("#alpha").value = alpha;
document.querySelector("#iterations").selectedIndex = iterations - 1;
plot();
}
</script>
</head>
<body class="frame--main">
<header class="header window">
<h1 class="header__title">Gradient Descent</h1>
<section class="header__settings">
<div class="header__settings__component">
<label for="function">Function f(x, y)</label>
<span class='header__settings__component__field'>
<span class="header__settings__label">f(x, y)=</span>
<input class="header__input--function" id="function" type="text" value="0.1(3 * x^2 + 2 * x * y + 1.5 * y^2)"
onkeypress="plot_event(event)">
</span>
</div>
<div class="header__settings__component">
<label for="guess">Parameters</label>
<span class='header__settings__component__field'>
<span class="header__settings__label">X<sub>0</sub>=</span>
<input class="header__input--point" id="guess_x" type="float" value="2" onkeypress="plot_event(event)">
<span class="header__settings__label">Y<sub>0</sub>=</span>
<input class="header__input--point" id="guess_y" type="float" value="-3" onkeypress="plot_event(event)">
<span class="header__settings__label">α=</span>
<input class="header__input--point" id="alpha" type="float" value="1.5" onkeypress="plot_event(event)">
</span>
</div>
<div class="header__settings__component">
<label for="iterations">Iterations</label>
<span class='header__settings__component__field'>
<select class="header__input--iteration" id="iterations" name="iterations">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7" selected>7</option>
</select>
</span>
</div>
<button class="button button--calculate" type="submit" onclick="plot();">Calculate!</button>
</section>
</header>
<div class="content">
<section class="option window option--results">
<p id="results"></p>
</section>
<section class="option window option--plot">
<div id="graph"></div>
<p class="option--results__measurements" id="exec-time"></p>
</section>
<section class="option window option--test">
<p class="option__title"> Try These Functions</p>
<button class="button button--function"
onclick="test_function('0.02 * ( (x^2 + y - 11)^2 + (x + y^2 - 7)^2)', 1, 1, 0.5, 6);">Quartic<br><small>(Himmelblau)</small></button>
<button class="button button--function"
onclick="test_function('2*(0.5 * x)^2 - 1.05 * (0.5 * x)^4 + (0.5 * x)^6 / 6 + (0.5 * x) * (0.75 * y) + (0.75 * y)^2', 1, -4, 0.7, 7);">Local
Minima<br><small>(Camel)</small></button>
<button class="button button--function" onclick="test_function('(0.4 * x)^3 + (0.3 * y)^5', 5, 5, 0.8, 7);">Saddle Point
<br><small>(Powell Sum)</small></button>
<button class="button button--function"
onclick="test_function('0.01 * ((x^2 - 1)^2 + (y^2 - 2)^2)', 2, -3, 1, 7);">Multi
Modal<br><small>(Qing)</small></button>
<button class="button button--function"
onclick="test_function('0.0005 * (100 (y - (0.5 * x)^2)^2+ (1 - (0.5 * x))^2)', 3, -2, 2, 6);">Local
Minima<br><small>(Rosenbrock)</small></button>
<a href="https://forms.gle/wJkGp2iGApzM19W69" class="button button--propose button--function" target="_blank">Propose</a>
</section>
</div>
<footer class="footer window">
<p>
This project was an assignment for the course <a
href="https://www.tu-ilmenau.de/en/process-optimization/teaching/vorlesungen-seminare-und-praktika/wintersemester/">Systems
Optimization</a> in the <a href="https://www.tu-ilmenau.de/">TU Ilmenau</a>
<br>
Developed by <a href="https://elc.github.io">Ezequiel Leonardo Castaño</a>
</p>
</footer>
</body>
</html>