Use 'np.random' rather than 'import numpy.random as rnd'

main
Aurélien Geron 2017-06-06 14:26:26 +02:00
parent bd6c167e09
commit 692b674196
1 changed files with 18 additions and 9 deletions

View File

@ -47,11 +47,10 @@
"\n", "\n",
"# Common imports\n", "# Common imports\n",
"import numpy as np\n", "import numpy as np\n",
"import numpy.random as rnd\n",
"import os\n", "import os\n",
"\n", "\n",
"# to make this notebook's output stable across runs\n", "# to make this notebook's output stable across runs\n",
"rnd.seed(42)\n", "np.random.seed(42)\n",
"\n", "\n",
"# To plot pretty figures\n", "# To plot pretty figures\n",
"%matplotlib inline\n", "%matplotlib inline\n",
@ -779,7 +778,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 45, "execution_count": 45,
"metadata": { "metadata": {
"collapsed": true "collapsed": true,
"deletable": true,
"editable": true
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@ -793,7 +794,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 46, "execution_count": 46,
"metadata": { "metadata": {
"collapsed": true "collapsed": true,
"deletable": true,
"editable": true
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@ -927,7 +930,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 60,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"deletable": true,
"editable": true
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1056,7 +1061,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 69, "execution_count": 69,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"deletable": true,
"editable": true
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1083,7 +1090,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 71, "execution_count": 71,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"deletable": true,
"editable": true
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1195,9 +1204,9 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"noise = rnd.randint(0, 100, (len(X_train), 784))\n", "noise = np.random.randint(0, 100, (len(X_train), 784))\n",
"X_train_mod = X_train + noise\n", "X_train_mod = X_train + noise\n",
"noise = rnd.randint(0, 100, (len(X_test), 784))\n", "noise = np.random.randint(0, 100, (len(X_test), 784))\n",
"X_test_mod = X_test + noise\n", "X_test_mod = X_test + noise\n",
"y_train_mod = X_train\n", "y_train_mod = X_train\n",
"y_test_mod = X_test" "y_test_mod = X_test"