From 353f7c17222480fdf1ca052a24f39f45d3481d89 Mon Sep 17 00:00:00 2001 From: Wang Date: Fri, 17 Feb 2017 14:06:39 -0800 Subject: [PATCH 1/8] Clean notebooks --- python/basic/advanced_img_io.ipynb | 9 ++++++--- python/basic/image_io.ipynb | 11 ++++++----- python/basic/mixed.ipynb | 4 ++-- python/basic/ndarray.ipynb | 8 ++++++-- python/basic/record_io.ipynb | 11 ++++++----- python/basic/symbol.ipynb | 8 ++++---- python/how_to/predict.ipynb | 16 ++++++++-------- python/tutorials/linear-regression.ipynb | 11 ++++++++--- python/tutorials/predict_imagenet.ipynb | 17 +++++++++-------- 9 files changed, 55 insertions(+), 40 deletions(-) diff --git a/python/basic/advanced_img_io.ipynb b/python/basic/advanced_img_io.ipynb index ac9405a4c..e504a29bc 100644 --- a/python/basic/advanced_img_io.ipynb +++ b/python/basic/advanced_img_io.ipynb @@ -31,10 +31,10 @@ "import time\n", "# set the number of threads you want to use before importing mxnet\n", "os.environ['MXNET_CPU_WORKER_NTHREADS'] = '4'\n", - "import mxnet as mx\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", - "import cv2" + "import cv2\n", + "import mxnet as mx" ] }, { @@ -97,6 +97,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "# opencv\n", "N = 1000\n", "tic = time.time()\n", @@ -133,6 +134,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "# mx.image\n", "tic = time.time()\n", "for i in range(N):\n", @@ -258,8 +260,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, diff --git a/python/basic/image_io.ipynb b/python/basic/image_io.ipynb index ffdb867a5..16b9dfd3b 100644 --- a/python/basic/image_io.ipynb +++ b/python/basic/image_io.ipynb @@ -37,12 +37,12 @@ "%matplotlib inline\n", "import os\n", "import subprocess\n", - "import mxnet as mx\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", + "import mxnet as mx\n", "\n", "# change this to your mxnet location\n", - "MXNET_HOME = '/scratch/mxnet'" + "MXNET_HOME = '/mxnet'" ] }, { @@ -165,7 +165,7 @@ ], "source": [ "data_iter = mx.io.ImageRecordIter(\n", - " path_imgrec=\"./data/caltech_train.rec\", # the target record file\n", + " path_imgrec=\"./data/caltech.rec\", # the target record file\n", " data_shape=(3, 227, 227), # output data shape. An 227x227 region will be cropped from the original image.\n", " batch_size=4, # number of samples per batch\n", " resize=256 # resize the shorter edge to 256 before cropping\n", @@ -202,8 +202,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -217,7 +218,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/python/basic/mixed.ipynb b/python/basic/mixed.ipynb index cd6f35c7c..a60e7f07b 100644 --- a/python/basic/mixed.ipynb +++ b/python/basic/mixed.ipynb @@ -823,7 +823,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -837,7 +837,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/python/basic/ndarray.ipynb b/python/basic/ndarray.ipynb index 50cd76a81..e1a3f0135 100644 --- a/python/basic/ndarray.ipynb +++ b/python/basic/ndarray.ipynb @@ -765,6 +765,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "def f():\n", " a = mx.nd.ones((100,100))\n", " b = mx.nd.ones((100,100))\n", @@ -833,6 +834,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "a = mx.nd.ones((100,100), mx.cpu())\n", "b = mx.nd.ones((100,100), mx.gpu())\n", "c = mx.nd.ones((100,100), mx.gpu())\n", @@ -907,6 +909,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "a = mx.nd.ones((2,3))\n", "b = mx.nd.ones((5,6)) \n", "mx.nd.save(\"temp.ndarray\", [a,b])\n", @@ -940,6 +943,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "d = {'a':a, 'b':b}\n", "mx.nd.save(\"temp.ndarray\", d)\n", "c = mx.nd.load(\"temp.ndarray\")\n", @@ -1123,7 +1127,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -1137,7 +1141,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/python/basic/record_io.ipynb b/python/basic/record_io.ipynb index 957f58a4e..612a117d8 100644 --- a/python/basic/record_io.ipynb +++ b/python/basic/record_io.ipynb @@ -21,9 +21,9 @@ "source": [ "%matplotlib inline\n", "from __future__ import print_function\n", - "import mxnet as mx\n", "import numpy as np\n", - "import matplotlib.pyplot as plt" + "import matplotlib.pyplot as plt\n", + "import mxnet as mx" ] }, { @@ -82,7 +82,7 @@ " item = record.read()\n", " if not item:\n", " break\n", - " print item\n", + " print (item)\n", "record.close()" ] }, @@ -306,8 +306,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -321,7 +322,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/python/basic/symbol.ipynb b/python/basic/symbol.ipynb index bf2396a85..3d3c83e49 100644 --- a/python/basic/symbol.ipynb +++ b/python/basic/symbol.ipynb @@ -271,7 +271,7 @@ } ], "source": [ - "# Output may vary\n", + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "net = mx.sym.Variable('data')\n", "net = mx.sym.FullyConnected(data=net, name='fc1', num_hidden=128)\n", "net = mx.sym.Activation(data=net, name='relu1', act_type=\"relu\")\n", @@ -402,7 +402,7 @@ } ], "source": [ - "# Output may vary\n", + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "def ConvFactory(data, num_filter, kernel, stride=(1,1), pad=(0, 0), name=None, suffix=''):\n", " conv = mx.symbol.Convolution(data=data, num_filter=num_filter, kernel=kernel, stride=stride, pad=pad, name='conv_%s%s' %(name, suffix))\n", " bn = mx.symbol.BatchNorm(data=conv, name='bn_%s%s' %(name, suffix))\n", @@ -1480,7 +1480,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -1494,7 +1494,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/python/how_to/predict.ipynb b/python/how_to/predict.ipynb index 9d0e01d9d..7663c0790 100644 --- a/python/how_to/predict.ipynb +++ b/python/how_to/predict.ipynb @@ -25,6 +25,11 @@ "outputs": [], "source": [ "import os, urllib\n", + "%matplotlib inline\n", + "import matplotlib\n", + "matplotlib.rc(\"savefig\", dpi=100)\n", + "import matplotlib.pyplot as plt\n", + "import cv2\n", "def download(url):\n", " filename = url.split(\"/\")[-1]\n", " if not os.path.exists(filename):\n", @@ -3500,11 +3505,6 @@ } ], "source": [ - "%matplotlib inline\n", - "import matplotlib\n", - "matplotlib.rc(\"savefig\", dpi=100)\n", - "import matplotlib.pyplot as plt\n", - "import cv2\n", "for i in range(0,8):\n", " img = cv2.cvtColor(cv2.imread('val_1000/%d.jpg' % (i,)), cv2.COLOR_BGR2RGB)\n", " plt.subplot(2,4,i+1)\n", @@ -3531,7 +3531,6 @@ "outputs": [], "source": [ "import numpy as np\n", - "import cv2\n", "def get_image(filename):\n", " img = cv2.imread(filename) # read image in b,g,r order\n", " img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # change to r,g,b order\n", @@ -3768,8 +3767,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -3783,7 +3783,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/python/tutorials/linear-regression.ipynb b/python/tutorials/linear-regression.ipynb index 343964dcb..37389da55 100644 --- a/python/tutorials/linear-regression.ipynb +++ b/python/tutorials/linear-regression.ipynb @@ -356,9 +356,11 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "#Evaluation\n", "metric = mx.metric.MSE()\n", - "model.score(eval_iter, metric)" + "model.score(eval_iter, metric)\n", + "assert model.score(eval_iter, metric)[0][1] < 0.001, \"High mean squared error on evaluation data.\"" ] }, { @@ -389,12 +391,14 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "#Evaluation Data\n", "eval_data = np.array([[7,2],[6,10],[12,2]])\n", "eval_label = np.array([11.1,26.1,16.1]) #Adding 0.1 to each of the values \n", "eval_iter = mx.io.NDArrayIter(eval_data, eval_label, batch_size, shuffle=False)\n", "\n", - "model.score(eval_iter, metric)" + "model.score(eval_iter, metric)\n", + "assert model.score(eval_iter, metric)[0][1] < 0.02, \"High mean squared error on evaluation data with noise.\"" ] }, { @@ -415,8 +419,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, diff --git a/python/tutorials/predict_imagenet.ipynb b/python/tutorials/predict_imagenet.ipynb index 68baafe5d..cf6f33a6f 100644 --- a/python/tutorials/predict_imagenet.ipynb +++ b/python/tutorials/predict_imagenet.ipynb @@ -20,6 +20,12 @@ "outputs": [], "source": [ "import os, urllib\n", + "%matplotlib inline\n", + "import matplotlib\n", + "matplotlib.rc(\"savefig\", dpi=100)\n", + "import matplotlib.pyplot as plt\n", + "import cv2\n", + "import numpy as np\n", "import mxnet as mx\n", "def download(url,prefix=''):\n", " filename = prefix+url.split(\"/\")[-1]\n", @@ -72,12 +78,6 @@ }, "outputs": [], "source": [ - "%matplotlib inline\n", - "import matplotlib\n", - "matplotlib.rc(\"savefig\", dpi=100)\n", - "import matplotlib.pyplot as plt\n", - "import cv2\n", - "import numpy as np\n", "from collections import namedtuple\n", "Batch = namedtuple('Batch', ['data'])\n", "\n", @@ -188,8 +188,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -203,7 +204,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, From 14747136255c25306f63cdbbc24d862bea0cd4ff Mon Sep 17 00:00:00 2001 From: Wang Date: Fri, 17 Feb 2017 14:28:04 -0800 Subject: [PATCH 2/8] Ignore some cells --- python/basic/advanced_img_io.ipynb | 1 + python/cnn/mnist.ipynb | 30 +++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/python/basic/advanced_img_io.ipynb b/python/basic/advanced_img_io.ipynb index e504a29bc..ad6e35e9d 100644 --- a/python/basic/advanced_img_io.ipynb +++ b/python/basic/advanced_img_io.ipynb @@ -227,6 +227,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "# crop a random w x h region from image\n", "tmp, coord = mx.image.random_crop(img, (150, 200))\n", "print(coord)\n", diff --git a/python/cnn/mnist.ipynb b/python/cnn/mnist.ipynb index f1d4cca9d..0e4074fdd 100644 --- a/python/cnn/mnist.ipynb +++ b/python/cnn/mnist.ipynb @@ -374,6 +374,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "model = mx.model.FeedForward(\n", " ctx = mx.gpu(0), # Run on GPU 0\n", " symbol = mlp, # Use the network we just defined\n", @@ -384,7 +385,9 @@ "model.fit(\n", " X=train_iter, # Training data set\n", " eval_data=test_iter, # Testing data set. MXNet computes scores on test set every epoch\n", - " batch_end_callback = mx.callback.Speedometer(batch_size, 200)) # Logging module to print out progress" + " batch_end_callback = mx.callback.Speedometer(batch_size, 200)) # Logging module to print out progress\n", + "assert model.score(train_iter) > 0.98, \"Low training accuracy.\"\n", + "assert model.score(test_iter) > 0.97, \"Low validation accuracy.\"" ] }, { @@ -423,6 +426,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "plt.imshow((X_test[0].reshape((28,28))*255).astype(np.uint8), cmap='Greys_r')\n", "plt.show()\n", "print 'Result:', model.predict(X_test[0:1])[0].argmax()" @@ -452,7 +456,9 @@ } ], "source": [ - "print 'Accuracy:', model.score(test_iter)*100, '%'" + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", + "print 'Accuracy:', model.score(test_iter)*100, '%'\n", + "assert model.score(test_iter) > 0.97, \"Low prediction accuracy.\"" ] }, { @@ -489,6 +495,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "# run hand drawing test\n", "from IPython.display import HTML\n", "\n", @@ -574,6 +581,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "def norm_stat(d):\n", " \"\"\"The statistics you want to see.\n", " We compute the L2 norm here but you can change it to anything you like.\"\"\"\n", @@ -586,7 +594,9 @@ "model = mx.model.FeedForward(ctx = mx.gpu(0), symbol = mlp, num_epoch = 1,\n", " learning_rate = 0.1, momentum = 0.9, wd = 0.00001)\n", "model.fit(X=train_iter, eval_data=test_iter, monitor=mon, # Set the monitor here\n", - " batch_end_callback = mx.callback.Speedometer(100, 100))" + " batch_end_callback = mx.callback.Speedometer(100, 100))\n", + "assert model.score(train_iter) > 0.94, \"Low training accuracy.\"\n", + "assert model.score(test_iter) > 0.94, \"Low validation accuracy.\"" ] }, { @@ -676,6 +686,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "# ==================Binding=====================\n", "# The symbol we created is only a graph description.\n", "# To run it, we first need to allocate memory and create an executor by 'binding' it.\n", @@ -740,7 +751,8 @@ " metric.update(batch.label, exe.outputs)\n", " t += 1\n", " if t % 100 == 0:\n", - " print 'epoch:', epoch, 'iter:', t, 'metric:', metric.get()\n" + " print 'epoch:', epoch, 'iter:', t, 'metric:', metric.get()\n", + "assert metric.get()[1] > 0.98, \"Low training accuracy.\"" ] }, { @@ -786,6 +798,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "# Define custom softmax operator\n", "class NumpySoftmax(mx.operator.NumpyOp):\n", " def __init__(self):\n", @@ -840,7 +853,9 @@ "model = mx.model.FeedForward(ctx = mx.gpu(0), symbol = mlp, num_epoch = 2,\n", " learning_rate = 0.1, momentum = 0.9, wd = 0.00001)\n", "model.fit(X=train_iter, eval_data=test_iter,\n", - " batch_end_callback = mx.callback.Speedometer(100, 100))" + " batch_end_callback = mx.callback.Speedometer(100, 100))\n", + "assert model.score(train_iter) > 0.96, \"Low training accuracy.\"\n", + "assert model.score(test_iter) > 0.95, \"Low validation accuracy.\"" ] }, { @@ -856,8 +871,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -871,7 +887,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.6" + "version": "2.7.12" } }, "nbformat": 4, From dc46d8b8f7b9fa6f7c99d11e6971fd38d636bf5b Mon Sep 17 00:00:00 2001 From: Wang Date: Fri, 17 Feb 2017 15:20:53 -0800 Subject: [PATCH 3/8] Remove jupyter generated changes --- python/basic/advanced_img_io.ipynb | 3 +-- python/basic/image_io.ipynb | 5 ++--- python/basic/mixed.ipynb | 4 ++-- python/basic/ndarray.ipynb | 4 ++-- python/basic/record_io.ipynb | 5 ++--- python/basic/symbol.ipynb | 4 ++-- python/cnn/mnist.ipynb | 5 ++--- python/how_to/predict.ipynb | 5 ++--- python/tutorials/linear-regression.ipynb | 5 ++--- python/tutorials/predict_imagenet.ipynb | 5 ++--- 10 files changed, 19 insertions(+), 26 deletions(-) diff --git a/python/basic/advanced_img_io.ipynb b/python/basic/advanced_img_io.ipynb index ad6e35e9d..b9f1fbb65 100644 --- a/python/basic/advanced_img_io.ipynb +++ b/python/basic/advanced_img_io.ipynb @@ -261,9 +261,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, diff --git a/python/basic/image_io.ipynb b/python/basic/image_io.ipynb index 16b9dfd3b..d174cdc33 100644 --- a/python/basic/image_io.ipynb +++ b/python/basic/image_io.ipynb @@ -202,9 +202,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -218,7 +217,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/basic/mixed.ipynb b/python/basic/mixed.ipynb index a60e7f07b..6dd0e817e 100644 --- a/python/basic/mixed.ipynb +++ b/python/basic/mixed.ipynb @@ -823,7 +823,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -837,7 +837,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/basic/ndarray.ipynb b/python/basic/ndarray.ipynb index e1a3f0135..69d62cd83 100644 --- a/python/basic/ndarray.ipynb +++ b/python/basic/ndarray.ipynb @@ -1127,7 +1127,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -1141,7 +1141,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/basic/record_io.ipynb b/python/basic/record_io.ipynb index 612a117d8..aeab21b9f 100644 --- a/python/basic/record_io.ipynb +++ b/python/basic/record_io.ipynb @@ -306,9 +306,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -322,7 +321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/basic/symbol.ipynb b/python/basic/symbol.ipynb index 3d3c83e49..ada988d26 100644 --- a/python/basic/symbol.ipynb +++ b/python/basic/symbol.ipynb @@ -1480,7 +1480,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -1494,7 +1494,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/cnn/mnist.ipynb b/python/cnn/mnist.ipynb index 0e4074fdd..3c685a5b5 100644 --- a/python/cnn/mnist.ipynb +++ b/python/cnn/mnist.ipynb @@ -871,9 +871,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -887,7 +886,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/how_to/predict.ipynb b/python/how_to/predict.ipynb index 7663c0790..99c70e058 100644 --- a/python/how_to/predict.ipynb +++ b/python/how_to/predict.ipynb @@ -3767,9 +3767,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -3783,7 +3782,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/tutorials/linear-regression.ipynb b/python/tutorials/linear-regression.ipynb index 37389da55..4e1baaa34 100644 --- a/python/tutorials/linear-regression.ipynb +++ b/python/tutorials/linear-regression.ipynb @@ -419,9 +419,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -435,7 +434,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, diff --git a/python/tutorials/predict_imagenet.ipynb b/python/tutorials/predict_imagenet.ipynb index cf6f33a6f..50d894440 100644 --- a/python/tutorials/predict_imagenet.ipynb +++ b/python/tutorials/predict_imagenet.ipynb @@ -188,9 +188,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 2”, "language": "python", "name": "python2" }, @@ -204,7 +203,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": “2.7.6” } }, "nbformat": 4, From 9bf3304e898092b3d9616351d44ac1c9a64c8de3 Mon Sep 17 00:00:00 2001 From: Wang Date: Fri, 17 Feb 2017 18:23:46 -0800 Subject: [PATCH 4/8] Fix json format --- python/basic/advanced_img_io.ipynb | 4 ++-- python/basic/image_io.ipynb | 4 ++-- python/basic/mixed.ipynb | 5 ++--- python/basic/ndarray.ipynb | 5 ++--- python/basic/record_io.ipynb | 4 ++-- python/basic/symbol.ipynb | 3 +-- python/cnn/mnist.ipynb | 4 ++-- python/how_to/predict.ipynb | 4 ++-- python/tutorials/linear-regression.ipynb | 4 ++-- python/tutorials/predict_imagenet.ipynb | 4 ++-- 10 files changed, 19 insertions(+), 22 deletions(-) diff --git a/python/basic/advanced_img_io.ipynb b/python/basic/advanced_img_io.ipynb index b9f1fbb65..9b1ed42d8 100644 --- a/python/basic/advanced_img_io.ipynb +++ b/python/basic/advanced_img_io.ipynb @@ -262,7 +262,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -276,7 +276,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.12" + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/basic/image_io.ipynb b/python/basic/image_io.ipynb index d174cdc33..1d6aaa76c 100644 --- a/python/basic/image_io.ipynb +++ b/python/basic/image_io.ipynb @@ -203,7 +203,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -217,7 +217,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/basic/mixed.ipynb b/python/basic/mixed.ipynb index 6dd0e817e..f23c1b80a 100644 --- a/python/basic/mixed.ipynb +++ b/python/basic/mixed.ipynb @@ -821,9 +821,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -837,7 +836,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/basic/ndarray.ipynb b/python/basic/ndarray.ipynb index 69d62cd83..9d29a5524 100644 --- a/python/basic/ndarray.ipynb +++ b/python/basic/ndarray.ipynb @@ -1125,9 +1125,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -1141,7 +1140,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/basic/record_io.ipynb b/python/basic/record_io.ipynb index aeab21b9f..f923b18eb 100644 --- a/python/basic/record_io.ipynb +++ b/python/basic/record_io.ipynb @@ -307,7 +307,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -321,7 +321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/basic/symbol.ipynb b/python/basic/symbol.ipynb index ada988d26..52c792f50 100644 --- a/python/basic/symbol.ipynb +++ b/python/basic/symbol.ipynb @@ -1478,9 +1478,8 @@ } ], "metadata": { - "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, diff --git a/python/cnn/mnist.ipynb b/python/cnn/mnist.ipynb index 3c685a5b5..8b55aa365 100644 --- a/python/cnn/mnist.ipynb +++ b/python/cnn/mnist.ipynb @@ -872,7 +872,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -886,7 +886,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/how_to/predict.ipynb b/python/how_to/predict.ipynb index 99c70e058..e48a2e578 100644 --- a/python/how_to/predict.ipynb +++ b/python/how_to/predict.ipynb @@ -3768,7 +3768,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -3782,7 +3782,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/tutorials/linear-regression.ipynb b/python/tutorials/linear-regression.ipynb index 4e1baaa34..36a3c2277 100644 --- a/python/tutorials/linear-regression.ipynb +++ b/python/tutorials/linear-regression.ipynb @@ -420,7 +420,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -434,7 +434,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, diff --git a/python/tutorials/predict_imagenet.ipynb b/python/tutorials/predict_imagenet.ipynb index 50d894440..d561b63ec 100644 --- a/python/tutorials/predict_imagenet.ipynb +++ b/python/tutorials/predict_imagenet.ipynb @@ -189,7 +189,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2”, + "display_name": "Python 2", "language": "python", "name": "python2" }, @@ -203,7 +203,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": “2.7.6” + "version": "2.7.6" } }, "nbformat": 4, From 626dd15e8d8fff857f50a01f5ce2fc1d7bbcc584 Mon Sep 17 00:00:00 2001 From: Wang Date: Thu, 23 Feb 2017 20:15:19 -0800 Subject: [PATCH 5/8] Ignore cell in linear regression --- python/tutorials/linear-regression.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/python/tutorials/linear-regression.ipynb b/python/tutorials/linear-regression.ipynb index 36a3c2277..511bfdb9c 100644 --- a/python/tutorials/linear-regression.ipynb +++ b/python/tutorials/linear-regression.ipynb @@ -326,6 +326,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "#Inference\n", "model.predict(eval_iter).asnumpy()" ] From 6c998100a018aa3450b8ecb880e292dd6fd6b374 Mon Sep 17 00:00:00 2001 From: Wang Date: Fri, 3 Mar 2017 13:17:42 -0800 Subject: [PATCH 6/8] Add ignore for some cells --- python/tutorials/predict_imagenet.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/tutorials/predict_imagenet.ipynb b/python/tutorials/predict_imagenet.ipynb index d561b63ec..be9b82dbc 100644 --- a/python/tutorials/predict_imagenet.ipynb +++ b/python/tutorials/predict_imagenet.ipynb @@ -148,6 +148,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "url = 'http://writm.com/wp-content/uploads/2016/08/Cat-hd-wallpapers.jpg'\n", "predict(get_image(url), mod, synsets)" ] @@ -182,6 +183,7 @@ } ], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "url = 'https://images-na.ssl-images-amazon.com/images/G/01/img15/pet-products/small-tiles/23695_pets_vertical_store_dogs_small_tile_8._CB312176604_.jpg'\n", "predict(get_image(url), mod, synsets)" ] From 9e4d8946f52ab7e2cfdc78ba99a9ed588cbb2932 Mon Sep 17 00:00:00 2001 From: Wang Date: Wed, 15 Mar 2017 22:26:17 -0700 Subject: [PATCH 7/8] Ignore model fit cell in Linear Regression --- python/tutorials/linear-regression.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/python/tutorials/linear-regression.ipynb b/python/tutorials/linear-regression.ipynb index 511bfdb9c..8999bb3d6 100644 --- a/python/tutorials/linear-regression.ipynb +++ b/python/tutorials/linear-regression.ipynb @@ -281,6 +281,7 @@ }, "outputs": [], "source": [ + "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "model.fit(train_iter, eval_iter,\n", " optimizer_params={'learning_rate':0.01, 'momentum': 0.9},\n", " num_epoch=1000,\n", From 6b0b8a20b919e5ea7092147f1c1c6d4a6c0d0719 Mon Sep 17 00:00:00 2001 From: Wang Date: Thu, 16 Mar 2017 12:10:39 -0700 Subject: [PATCH 8/8] Fix liner regression --- python/tutorials/linear-regression.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/tutorials/linear-regression.ipynb b/python/tutorials/linear-regression.ipynb index 8999bb3d6..cd6db65c4 100644 --- a/python/tutorials/linear-regression.ipynb +++ b/python/tutorials/linear-regression.ipynb @@ -48,8 +48,8 @@ "outputs": [], "source": [ "#Training data\n", - "train_data = np.array([[1,2],[3,4],[5,6],[3,2],[7,1],[6,9]])\n", - "train_label = np.array([5,11,17,7,9,24])\n", + "train_data = np.random.uniform(0, 1, [100, 2])\n", + "train_label = np.array([train_data[i][0] + 2 * train_data[i][1] for i in range(100)])\n", "batch_size = 1\n", "\n", "#Evaluation Data\n", @@ -283,7 +283,7 @@ "source": [ "# @@@ AUTOTEST_OUTPUT_IGNORED_CELL\n", "model.fit(train_iter, eval_iter,\n", - " optimizer_params={'learning_rate':0.01, 'momentum': 0.9},\n", + " optimizer_params={'learning_rate':0.005, 'momentum': 0.9},\n", " num_epoch=1000,\n", " batch_end_callback = mx.callback.Speedometer(batch_size, 2))" ]