Skip to content

Commit 9f2e270

Browse files
committed
add clarity to solution code
1 parent f7eab40 commit 9f2e270

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

intro-neural-networks/gradient-descent/GradientDescent.ipynb

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -200,29 +200,11 @@
200200
"source": [
201201
"train(X, y, epochs, learnrate, True)"
202202
]
203-
},
204-
{
205-
"cell_type": "code",
206-
"execution_count": null,
207-
"metadata": {
208-
"collapsed": true
209-
},
210-
"outputs": [],
211-
"source": []
212-
},
213-
{
214-
"cell_type": "code",
215-
"execution_count": null,
216-
"metadata": {
217-
"collapsed": true
218-
},
219-
"outputs": [],
220-
"source": []
221203
}
222204
],
223205
"metadata": {
224206
"kernelspec": {
225-
"display_name": "Python 3",
207+
"display_name": "Python [default]",
226208
"language": "python",
227209
"name": "python3"
228210
},
@@ -236,7 +218,7 @@
236218
"name": "python",
237219
"nbconvert_exporter": "python",
238220
"pygments_lexer": "ipython3",
239-
"version": "3.6.1"
221+
"version": "3.6.4"
240222
}
241223
},
242224
"nbformat": 4,

intro-neural-networks/gradient-descent/GradientDescentSolutions.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
"\n",
2828
"def update_weights(x, y, weights, bias, learnrate):\n",
2929
" output = output_formula(x, weights, bias)\n",
30-
" d_error = -(y - output)\n",
31-
" weights -= learnrate * d_error * x\n",
32-
" bias -= learnrate * d_error\n",
30+
" d_error = y - output\n",
31+
" weights += learnrate * d_error * x\n",
32+
" bias += learnrate * d_error\n",
3333
" return weights, bias"
3434
]
3535
}
3636
],
3737
"metadata": {
3838
"kernelspec": {
39-
"display_name": "Python 3",
39+
"display_name": "Python [default]",
4040
"language": "python",
4141
"name": "python3"
4242
},
@@ -50,7 +50,7 @@
5050
"name": "python",
5151
"nbconvert_exporter": "python",
5252
"pygments_lexer": "ipython3",
53-
"version": "3.6.1"
53+
"version": "3.6.4"
5454
}
5555
},
5656
"nbformat": 4,

0 commit comments

Comments
 (0)