-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguess.html
More file actions
219 lines (183 loc) · 5.31 KB
/
guess.html
File metadata and controls
219 lines (183 loc) · 5.31 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>MNIST Interactive Demo</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: system-ui, -apple-system, sans-serif;
padding: 24px;
background: #f5f6f8;
color: #2d3748;
line-height: 1.6;
}
h1 {
color: #1a202c;
font-weight: 600;
margin-bottom: 24px;
}
h3 {
color: #2d3748;
font-weight: 600;
margin: 0 0 12px 0;
}
p {
color: #4a5568;
margin: 8px 0;
}
.section {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 8px;
padding: 24px;
margin-bottom: 24px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.section h3 {
border-bottom: 2px solid #e2e8f0;
padding-bottom: 12px;
margin-bottom: 16px;
}
#summary {
background: #edf2f7;
border-left: 4px solid #4a5568;
}
#row-container {
background: #fff;
}
#row {
display: flex;
align-items: center;
gap: 30px;
padding: 16px 0;
}
#layers-container {
background: #fafbfc;
width: fit-content;
min-width: 100%;
}
#layers-container .description {
color: #718096;
font-size: 0.9em;
}
#parameters-container {
background: #fff;
width: fit-content;
min-width: 100%;
}
.probability {
display: flex;
flex-direction: row;
align-items: center;
gap: 12px;
padding: 4px 0;
}
.probability input[type="range"] {
accent-color: #4a5568;
}
.layers {
display: flex;
flex-direction: column;
align-items: center;
}
.parameter-image {
display: flex;
flex-direction: column;
align-items: flex-start;
}
button {
background: #4a5568;
color: #fff;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
}
button:hover {
background: #2d3748;
}
canvas {
border-radius: 4px;
}
/* Mobile responsive styles */
@media (max-width: 600px) {
body {
padding: 12px;
}
h1 {
font-size: 1.5rem;
margin-bottom: 16px;
}
h3 {
font-size: 1.1rem;
}
.section {
padding: 16px;
margin-bottom: 16px;
}
#summary p {
font-size: 0.9em;
}
#row {
flex-direction: column;
align-items: flex-start;
gap: 20px;
}
.probability {
gap: 8px;
}
.probability input[type="range"] {
width: 120px;
}
#layers-container,
#parameters-container {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
#layers-container .description p,
#parameters-container .description {
font-size: 0.85em;
}
button {
padding: 10px 20px;
}
}
@media (max-width: 400px) {
.probability input[type="range"] {
width: 80px;
}
}
</style>
</head>
<body>
<h1>MNIST Interactive Demo</h1>
<div id="summary" class="section">
<h3>About This Model</h3>
<p>This model has been trained on the MNIST dataset with an accuracy of roughly 97.5% (250 prediction errors out of 10,000 test images).</p>
<p>Architecture: Multi-layer perceptron [ Dense [784 → 128], ReLU, Dense [128 → 10] ]</p>
<p>Weight initialization: He uniform distribution. Optimizer: Stochastic Gradient Descent (no momentum).</p>
<p>Trained entirely in-browser using WebGPU compute shaders.</p>
<p class="description">Note: Your handwriting may differ from the MNIST training data, which could affect recognition accuracy.</p>
</div>
<div id="row-container" class="section">
<h3>Draw a Digit</h3>
<div id="row"></div>
</div>
<div id="layers-container" class="section">
<h3>Layer Activations</h3>
<div class="description">
<p>Visualizes data flowing through each layer as you draw. All layers are fully connected (784 → 128 → 128 → 10 neurons).</p>
</div>
<div id="layers"></div>
</div>
<div id="parameters-container" class="section">
<h3>Learned Parameters</h3>
<p class="description">Weight and bias matrices from the pre-trained model, normalized to 0–1 range for visualization.</p>
</div>
<script type="module" src="/src/MNIST/interactive/guess.ts"></script>
</body>
</html>