Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0198ca9

Browse files
committed
updated code and examples
1 parent 7e76a31 commit 0198ca9

File tree

2 files changed

+244
-99
lines changed

2 files changed

+244
-99
lines changed

‎notebooks/SimpleFeedForwardNetwork.ipynb‎

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
},
5959
{
6060
"cell_type": "code",
61-
"execution_count": 9,
61+
"execution_count": 7,
6262
"metadata": {},
6363
"outputs": [
6464
{
@@ -83,21 +83,21 @@
8383
},
8484
{
8585
"cell_type": "code",
86-
"execution_count": 10,
86+
"execution_count": 8,
8787
"metadata": {},
8888
"outputs": [
8989
{
9090
"data": {
9191
"text/plain": [
92-
"array([[0.50500969, 0.61216835, 0.97560639, 0.40014872, 0.52546529],\n",
93-
" [0.75370475, 0.29997896, 0.04612736, 0.55810029, 0.09418851],\n",
94-
" [0.45652967, 0.73751977, 0.6362012 , 0.71395926, 0.6058033 ],\n",
95-
" [0.09339971, 0.75861677, 0.42965112, 0.63466228, 0.61543066],\n",
96-
" [0.70792968, 0.86335131, 0.344358 , 0.5734288 , 0.29693733],\n",
97-
" [0.52017696, 0.05920029, 0.60644483, 0.27791372, 0.98732493]])"
92+
"array([[0.8619727 , 0.58781623, 0.08192724, 0.32024874, 0.37586709],\n",
93+
" [0.53599043, 0.65137649, 0.26528275, 0.95910965, 0.25807033],\n",
94+
" [0.59982028, 0.05620878, 0.39362914, 0.35532813, 0.46986993],\n",
95+
" [0.91292256, 0.80483918, 0.86397291, 0.685994 , 0.34818464],\n",
96+
" [0.53730966, 0.10045434, 0.69879575, 0.67768112, 0.96681444],\n",
97+
" [0.03872422, 0.76156201, 0.75984532, 0.6103069 , 0.43399413]])"
9898
]
9999
},
100-
"execution_count": 10,
100+
"execution_count": 8,
101101
"metadata": {},
102102
"output_type": "execute_result"
103103
}
@@ -108,16 +108,16 @@
108108
},
109109
{
110110
"cell_type": "code",
111-
"execution_count": 11,
111+
"execution_count": 9,
112112
"metadata": {},
113113
"outputs": [
114114
{
115115
"data": {
116116
"text/plain": [
117-
"array([0.60459173, 0.05570785, 0.58536412, 0.84748354, 0.70080312])"
117+
"array([0.98591156, 0.20060554, 0.71763632, 0.70060456, 0.07488563])"
118118
]
119119
},
120-
"execution_count": 11,
120+
"execution_count": 9,
121121
"metadata": {},
122122
"output_type": "execute_result"
123123
}
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"cell_type": "code",
131-
"execution_count": 12,
131+
"execution_count": 10,
132132
"metadata": {},
133133
"outputs": [],
134134
"source": [
@@ -137,14 +137,14 @@
137137
},
138138
{
139139
"cell_type": "code",
140-
"execution_count": 13,
140+
"execution_count": 11,
141141
"metadata": {},
142142
"outputs": [
143143
{
144144
"name": "stdout",
145145
"output_type": "stream",
146146
"text": [
147-
"[[14.05765941 14.51765422 13.67928118 14.73719912 16.22756423]]\n"
147+
"[[14.7766497 13.51305862 17.08341187 17.40794855 14.06007926]]\n"
148148
]
149149
}
150150
],
@@ -154,26 +154,26 @@
154154
},
155155
{
156156
"cell_type": "code",
157-
"execution_count": 14,
157+
"execution_count": null,
158158
"metadata": {},
159159
"outputs": [],
160160
"source": [
161161
"def relu(x):\n",
162-
" return np.maximum(0,x)"
162+
" return np.maximum(0.0,x)"
163163
]
164164
},
165165
{
166166
"cell_type": "code",
167-
"execution_count": 15,
167+
"execution_count": 14,
168168
"metadata": {},
169169
"outputs": [
170170
{
171171
"data": {
172172
"text/plain": [
173-
"array([[14.05765941, 14.51765422, 13.67928118, 14.73719912, 16.22756423]])"
173+
"array([[14.7766497 , 13.51305862, 17.08341187, 17.40794855, 14.06007926]])"
174174
]
175175
},
176-
"execution_count": 15,
176+
"execution_count": 14,
177177
"metadata": {},
178178
"output_type": "execute_result"
179179
}
@@ -185,7 +185,7 @@
185185
},
186186
{
187187
"cell_type": "code",
188-
"execution_count": 16,
188+
"execution_count": 15,
189189
"metadata": {},
190190
"outputs": [],
191191
"source": [
@@ -194,20 +194,20 @@
194194
},
195195
{
196196
"cell_type": "code",
197-
"execution_count": 17,
197+
"execution_count": 16,
198198
"metadata": {},
199199
"outputs": [
200200
{
201201
"data": {
202202
"text/plain": [
203-
"array([[0.21410325],\n",
204-
" [0.93751543],\n",
205-
" [0.16085734],\n",
206-
" [0.1212611 ],\n",
207-
" [0.92247533]])"
203+
"array([[0.62690381],\n",
204+
" [0.35202677],\n",
205+
" [0.69657002],\n",
206+
" [0.70607078],\n",
207+
" [0.27014452]])"
208208
]
209209
},
210-
"execution_count": 17,
210+
"execution_count": 16,
211211
"metadata": {},
212212
"output_type": "execute_result"
213213
}
@@ -218,7 +218,7 @@
218218
},
219219
{
220220
"cell_type": "code",
221-
"execution_count": null,
221+
"execution_count": 17,
222222
"metadata": {},
223223
"outputs": [],
224224
"source": [
@@ -228,7 +228,7 @@
228228
},
229229
{
230230
"cell_type": "code",
231-
"execution_count": 5,
231+
"execution_count": 18,
232232
"metadata": {},
233233
"outputs": [
234234
{
@@ -247,13 +247,23 @@
247247
},
248248
{
249249
"cell_type": "code",
250-
"execution_count": null,
250+
"execution_count": 21,
251251
"metadata": {},
252-
"outputs": [],
252+
"outputs": [
253+
{
254+
"name": "stdout",
255+
"output_type": "stream",
256+
"text": [
257+
"[[42.0097863]]\n",
258+
"1.0\n"
259+
]
260+
}
261+
],
253262
"source": [
254263
"z2 = a @ U\n",
255264
"print(z2)\n",
256-
"sigmoid(z2[0][0])"
265+
"sigmoid(z2[0][0])\n",
266+
"print(sigmoid(z2.item()))"
257267
]
258268
},
259269
{
@@ -265,7 +275,7 @@
265275
},
266276
{
267277
"cell_type": "code",
268-
"execution_count": 1,
278+
"execution_count": 22,
269279
"metadata": {},
270280
"outputs": [],
271281
"source": [
@@ -296,7 +306,7 @@
296306
},
297307
{
298308
"cell_type": "code",
299-
"execution_count": 3,
309+
"execution_count": 23,
300310
"metadata": {},
301311
"outputs": [],
302312
"source": [
@@ -311,7 +321,7 @@
311321
},
312322
{
313323
"cell_type": "code",
314-
"execution_count": 4,
324+
"execution_count": 24,
315325
"metadata": {},
316326
"outputs": [
317327
{
@@ -343,7 +353,7 @@
343353
},
344354
{
345355
"cell_type": "code",
346-
"execution_count": 5,
356+
"execution_count": 25,
347357
"metadata": {},
348358
"outputs": [],
349359
"source": [
@@ -355,7 +365,7 @@
355365
},
356366
{
357367
"cell_type": "code",
358-
"execution_count": 75,
368+
"execution_count": 26,
359369
"metadata": {},
360370
"outputs": [
361371
{
@@ -379,7 +389,7 @@
379389
},
380390
{
381391
"cell_type": "code",
382-
"execution_count": 6,
392+
"execution_count": 27,
383393
"metadata": {},
384394
"outputs": [],
385395
"source": [
@@ -395,7 +405,7 @@
395405
},
396406
{
397407
"cell_type": "code",
398-
"execution_count": 7,
408+
"execution_count": 28,
399409
"metadata": {},
400410
"outputs": [],
401411
"source": [
@@ -428,7 +438,7 @@
428438
},
429439
{
430440
"cell_type": "code",
431-
"execution_count": 8,
441+
"execution_count": 29,
432442
"metadata": {},
433443
"outputs": [],
434444
"source": [
@@ -437,7 +447,7 @@
437447
},
438448
{
439449
"cell_type": "code",
440-
"execution_count": 9,
450+
"execution_count": 30,
441451
"metadata": {},
442452
"outputs": [
443453
{
@@ -449,15 +459,15 @@
449459
" [\"This is an example of why the majority of action films are the same. Generic and boring, there's really nothing worth watching here. A complete waste of the then barely-tapped talents of Ice-T and Ice Cube, who've each proven many times over that they are capable of acting, and acting well. Don't bother with this one, go see New Jack City, Ricochet or watch New York Undercover for Ice-T, or Boyz n the Hood, Higher Learning or Friday for Ice Cube and see the real deal. Ice-T's horribly cliched dialogue alone makes this film grate at the teeth, and I'm still wondering what the heck Bill Paxton was doing in this film? And why the heck does he always play the exact same character? From Aliens onward, every film I've seen with Bill Paxton has him playing the exact same irritating character, and at least in Aliens his character died, which made it somewhat gratifying... Overall, this is second-rate action trash. There are countless better films to see, and if you really want to see this one, watch Judgement Night, which is practically a carbon copy but has better acting and a better script. The only thing that made this at all worth watching was a decent hand on the camera - the cinematography was almost refreshing, which comes close to making up for the horrible film itself - but not quite. 4/10.\", 0] \n",
450460
" This is an example of why the majority of action films are the same. Generic and boring, there's really nothing worth watching here. A complete waste of the then barely-tapped talents of Ice-T and Ice Cube, who've each proven many times over that they are capable of acting, and acting well. Don't bother with this one, go see New Jack City, Ricochet or watch New York Undercover for Ice-T, or Boyz n the Hood, Higher Learning or Friday for Ice Cube and see the real deal. Ice-T's horribly cliched dialogue alone makes this film grate at the teeth, and I'm still wondering what the heck Bill Paxton was doing in this film? And why the heck does he always play the exact same character? From Aliens onward, every film I've seen with Bill Paxton has him playing the exact same irritating character, and at least in Aliens his character died, which made it somewhat gratifying... Overall, this is second-rate action trash. There are countless better films to see, and if you really want to see this one, watch Judgement Night, which is practically a carbon copy but has better acting and a better script. The only thing that made this at all worth watching was a decent hand on the camera - the cinematography was almost refreshing, which comes close to making up for the horrible film itself - but not quite. 4/10. \n",
451461
" 0\n",
452-
"[0 0 0 ... 1 1 1]\n",
462+
"[0. 0. 0. ... 1. 1. 1.]\n",
453463
"50000\n"
454464
]
455465
}
456466
],
457467
"source": [
458468
"print(len(x), len(x[0]))\n",
459469
"print(x[1], \"\\n\", experiment_data[1], \"\\n\", experiment_data[1][0], \"\\n\", experiment_data[1][1])\n",
460-
"y = np.array([ e[1] for e in experiment_data ])\n",
470+
"y = np.array([ float(e[1]) for e in experiment_data ])\n",
461471
"print(y)\n",
462472
"print(len(y))"
463473
]
@@ -688,7 +698,7 @@
688698
"name": "python",
689699
"nbconvert_exporter": "python",
690700
"pygments_lexer": "ipython3",
691-
"version": "3.13.7"
701+
"version": "3.12.3"
692702
}
693703
},
694704
"nbformat": 4,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /