Skip to content

Commit

Permalink
Change wording in learning rate starting point explanation to reflect…
Browse files Browse the repository at this point in the history
… project update
  • Loading branch information
Luke Rucks committed Aug 15, 2017
1 parent 8d5a1a4 commit 55fcbcc
Showing 1 changed file with 13 additions and 37 deletions.
50 changes: 13 additions & 37 deletions first-neural-network/Your_first_neural_network.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
Expand All @@ -38,9 +36,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"data_path = 'Bike-Sharing-Dataset/hour.csv'\n",
Expand All @@ -51,9 +47,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"rides.head()"
Expand All @@ -73,9 +67,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"rides[:24*10].plot(x='dteday', y='cnt')"
Expand All @@ -92,9 +84,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"dummy_fields = ['season', 'weathersit', 'mnth', 'hr', 'weekday']\n",
Expand All @@ -121,9 +111,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"quant_features = ['casual', 'registered', 'cnt', 'temp', 'hum', 'windspeed']\n",
Expand All @@ -147,9 +135,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# Save data for approximately the last 21 days \n",
Expand All @@ -174,9 +160,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# Hold out the last 60 days or so of the remaining data as a validation set\n",
Expand Down Expand Up @@ -336,9 +320,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import unittest\n",
Expand Down Expand Up @@ -415,7 +397,7 @@
"This is the number of batches of samples from the training data we'll use to train the network. The more iterations you use, the better the model will fit the data. However, if you use too many iterations, then the model with not generalize well to other data, this is called overfitting. You want to find a number here where the network has a low training loss, and the validation loss is at a minimum. As you start overfitting, you'll see the training loss continue to decrease while the validation loss starts to increase.\n",
"\n",
"### Choose the learning rate\n",
"This scales the size of weight updates. If this is too big, the weights tend to explode and the network fails to fit the data. A good choice to start at is 0.1. If the network has problems fitting the data, try reducing the learning rate. Note that the lower the learning rate, the smaller the steps are in the weight updates and the longer it takes for the neural network to converge.\n",
"This scales the size of weight updates. If this is too big, the weights tend to explode and the network fails to fit the data. Normally a good choice to start at is 0.1; however, if you effectively divide the learning rate by n_records, try starting out with a learning rate of 1. In either case, if the network has problems fitting the data, try reducing the learning rate. Note that the lower the learning rate, the smaller the steps are in the weight updates and the longer it takes for the neural network to converge.\n",
"\n",
"### Choose the number of hidden nodes\n",
"The more hidden nodes you have, the more accurate predictions the model will make. Try a few different numbers and see how it affects the performance. You can look at the losses dictionary for a metric of the network performance. If the number of hidden units is too low, then the model won't have enough space to learn and if it is too high there are too many options for the direction that the learning can take. The trick here is to find the right balance in number of hidden units you choose."
Expand All @@ -424,9 +406,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand Down Expand Up @@ -463,9 +443,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.plot(losses['train'], label='Training loss')\n",
Expand All @@ -486,9 +464,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(8,4))\n",
Expand Down

0 comments on commit 55fcbcc

Please sign in to comment.