Skip to content

Commit

Permalink
Moved line with "from __future__ import" instruction to the top of ea…
Browse files Browse the repository at this point in the history
…ch notebook

Moved line with "from __future__ import" instruction to the top of each notebook where it was not already correctly positioned.
  • Loading branch information
roebius committed May 2, 2017
1 parent 11c967b commit e5453db
Show file tree
Hide file tree
Showing 11 changed files with 445 additions and 50 deletions.
4 changes: 2 additions & 2 deletions nbs/char-rnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
}
],
"source": [
"from __future__ import division, print_function\n",
"%matplotlib inline\n",
"from importlib import reload # Python 3\n",
"import utils; reload(utils)\n",
"from utils import *\n",
"from __future__ import division, print_function"
"from utils import *"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions nbs/convolution-intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"outputs": [],
"source": [
"from __future__ import division, print_function\n",
"%matplotlib inline\n",
"import math,sys,os,numpy as np\n",
"from numpy.linalg import norm\n",
Expand Down
12 changes: 9 additions & 3 deletions nbs/dogs_cats_redux.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
}
],
"source": [
"from __future__ import division, print_function\n",
"\n",
"#Verify we are in the lesson1 directory\n",
"%pwd"
]
Expand Down Expand Up @@ -634,7 +636,9 @@
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from keras.preprocessing import image\n",
Expand Down Expand Up @@ -1042,7 +1046,9 @@
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#So to play it safe, we use a sneaky trick to round down our edge predictions\n",
Expand Down Expand Up @@ -1178,7 +1184,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
"version": "3.5.2"
},
"nav_menu": {},
"nbpresent": {
Expand Down
323 changes: 312 additions & 11 deletions nbs/dogscats-ensemble.ipynb

Large diffs are not rendered by default.

63 changes: 47 additions & 16 deletions nbs/imagenet_batchnorm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from __future__ import division, print_function\n",
"%matplotlib inline\n",
"from importlib import reload\n",
"import utils; reload(utils)\n",
"from utils import *\n",
"from __future__ import print_function, division"
"from utils import *"
]
},
{
Expand Down Expand Up @@ -101,7 +103,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# %pushd data/imagenet\n",
Expand Down Expand Up @@ -146,6 +150,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"scrolled": true
},
"outputs": [],
Expand Down Expand Up @@ -173,7 +178,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%popd"
Expand Down Expand Up @@ -225,7 +232,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"samp_trn = get_data(sample_path+'train')\n",
Expand Down Expand Up @@ -260,6 +269,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"scrolled": true
},
"outputs": [],
Expand All @@ -271,7 +281,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"(samp_val_classes, samp_trn_classes, samp_val_labels, samp_trn_labels, \n",
Expand Down Expand Up @@ -381,6 +393,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"scrolled": true
},
"outputs": [],
Expand Down Expand Up @@ -478,7 +491,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"dense_model.evaluate(samp_conv_val_feat, samp_val_labels)"
Expand All @@ -498,7 +513,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# should be identical to above\n",
Expand All @@ -508,7 +525,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# should be a little better than above, since VGG authors overfit\n",
Expand Down Expand Up @@ -639,7 +658,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"bn_model = insert_layer(dense_model, nl2, 5)\n",
Expand Down Expand Up @@ -698,7 +719,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"bn_model.evaluate(samp_conv_val_feat, samp_val_labels)"
Expand All @@ -707,7 +730,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"bn_model.evaluate(samp_conv_feat, samp_trn_labels)"
Expand All @@ -730,7 +755,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"feat_bc = bcolz.open(fast_path+'trn_features.dat')"
Expand Down Expand Up @@ -829,7 +856,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"new_layers = copy_layers(bn_model.layers)\n",
Expand Down Expand Up @@ -862,7 +891,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"conv_model.evaluate(samp_val, samp_val_labels)"
Expand Down
4 changes: 2 additions & 2 deletions nbs/lesson1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
},
"outputs": [],
"source": [
"from __future__ import division, print_function\n",
"\n",
"%matplotlib inline"
]
},
Expand Down Expand Up @@ -89,8 +91,6 @@
},
"outputs": [],
"source": [
"from __future__ import division,print_function\n",
"\n",
"import os, json\n",
"from glob import glob\n",
"import numpy as np\n",
Expand Down
4 changes: 1 addition & 3 deletions nbs/lesson2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
],
"source": [
"from __future__ import division, print_function\n",
"# Rather than importing everything manually, we'll make things easy\n",
"# and load them all in utils.py, and just import them from there.\n",
"%matplotlib inline\n",
Expand Down Expand Up @@ -68,8 +69,6 @@
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"from __future__ import division,print_function\n",
"import os, json\n",
"from glob import glob\n",
"import numpy as np\n",
Expand All @@ -78,7 +77,6 @@
"from sklearn.metrics import confusion_matrix\n",
"np.set_printoptions(precision=4, linewidth=100)\n",
"from matplotlib import pyplot as plt\n",
"import utils; reload(utils)\n",
"from utils import plots, get_batches, plot_confusion_matrix, get_data"
]
},
Expand Down
1 change: 1 addition & 0 deletions nbs/lesson3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
],
"source": [
"from __future__ import division, print_function\n",
"%matplotlib inline\n",
"from importlib import reload # Python 3\n",
"import utils; reload(utils)\n",
Expand Down
4 changes: 2 additions & 2 deletions nbs/lesson6.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
}
],
"source": [
"from __future__ import division, print_function\n",
"%matplotlib inline\n",
"from importlib import reload # Python 3\n",
"import utils; reload(utils)\n",
"from utils import *\n",
"from __future__ import division, print_function"
"from utils import *"
]
},
{
Expand Down
Loading

0 comments on commit e5453db

Please sign in to comment.