diff --git a/1 Multi-layer Fully Connected Networks.ipynb b/1 Multi-layer Fully Connected Networks.ipynb new file mode 100644 index 0000000..5dfbbf9 --- /dev/null +++ b/1 Multi-layer Fully Connected Networks.ipynb @@ -0,0 +1,1288 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "## Keras: Deep Learning library for Theano and TensorFlow" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + ">Keras is a minimalist, highly modular neural networks library, written in Python and capable of running on top of either TensorFlow or Theano. \n", + "\n", + ">It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.\n", + "ref: https://keras.io/" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "### Kaggle Challenge Data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + ">The Otto Group is one of the world’s biggest e-commerce companies, A consistent analysis of the performance of products is crucial. However, due to diverse global infrastructure, many identical products get classified differently.\n", + "For this competition, we have provided a dataset with 93 features for more than 200,000 products. The objective is to build a predictive model which is able to distinguish between our main product categories. \n", + "Each row corresponds to a single product. There are a total of 93 numerical features, which represent counts of different events. All features have been obfuscated and will not be defined any further.\n", + "\n", + "https://www.kaggle.com/c/otto-group-product-classification-challenge/data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### For this section we will use the Kaggle Otto Group Challenge Data. You will find these data in \n", + "`data/kaggle_ottogroup/` folder." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Logistic Regression\n", + "\n", + "This algorithm has nothing to do with the canonical _linear regression_, but it is an algorithm that allows us to solve problems of classification (supervised learning). \n", + "\n", + "In fact, to estimate the dependent variable, now we make use of the so-called **logistic function** or **sigmoid**. \n", + "\n", + "It is precisely because of this feature we call this algorithm logistic regression.\n", + "\n", + "![](imgs/sigmoid.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Data Preparation" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Using TensorFlow backend.\n" + ] + } + ], + "source": [ + "from kaggle_data import load_data, preprocess_data, preprocess_labels\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9 classes\n", + "93 dims\n" + ] + } + ], + "source": [ + "X_train, labels = load_data('data/kaggle_ottogroup/train.csv', train=True)\n", + "X_train, scaler = preprocess_data(X_train)\n", + "Y_train, encoder = preprocess_labels(labels)\n", + "\n", + "X_test, ids = load_data('data/kaggle_ottogroup/test.csv', train=False)\n", + "X_test, _ = preprocess_data(X_test, scaler)\n", + "\n", + "nb_classes = Y_train.shape[1]\n", + "print(nb_classes, 'classes')\n", + "\n", + "dims = X_train.shape[1]\n", + "print(dims, 'dims')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Class_1', 'Class_2', 'Class_3', 'Class_4', 'Class_5', 'Class_6',\n", + " 'Class_7', 'Class_8', 'Class_9'], dtype=object)" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.unique(labels)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 0., 0., 0., ..., 0., 0., 0.],\n", + " [ 0., 0., 0., ..., 0., 0., 0.],\n", + " [ 0., 0., 0., ..., 0., 0., 0.],\n", + " ..., \n", + " [ 0., 0., 0., ..., 0., 0., 0.],\n", + " [ 0., 0., 0., ..., 0., 0., 0.],\n", + " [ 0., 0., 0., ..., 1., 0., 0.]])" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Y_train # one-hot encoding" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Using Theano" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import theano as th\n", + "import theano.tensor as T" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Epoch 1\n", + "Epoch 2\n", + "Epoch 3\n", + "Epoch 4\n", + "Epoch 5\n", + "Epoch 6\n", + "Epoch 7\n", + "Epoch 8\n", + "Epoch 9\n", + "Epoch 10\n", + "target values for Data:\n", + "[ 0. 0. 0. ..., 0. 0. 0.]\n", + "prediction on training set:\n", + "[False False False ..., True False True]\n" + ] + } + ], + "source": [ + "#Based on example from DeepLearning.net\n", + "rng = np.random\n", + "N = 400\n", + "feats = 93\n", + "training_steps = 10\n", + "\n", + "# Declare Theano symbolic variables\n", + "x = T.matrix(\"x\")\n", + "y = T.vector(\"y\")\n", + "w = th.shared(rng.randn(feats), name=\"w\")\n", + "b = th.shared(0., name=\"b\")\n", + "\n", + "# Construct Theano expression graph\n", + "p_1 = 1 / (1 + T.exp(-T.dot(x, w) - b)) # Probability that target = 1\n", + "prediction = p_1 > 0.5 # The prediction thresholded\n", + "xent = -y * T.log(p_1) - (1-y) * T.log(1-p_1) # Cross-entropy loss function\n", + "cost = xent.mean() + 0.01 * (w ** 2).sum() # The cost to minimize\n", + "gw, gb = T.grad(cost, [w, b]) # Compute the gradient of the cost\n", + " \n", + "\n", + "# Compile\n", + "train = th.function(\n", + " inputs=[x,y],\n", + " outputs=[prediction, xent],\n", + " updates=((w, w - 0.1 * gw), (b, b - 0.1 * gb)),\n", + " allow_input_downcast=True)\n", + "predict = th.function(inputs=[x], outputs=prediction, allow_input_downcast=True)\n", + "\n", + "#Transform for class1\n", + "y_class1 = []\n", + "for i in Y_train:\n", + " y_class1.append(i[0])\n", + "y_class1 = np.array(y_class1)\n", + "\n", + "# Train\n", + "for i in range(training_steps):\n", + " print('Epoch %s' % (i+1,))\n", + " pred, err = train(X_train, y_class1)\n", + "\n", + "print(\"target values for Data:\")\n", + "print(y_class1)\n", + "print(\"prediction on training set:\")\n", + "print(predict(X_train))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Using Tensorflow" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import tensorflow as tf" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Parameters\n", + "learning_rate = 0.01\n", + "training_epochs = 25\n", + "display_step = 1" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# tf Graph Input\n", + "x = tf.placeholder(\"float\", [None, dims]) \n", + "y = tf.placeholder(\"float\", [None, nb_classes])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Model (Introducing Tensorboard)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Construct (linear) model\n", + "with tf.name_scope(\"model\") as scope:\n", + " # Set model weights\n", + " W = tf.Variable(tf.zeros([dims, nb_classes]))\n", + " b = tf.Variable(tf.zeros([nb_classes]))\n", + " activation = tf.nn.softmax(tf.matmul(x, W) + b) # Softmax\n", + "\n", + " # Add summary ops to collect data\n", + " w_h = tf.summary.histogram(\"weights_histogram\", W)\n", + " b_h = tf.summary.histogram(\"biases_histograms\", b)\n", + " tf.summary.scalar('mean_weights', tf.reduce_mean(W))\n", + " tf.summary.scalar('mean_bias', tf.reduce_mean(b))\n", + "\n", + "# Minimize error using cross entropy\n", + "# Note: More name scopes will clean up graph representation\n", + "with tf.name_scope(\"cost_function\") as scope:\n", + " cross_entropy = y*tf.log(activation)\n", + " cost = tf.reduce_mean(-tf.reduce_sum(cross_entropy,reduction_indices=1))\n", + " # Create a summary to monitor the cost function\n", + " tf.summary.scalar(\"cost_function\", cost)\n", + " tf.summary.histogram(\"cost_histogram\", cost)\n", + "\n", + "with tf.name_scope(\"train\") as scope:\n", + " # Set the Optimizer\n", + " optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Accuracy" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "with tf.name_scope('Accuracy') as scope:\n", + " correct_prediction = tf.equal(tf.argmax(activation, 1), tf.argmax(y, 1))\n", + " # Calculate accuracy\n", + " accuracy = tf.reduce_mean(tf.cast(correct_prediction, \"float\"))\n", + " # Create a summary to monitor the cost function\n", + " tf.summary.scalar(\"accuracy\", accuracy)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Learning in a TF Session" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "LOGDIR = \"/tmp/logistic_logs\"\n", + "import os, shutil\n", + "if os.path.isdir(LOGDIR):\n", + " shutil.rmtree(LOGDIR)\n", + "os.mkdir(LOGDIR)\n", + "\n", + "# Plug TensorBoard Visualisation \n", + "writer = tf.summary.FileWriter(LOGDIR, graph=tf.get_default_graph())" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "model/weights_histogram:0\n", + "model/biases_histograms:0\n", + "model/mean_weights:0\n", + "model/mean_bias:0\n", + "cost_function/cost_function:0\n", + "cost_function/cost_histogram:0\n", + "Accuracy/accuracy:0\n", + "Tensor(\"add:0\", shape=(), dtype=string)\n" + ] + } + ], + "source": [ + "for var in tf.get_collection(tf.GraphKeys.SUMMARIES):\n", + " print(var.name)\n", + " \n", + "summary_op = tf.summary.merge_all()\n", + "print('Summary Op: ' + summary_op)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "accuracy epoch 0:0.6649535894393921\n", + "accuracy epoch 1:0.665276825428009\n", + "accuracy epoch 2:0.6657131910324097\n", + "accuracy epoch 3:0.6659556031227112\n", + "accuracy epoch 4:0.6662949919700623\n", + "accuracy epoch 5:0.6666020154953003\n", + "accuracy epoch 6:0.6668121218681335\n", + "accuracy epoch 7:0.6671029925346375\n", + "accuracy epoch 8:0.6674585342407227\n", + "accuracy epoch 9:0.667862594127655\n", + "accuracy epoch 10:0.6680726408958435\n", + "accuracy epoch 11:0.6682504415512085\n", + "accuracy epoch 12:0.6684605479240417\n", + "accuracy epoch 13:0.6687514185905457\n", + "accuracy epoch 14:0.6690422892570496\n", + "accuracy epoch 15:0.6692523956298828\n", + "accuracy epoch 16:0.6695109605789185\n", + "accuracy epoch 17:0.6697695255279541\n", + "accuracy epoch 18:0.6699796319007874\n", + "accuracy epoch 19:0.6702058911323547\n", + "accuracy epoch 20:0.6705452799797058\n", + "accuracy epoch 21:0.6708361506462097\n", + "accuracy epoch 22:0.6710785627365112\n", + "accuracy epoch 23:0.671385645866394\n", + "accuracy epoch 24:0.6716926693916321\n", + "Training phase finished\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEKCAYAAAAB0GKPAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VeW1//HPkuQKRa5ApYoBRVtHIEwRZapWRERQkOpF\nEYtWRX/KT6kFUduqtSq8pE7tr4r8Cg4VwaqAVO1lqkOpEwkEEVJlKLYBrlAgyKgE1v3jnIQQkrBP\nkn3G7/v1yotz9n72Pmtnk6zs53nW3ubuiIiIHM4RiQ5ARERSgxKGiIgEooQhIiKBKGGIiEggShgi\nIhKIEoaIiASihCEiIoEoYYiISCBKGCIiE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/qeRqPsBgcta5TdgDF9T6vvj5I4iufY\n1BdffEHv3r3Jzc2ld+/e/POf/wRg9erVnHPOOZx11lnce++95Vcna9eupV27dgAsX76crl270rFj\nR3Jzc1m5ciV33XUXq1evpmPHjowZM+ag9vv27WP06NG0b9+e3Nxcfvvb39YYW7du3Vi37sAxFxQU\ncO6559KlSxf69u3Lhg0bAFi0aBG5ubl069aNMWPGlH/ec889xxVXXMEll1zChRdeCESS0VlnnUVu\nbi733XcfADt37qR///506NCBdu3a8fLLLwNw1113ceaZZ5Kbm8vo0aMBuP/++/n1r38NQGFhIeec\ncw65ublcdtllbN26FYDzzjuPsWPH0rVrV0499VT++te/Bj4f8+fP54ILLuDKK6+kU6dOAFxyySV0\n6dKFtm3b8vvf/768batWrSgpKWHVqlW0a9eO66+/nrZt29KvX7/y6dvDhg1j1qxZ5e3vv/9+OnXq\nRG5uLp9/Hvkbd+PGjfTu3ZvOnTtzyy23kJOTQ0lJyUFxlZaW0rRpU37yk5/QuXNn+vTpw+bNm8vX\nT58+na5du3Laaafx/vuRuUCrV6+mV69edOrUiS5duvDRR5Eh4HXr1tGzZ086duxIu3btytv/+c9/\nplu3bnTu3JkhQ4awc+fOwN+3wNw9bb66dOnisZq5uNi7j1vgbca+4d3HLfCZi4tj3oeEb8WKFYHb\ndh+3wE8c+8YhX93HLahTDI0bNz5k2YABA/y5555zd/fJkyf7wIED3d29f//+/tJLL7m7+9NPP12+\n7T/+8Q9v27atu7uPHDnSX3zxRXd3//rrr33Xrl0Hra/c/qmnnvLBgwf73r173d198+bNh8QzfPhw\nf+WVV9zdfebMmX7VVVe5u/s333zj3bp1840bN7q7+/Tp0/26665zd/e2bdv63/72N3d3Hzt2bPnn\nPfvss56Tk1P+OXPmzPEbb7zR9+/f7/v27fP+/fv7u+++66+++qrfcMMN5TGUlJT45s2b/dRTT/X9\n+/e7u/vWrVvd3f2+++7zCRMmuLt7+/bt/Z133nF391/84hd+++23u7v7ueee63fccYe7u7/55pve\nu3fvas7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BKGCIxMLNhZvZx9PkBz5hZAzPb\nYWaPmtkCYHTXAAABkUlEQVRiM1tgZi2ibTua2YfRm7vNLLu5m5l9z8zmm9nS6Dbfje7+KDN71cz+\nbmZToxW6IklDCUMkIDM7AxhC5IaNHYF9wNVAY2Bx9CaO7xKpoAZ4ARjr7rlEqmzLlk8FfufuHYDu\nRG78BpG7iI4CzgROBnqEflAiMchKdAAiKaQ30AVYFP3jvxGRm9XtB16OtnkRmGFmRwNN3f3d6PLn\ngVei9+7KcfeZAO6+ByC6v4/dvTj6vhBoAywM/7BEglHCEAnOgOfd/e6DFpr9olK7mu63U1M309cV\nXu9DP5+SZNQlJRLcAuByM/sOlD8P+kQiP0eXR9sMBRa6+zZgq5n1ii6/Bng3+hyCYjMbFN3HkWb2\nrbgehUgt6S8YkYDcfYWZ/ZzIEwqPAPYCtwI7gbZmVgBsIzLOAZHbZU+MJoQ1wHXR5dcAz5jZA9F9\nXBHHwxCpNd2tVqSOzGyHux+V6DhEwqYuKRERCURXGCIiEoiuMEREJBAlDBERCUQJQ0REAlHCEBGR\nQJQwREQkECUMEREJ5H8BqFoC5NsZZtAAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1 5 5 ..., 2 1 1]\n" + ] + } + ], + "source": [ + "# Launch the graph\n", + "with tf.Session() as session:\n", + " # Initializing the variables\n", + " session.run(tf.global_variables_initializer())\n", + " \n", + " cost_epochs = []\n", + " # Training cycle\n", + " for epoch in range(training_epochs):\n", + " _, summary, c = session.run(fetches=[optimizer, summary_op, cost], feed_dict={x: X_train, y: Y_train})\n", + " cost_epochs.append(c)\n", + " writer.add_summary(summary=summary, global_step=epoch)\n", + " print(\"accuracy epoch {}:{}\".format(epoch, accuracy.eval({x: X_train, y: Y_train})))\n", + " \n", + " print(\"Training phase finished\")\n", + " \n", + " #plotting\n", + " plt.plot(range(len(cost_epochs)), cost_epochs, 'o', label='Logistic Regression Training phase')\n", + " plt.ylabel('cost')\n", + " plt.xlabel('epoch')\n", + " plt.legend()\n", + " plt.show()\n", + " \n", + " prediction = tf.argmax(activation, 1)\n", + " print(prediction.eval({x: X_test}))" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Process is terminated.\n" + ] + } + ], + "source": [ + "%%bash\n", + "python -m tensorflow.tensorboard --logdir=/tmp/logistic_logs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Using Keras" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from keras.models import Sequential\n", + "from keras.layers import Dense, Activation" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "93 dims\n", + "Building model...\n", + "9 classes\n", + "Epoch 1/10\n", + "61878/61878 [==============================] - 3s - loss: 1.9833 \n", + "Epoch 2/10\n", + "61878/61878 [==============================] - 2s - loss: 1.8358 \n", + "Epoch 3/10\n", + "61878/61878 [==============================] - 3s - loss: 1.7817 \n", + "Epoch 4/10\n", + "61878/61878 [==============================] - 5s - loss: 1.7472 \n", + "Epoch 5/10\n", + "61878/61878 [==============================] - 2s - loss: 1.7225 \n", + "Epoch 6/10\n", + "61878/61878 [==============================] - 2s - loss: 1.7037 \n", + "Epoch 7/10\n", + "61878/61878 [==============================] - 2s - loss: 1.6890 \n", + "Epoch 8/10\n", + "61878/61878 [==============================] - 2s - loss: 1.6771 \n", + "Epoch 9/10\n", + "61878/61878 [==============================] - 2s - loss: 1.6673 \n", + "Epoch 10/10\n", + "61878/61878 [==============================] - 2s - loss: 1.6589 \n" + ] + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dims = X_train.shape[1]\n", + "print(dims, 'dims')\n", + "print(\"Building model...\")\n", + "\n", + "nb_classes = Y_train.shape[1]\n", + "print(nb_classes, 'classes')\n", + "\n", + "model = Sequential()\n", + "model.add(Dense(nb_classes, input_shape=(dims,), activation='sigmoid'))\n", + "model.add(Activation('softmax'))\n", + "model.compile(optimizer='sgd', loss='categorical_crossentropy')\n", + "model.fit(X_train, Y_train)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Simplicity is pretty impressive right? :)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now lets understand:\n", + "
The core data structure of Keras is a model, a way to organize layers. The main type of model is the Sequential model, a linear stack of layers.
\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What we did here is stacking a Fully Connected (Dense) layer of trainable weights from the input to the output and an Activation layer on top of the weights layer." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### Dense" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "```python\n", + "from keras.layers.core import Dense\n", + "\n", + "Dense(units, activation=None, use_bias=True, \n", + " kernel_initializer='glorot_uniform', bias_initializer='zeros', \n", + " kernel_regularizer=None, bias_regularizer=None, \n", + " activity_regularizer=None, kernel_constraint=None, bias_constraint=None)\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* `units`: int > 0.\n", + "\n", + "* `init`: name of initialization function for the weights of the layer (see initializations), or alternatively, Theano function to use for weights initialization. This parameter is only relevant if you don't pass a weights argument.\n", + "\n", + "* `activation`: name of activation function to use (see activations), or alternatively, elementwise Theano function. If you don't specify anything, no activation is applied (ie. \"linear\" activation: a(x) = x).\n", + "\n", + "* `weights`: list of Numpy arrays to set as initial weights. The list should have 2 elements, of shape (input_dim, output_dim) and (output_dim,) for weights and biases respectively.\n", + "\n", + "* `kernel_regularizer`: instance of WeightRegularizer (eg. L1 or L2 regularization), applied to the main weights matrix.\n", + "\n", + "* `bias_regularizer`: instance of WeightRegularizer, applied to the bias.\n", + "\n", + "* `activity_regularizer`: instance of ActivityRegularizer, applied to the network output.\n", + "\n", + "* `kernel_constraint`: instance of the constraints module (eg. maxnorm, nonneg), applied to the main weights matrix.\n", + "\n", + "* `bias_constraint`: instance of the constraints module, applied to the bias.\n", + "\n", + "* `use_bias`: whether to include a bias (i.e. make the layer affine rather than linear)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## (some) others `keras.core.layers`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* `keras.layers.core.Flatten()`\n", + "* `keras.layers.core.Reshape(target_shape)`\n", + "* `keras.layers.core.Permute(dims)`\n", + "\n", + "```python\n", + "model = Sequential()\n", + "model.add(Permute((2, 1), input_shape=(10, 64)))\n", + "# now: model.output_shape == (None, 64, 10)\n", + "# note: `None` is the batch dimension\n", + "```\n", + "\n", + "* `keras.layers.core.Lambda(function, output_shape=None, arguments=None)`\n", + "* `keras.layers.core.ActivityRegularization(l1=0.0, l2=0.0)`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "Credits: Yam Peleg ([@Yampeleg](https://twitter.com/yampeleg))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### Activation" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "```python\n", + "from keras.layers.core import Activation\n", + "\n", + "Activation(activation)\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Supported Activations** : [https://keras.io/activations/]\n", + "\n", + "**Advanced Activations**: [https://keras.io/layers/advanced-activations/]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### Optimizer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If you need to, you can further configure your optimizer. A core principle of Keras is to make things reasonably simple, while allowing the user to be fully in control when they need to (the ultimate control being the easy extensibility of the source code).\n", + "Here we used SGD (stochastic gradient descent) as an optimization algorithm for our trainable weights. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "Source & Reference: http://sebastianruder.com/content/images/2016/09/saddle_point_evaluation_optimizers.gif" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\"Data Sciencing\" this example a little bit more\n", + "=====" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What we did here is nice, however in the real world it is not useable because of overfitting.\n", + "Lets try and solve it with cross validation." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### Overfitting" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In overfitting, a statistical model describes random error or noise instead of the underlying relationship. Overfitting occurs when a model is excessively complex, such as having too many parameters relative to the number of observations. \n", + "\n", + "A model that has been overfit has poor predictive performance, as it overreacts to minor fluctuations in the training data." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
To avoid overfitting, we will first split out data to training set and test set and test out model on the test set.\n",
+    "Next: we will use two of keras's callbacks EarlyStopping and ModelCheckpoint
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's see first the model we implemented" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "_________________________________________________________________\n", + "Layer (type) Output Shape Param # \n", + "=================================================================\n", + "dense_1 (Dense) (None, 9) 846 \n", + "_________________________________________________________________\n", + "activation_1 (Activation) (None, 9) 0 \n", + "=================================================================\n", + "Total params: 846\n", + "Trainable params: 846\n", + "Non-trainable params: 0\n", + "_________________________________________________________________\n" + ] + } + ], + "source": [ + "model.summary()" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from sklearn.model_selection import train_test_split\n", + "from keras.callbacks import EarlyStopping, ModelCheckpoint" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 52596 samples, validate on 9282 samples\n", + "Epoch 1/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6547 - val_loss: 1.6514\n", + "Epoch 2/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6532 - val_loss: 1.6499\n", + "Epoch 3/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6517 - val_loss: 1.6485\n", + "Epoch 4/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6503 - val_loss: 1.6471\n", + "Epoch 5/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6489 - val_loss: 1.6457\n", + "Epoch 6/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6476 - val_loss: 1.6444\n", + "Epoch 7/50\n", + "52596/52596 [==============================] - 1s - loss: 1.6462 - val_loss: 1.6431\n", + "Epoch 8/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6450 - val_loss: 1.6418\n", + "Epoch 9/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6437 - val_loss: 1.6406\n", + "Epoch 10/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6425 - val_loss: 1.6394\n", + "Epoch 11/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6413 - val_loss: 1.6383\n", + "Epoch 12/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6402 - val_loss: 1.6371\n", + "Epoch 13/50\n", + "52596/52596 [==============================] - 1s - loss: 1.6391 - val_loss: 1.6361\n", + "Epoch 14/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6380 - val_loss: 1.6350\n", + "Epoch 15/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6370 - val_loss: 1.6340\n", + "Epoch 16/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6360 - val_loss: 1.6330\n", + "Epoch 17/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6350 - val_loss: 1.6321\n", + "Epoch 18/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6340 - val_loss: 1.6311\n", + "Epoch 19/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6331 - val_loss: 1.6302\n", + "Epoch 20/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6322 - val_loss: 1.6294\n", + "Epoch 21/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6314 - val_loss: 1.6285\n", + "Epoch 22/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6305 - val_loss: 1.6277\n", + "Epoch 23/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6297 - val_loss: 1.6269\n", + "Epoch 24/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6289 - val_loss: 1.6261\n", + "Epoch 25/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6281 - val_loss: 1.6253\n", + "Epoch 26/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6274 - val_loss: 1.6246\n", + "Epoch 27/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6266 - val_loss: 1.6239\n", + "Epoch 28/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6259 - val_loss: 1.6232\n", + "Epoch 29/50\n", + "52596/52596 [==============================] - 1s - loss: 1.6252 - val_loss: 1.6225\n", + "Epoch 30/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6245 - val_loss: 1.6218\n", + "Epoch 31/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6239 - val_loss: 1.6212\n", + "Epoch 32/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6232 - val_loss: 1.6205\n", + "Epoch 33/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6226 - val_loss: 1.6199\n", + "Epoch 34/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6219 - val_loss: 1.6193\n", + "Epoch 35/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6213 - val_loss: 1.6187\n", + "Epoch 36/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6207 - val_loss: 1.6181\n", + "Epoch 37/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6202 - val_loss: 1.6176\n", + "Epoch 38/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6196 - val_loss: 1.6170\n", + "Epoch 39/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6190 - val_loss: 1.6165\n", + "Epoch 40/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6185 - val_loss: 1.6159\n", + "Epoch 41/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6179 - val_loss: 1.6154\n", + "Epoch 42/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6174 - val_loss: 1.6149\n", + "Epoch 43/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6169 - val_loss: 1.6144\n", + "Epoch 44/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6164 - val_loss: 1.6139\n", + "Epoch 45/50\n", + "52596/52596 [==============================] - 1s - loss: 1.6159 - val_loss: 1.6134\n", + "Epoch 46/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6154 - val_loss: 1.6130\n", + "Epoch 47/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6149 - val_loss: 1.6125\n", + "Epoch 48/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6145 - val_loss: 1.6120\n", + "Epoch 49/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6140 - val_loss: 1.6116\n", + "Epoch 50/50\n", + "52596/52596 [==============================] - 0s - loss: 1.6136 - val_loss: 1.6112\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "X_train, X_val, Y_train, Y_val = train_test_split(X_train, Y_train, test_size=0.15, random_state=42)\n", + "\n", + "fBestModel = 'best_model.h5' \n", + "early_stop = EarlyStopping(monitor='val_loss', patience=2, verbose=1) \n", + "best_model = ModelCheckpoint(fBestModel, verbose=0, save_best_only=True)\n", + "model.fit(X_train, Y_train, validation_data = (X_val, Y_val), epochs=50, \n", + " batch_size=128, verbose=True, callbacks=[best_model, early_stop]) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Multi-Layer Fully Connected Networks" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Forward and Backward Propagation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Q:** _How hard can it be to build a Multi-Layer Fully-Connected Network with keras?_\n", + "\n", + "**A:** _It is basically the same, just add more layers!_" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "_________________________________________________________________\n", + "Layer (type) Output Shape Param # \n", + "=================================================================\n", + "dense_2 (Dense) (None, 100) 9400 \n", + "_________________________________________________________________\n", + "dense_3 (Dense) (None, 9) 909 \n", + "_________________________________________________________________\n", + "activation_2 (Activation) (None, 9) 0 \n", + "=================================================================\n", + "Total params: 10,309\n", + "Trainable params: 10,309\n", + "Non-trainable params: 0\n", + "_________________________________________________________________\n" + ] + } + ], + "source": [ + "model = Sequential()\n", + "model.add(Dense(100, input_shape=(dims,)))\n", + "model.add(Dense(nb_classes))\n", + "model.add(Activation('softmax'))\n", + "model.compile(optimizer='sgd', loss='categorical_crossentropy')\n", + "model.summary()" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 52596 samples, validate on 9282 samples\n", + "Epoch 1/20\n", + "52596/52596 [==============================] - 1s - loss: 1.1979 - val_loss: 0.8706\n", + "Epoch 2/20\n", + "52596/52596 [==============================] - 0s - loss: 0.8248 - val_loss: 0.7727\n", + "Epoch 3/20\n", + "52596/52596 [==============================] - 0s - loss: 0.7633 - val_loss: 0.7333\n", + "Epoch 4/20\n", + "52596/52596 [==============================] - 0s - loss: 0.7334 - val_loss: 0.7105\n", + "Epoch 5/20\n", + "52596/52596 [==============================] - 0s - loss: 0.7150 - val_loss: 0.6960\n", + "Epoch 6/20\n", + "52596/52596 [==============================] - 0s - loss: 0.7021 - val_loss: 0.6850\n", + "Epoch 7/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6927 - val_loss: 0.6775\n", + "Epoch 8/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6854 - val_loss: 0.6713\n", + "Epoch 9/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6794 - val_loss: 0.6659\n", + "Epoch 10/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6747 - val_loss: 0.6623\n", + "Epoch 11/20\n", + "52596/52596 [==============================] - 1s - loss: 0.6706 - val_loss: 0.6591\n", + "Epoch 12/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6672 - val_loss: 0.6556\n", + "Epoch 13/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6644 - val_loss: 0.6535\n", + "Epoch 14/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6619 - val_loss: 0.6512\n", + "Epoch 15/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6597 - val_loss: 0.6499\n", + "Epoch 16/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6578 - val_loss: 0.6479\n", + "Epoch 17/20\n", + "52596/52596 [==============================] - 1s - loss: 0.6560 - val_loss: 0.6462\n", + "Epoch 18/20\n", + "52596/52596 [==============================] - 1s - loss: 0.6545 - val_loss: 0.6456\n", + "Epoch 19/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6531 - val_loss: 0.6442\n", + "Epoch 20/20\n", + "52596/52596 [==============================] - 0s - loss: 0.6518 - val_loss: 0.6432\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model.fit(X_train, Y_train, validation_data = (X_val, Y_val), epochs=20, \n", + " batch_size=128, verbose=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Your Turn!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Hands On - Keras Fully Connected\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Take couple of minutes and try to play with the number of layers and the number of parameters in the layers to get the best results. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "model = Sequential()\n", + "model.add(Dense(100, input_shape=(dims,)))\n", + "\n", + "# ...\n", + "# ...\n", + "# Play with it! add as much layers as you want! try and get better results.\n", + "\n", + "model.add(Dense(nb_classes))\n", + "model.add(Activation('softmax'))\n", + "model.compile(optimizer='sgd', loss='categorical_crossentropy')\n", + "model.fit(X_train, Y_train, validation_data = (X_val, Y_val), epochs=20, \n", + " batch_size=128, verbose=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Building a question answering system, an image classification model, a Neural Turing Machine, a word2vec embedder or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful?" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Theoretical Motivations for depth" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + ">Much has been studied about the depth of neural nets. Is has been proven mathematically[1] and empirically that convolutional neural network benifit from depth! " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[1] - On the Expressive Power of Deep Learning: A Tensor Analysis - Cohen, et al 2015" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Theoretical Motivations for depth" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "One much quoted theorem about neural network states that:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + ">Universal approximation theorem states[1] that a feed-forward network with a single hidden layer containing a finite number of neurons (i.e., a multilayer perceptron), can approximate continuous functions on compact subsets of $\\mathbb{R}^n$, under mild assumptions on the activation function. The theorem thus states that simple neural networks can represent a wide variety of interesting functions when given appropriate parameters; however, it does not touch upon the algorithmic learnability of those parameters." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[1] - Approximation Capabilities of Multilayer Feedforward Networks - Kurt Hornik 1991" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Addendum\n", + "\n", + "[1.1 Keras Backend](1.1 Keras Backend.ipynb)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.3" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/1.1 Keras Backend.ipynb b/1.1 Keras Backend.ipynb new file mode 100644 index 0000000..493533c --- /dev/null +++ b/1.1 Keras Backend.ipynb @@ -0,0 +1,496 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Keras Backend\n", + "\n", + "In this notebook we will be using the [Keras backend module](http://keras.io/backend/), which provides an abstraction over both Theano and Tensorflow." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's try to re-implement the Logistic Regression Model using the `keras.backend` APIs.\n", + "\n", + "The following code will look like very similar to what we would write in Theano or Tensorflow (with the *only difference* that it may run on both the two backends)." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Using TensorFlow backend.\n" + ] + } + ], + "source": [ + "import keras.backend as K\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from kaggle_data import load_data, preprocess_data, preprocess_labels" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9 classes\n", + "93 dims\n" + ] + } + ], + "source": [ + "X_train, labels = load_data('data/kaggle_ottogroup/train.csv', train=True)\n", + "X_train, scaler = preprocess_data(X_train)\n", + "Y_train, encoder = preprocess_labels(labels)\n", + "\n", + "X_test, ids = load_data('data/kaggle_ottogroup/test.csv', train=False)\n", + "\n", + "X_test, _ = preprocess_data(X_test, scaler)\n", + "\n", + "nb_classes = Y_train.shape[1]\n", + "print(nb_classes, 'classes')\n", + "\n", + "dims = X_train.shape[1]\n", + "print(dims, 'dims')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "feats = dims\n", + "training_steps = 25" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = K.placeholder(dtype=\"float\", shape=X_train.shape) \n", + "target = K.placeholder(dtype=\"float\", shape=Y_train.shape)\n", + "\n", + "# Set model weights\n", + "W = K.variable(np.random.rand(dims, nb_classes))\n", + "b = K.variable(np.random.rand(nb_classes))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Define model and loss\n", + "y = K.dot(x, W) + b\n", + "loss = K.categorical_crossentropy(y, target)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "activation = K.softmax(y) # Softmax" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "lr = K.constant(0.01)\n", + "grads = K.gradients(loss, [W,b])\n", + "updates = [(W, W-lr*grads[0]), (b, b-lr*grads[1])]" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "train = K.function(inputs=[x, target], outputs=[loss], updates=updates)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loss: [ 2.13178873 1.99579716 3.72429109 ..., 2.75165343 2.29350972\n", + " 1.77051127]\n", + "Loss: [ 2.95424724 0.10998608 1.07148504 ..., 0.23925911 2.9478302\n", + " 2.90452051]\n" + ] + } + ], + "source": [ + "# Training\n", + "loss_history = []\n", + "for epoch in range(training_steps):\n", + " current_loss = train([X_train, Y_train])[0]\n", + " loss_history.append(current_loss)\n", + " if epoch % 20 == 0:\n", + " print(\"Loss: {}\".format(current_loss))" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "loss_history = [np.mean(lh) for lh in loss_history]" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEKCAYAAAAB0GKPAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt4VNW9//H3V8gPUqUGNLVARNS2HAuEIJGC4NGDCCiI\nlOpRkQpVSz2Vgu0jKj/9ecFaqanK6TmnRU69YEHRUqUcq3IRrbWCkEAAgSIX0QI+hYrhgFwk+P39\nMTtxiLnsmWTPJJnP63nyMLP22nu+e4bkO2utvdY2d0dERKQux6U7ABERaRqUMEREJBQlDBERCUUJ\nQ0REQlHCEBGRUJQwREQkFCUMEREJJdKEYWbbzGytmZWaWXE1283Mfmlmm81sjZmdHbdtjJltCn7G\nRBmniIjUrWUKXuNf3P0fNWy7GPh68PMt4NfAt8ysHXA3UAg4UGJm89394xTEKyIi1UhFwqjNZcBT\nHptuvszMcsysPXABsMjd9wCY2SJgCPBMTQc6+eSTvXPnztFHLCLSjJSUlPzD3XPD1I06YTiw0M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nBg8ezIcffgjAihUryM/Pp2/fvkyaNKny9Z588kmuuOIKLr30UgYNGgTEktE555xDfn4+d999NwCf\nfPIJQ4cOpUePHnTr1o1nn30WgNtvv51vfvOb5Ofnc8sttwBwzz338Itf/AKA0tJS+vTpQ35+Pt/+\n9rf5+OPY2qIXXHABt912G7179+Yb3/gGf/7zn0N/HosXL2bgwIFcddVV9OzZE4BLL72UXr160bVr\nV37zm99U1s3Ly6OsrIzNmzfTrVs3rr/+erp27crFF19cefn26NGjmTdvXmX9e+65h549e5Kfn8+7\n774LwK5du7jwwgs5++yz+eEPf0jHjh0pKys7Jq7y8nJycnL48Y9/zNlnn81FF13ERx99VLl9zpw5\n9O7dmy5duvDWW28Bsf9D5513Hj179qRXr168/fbbAOzYsYP+/ftTUFBAt27dKuu//PLL9O3bl7PP\nPpsrr7ySTz75JPT7FpYSRgJG9OzIAyO70zEnGwM65mTzwMjujeKbq3wulWNN48eP59prr2XNmjVc\nc801TJgwAYCJEycyceJEVqxYQYcOHardd/r06UycOJHS0lKKi4vJy8tj6tSpnHnmmZSWllJUVHRM\n/RkzZvDee++xatWqyterzSuvvMKIESOA2DyWH/3oR8ydO5eSkhKuu+467rjjDgC+973vMX36dJYu\nXUqLFsd+IVq6dCkzZ85kyZIlLFy4kE2bNrF8+XJKS0spKSnhjTfe4JVXXqFDhw6sXr2ad955hyFD\nhrBnzx5eeOEF1q1bx5o1a7jzzju/EN+1117Lz3/+c9asWUP37t259957K7eVl5ezfPlypk2bdkx5\nGMuWLePBBx9k7drYBSkzZ86kpKSEFStW8PDDD1cmpngbN27k5ptvZt26dWRnZ1cmiapOOeUUVq1a\nxQ033MDDDz8MwF133cWQIUNYuXIll1xyCTt3Vr8oxd69e+nTpw8rV66kb9++3HfffZXb3J3ly5dT\nVFTElClTAGjfvj2LFi1i1apVzJ49u/L/1qxZs7j00kspLS1l9erV5Ofns2vXLqZOncqrr77KypUr\nyc/P59///d8Tet/CUJdUgkb07KgE0cilcqxp6dKlPP/88wB897vf5dZbb60sr/ijM2rUqMpv2PH6\n9u3L/fffz/bt2xk5ciRf//rXa32txYsXc+ONN1Z2s7Rr167aepMmTeLWW29l165dLFu2DIj9QXzn\nnXe46KKLgFhrpX379pSVlbFv3z7OPffcylhffPHFymNddNFFla+zcOFCFi5cWPnNff/+/WzatInz\nzjuPW265hdtuu41hw4Zx3nnnUV5eTuvWrbnhhhsYOnQow4YNOybGvXv3UlZWxvnnnw/AmDFjuOKK\nKyq3jxw5EoBevXqxbdu2Wt+Xqvr27UunTp0qnz/yyCPMnz8fgO3bt7NlyxYKC4+ddvC1r32N7t27\n1/ma8XG99NJLALz55puVyXfYsGG0adOm2n1btmxZeY6jR49m1KhR1R634rUPHz7M+PHjWb16NS1b\ntmTLli0AnHPOOfzgBz/g0KFDjBgxgh49erB48WLWr19f+Tl++umn9O/fP8S7lRi1MKTZqWlMKRVj\nTYlcujhq1Cjmz59PdnY2gwcPZsmSJbXWd/dQxy8qKmLz5s389Kc/ZcyYMZX7du3aldLSUkpLS1m7\ndi0LFy6krom7xx9//DGvP3ny5MpjbN68meuvv55vfOMblJSU0L17dyZPnsyUKVNo2bIly5cv5zvf\n+Q7z5s1jyJAhId6Rz7Vq1QqAFi1aUF5entC+8TEvXryYN954g2XLllV+G69utYCK16vrNauLK+zk\n56qfXfzz6o770EMPceqpp7J27VqWL1/O4cOHARgwYACvv/467du355prrmH27Nm4O0OGDKn8bNav\nX8+MGVUXB68/JQxpdlI51nTuuecyZ84cAGbPnl35ra5Pnz78/ve/B6jcXtXWrVs544wzmDBhAsOH\nD2fNmjW0adOmxit3Bg0axPTp0yv/oOzZU/NqOccddxwTJ07ks88+Y8GCBXTp0oXdu3ezdOlSINZF\ntW7dOtq2bUubNm0qWyI1xQqxq4oef/xx9u/fD8T60nft2sXOnTv50pe+xOjRo7nllltYuXIl+/fv\nZ+/evVxyySVMmzbtC1cBnXjiibRt27ZyfOK3v/1tZWujIe3du5d27dqRnZ3NunXrWLFiRd07Jah/\n//4899x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AIcBPwCdDVzEqAvcTGOSC2XPb0ICFsBb4XlH8XeNTMpgTHuCKFpyGS\nNK1WK1JPZrbf3U9IdxwiUVOXlIiIhKIWhoiIhKIWhoiIhKKEISIioShhiIhIKEoYIiISihKGiIiE\nooQhIiKh/H/9eM3h1dqi1QAAAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# plotting\n", + "plt.plot(range(len(loss_history)), loss_history, 'o', label='Logistic Regression Training phase')\n", + "plt.ylabel('cost')\n", + "plt.xlabel('epoch')\n", + "plt.legend()\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Your Turn\n", + "\n", + "Please switch to the **Theano** backend and **restart** the notebook.\n", + "\n", + "You _should_ see no difference in the execution!\n", + "\n", + "**Reminder**: please keep in mind that you *can* execute shell commands from a notebook (pre-pending a `!` sign).\n", + "Thus:\n", + "\n", + "```shell\n", + " !cat ~/.keras/keras.json\n", + "```\n", + "should show you the content of your keras configuration file." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "### Moreover\n", + "\n", + "Try to play a bit with the **learning reate** parameter to see how the loss history floats... " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exercise: Linear Regression\n", + "To get familiar with automatic differentiation, we start by learning a simple linear regression model using Stochastic Gradient Descent (SGD).\n", + "\n", + "Recall that given a dataset $\\{(x_i, y_i)\\}_{i=0}^N$, with $x_i, y_i \\in \\mathbb{R}$, the objective of linear regression is to find two scalars $w$ and $b$ such that $y = w\\cdot x + b$ fits the dataset. In this tutorial we will learn $w$ and $b$ using SGD and a Mean Square Error (MSE) loss:\n", + "\n", + "$$\\mathcal{l} = \\frac{1}{N} \\sum_{i=0}^N (w\\cdot x_i + b - y_i)^2$$\n", + "\n", + "Starting from random values, parameters $w$ and $b$ will be updated at each iteration via the following rule:\n", + "\n", + "$$w_t = w_{t-1} - \\eta \\frac{\\partial \\mathcal{l}}{\\partial w}$$\n", + "
\n", + "$$b_t = b_{t-1} - \\eta \\frac{\\partial \\mathcal{l}}{\\partial b}$$\n", + "\n", + "where $\\eta$ is the learning rate.\n", + "\n", + "**NOTE:** Recall that **linear regression** is indeed a **simple neuron** with a linear activation function!!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Definition: Placeholders and Variables" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "First of all, we define the necessary variables and placeholders for our computational graph. Variables maintain state across executions of the computational graph, while placeholders are ways to feed the graph with external data.\n", + "\n", + "For the linear regression example, we need three variables: `w`, `b`, and the learning rate for SGD, `lr`. \n", + "\n", + "Two placeholders `x` and `target` are created to store $x_i$ and $y_i$ values." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Placeholders and variables\n", + "x = K.placeholder()\n", + "target = K.placeholder()\n", + "w = K.variable(np.random.rand())\n", + "b = K.variable(np.random.rand())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Notes:\n", + "\n", + "In case you're wondering what's the difference between a **placeholder** and a **variable**, in short:\n", + "\n", + "* Use `K.variable()` for trainable variables such as weights (`W`) and biases (`b`) for your model.\n", + "* Use `K.placeholder()` to feed actual data (e.g. training examples)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Model definition\n", + "Now we can define the $y = w\\cdot x + b$ relation as well as the MSE loss in the computational graph." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Define model and loss" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# %load solutions/sol1.py" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Then, given the gradient of MSE wrt to `w` and `b`, we can define how we update the parameters via SGD:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# %load solutions/sol12.py" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The whole model can be encapsulated in a `function`, which takes as input `x` and `target`, returns the current loss value and updates its parameter according to `updates`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "train = K.function(inputs=[x, target], outputs=[loss], updates=updates)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Training\n", + "Training is now just a matter of calling the `function` we have just defined. Each time `train` is called, indeed, `w` and `b` will be updated using the SGD rule.\n", + "\n", + "Having generated some random training data, we will feed the `train` function for several epochs and observe the values of `w`, `b`, and loss." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Generate data\n", + "np_x = np.random.rand(1000)\n", + "np_target = 0.96*np_x + 0.24" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Training\n", + "# Training\n", + "loss_history = []\n", + "for epoch in range(200):\n", + " current_loss = train([np_x, np_target])[0]\n", + " loss_history.append(current_loss)\n", + " if epoch % 20 == 0:\n", + " print(\"Loss: %.03f, w, b: [%.02f, %.02f]\" % (current_loss, K.eval(w), K.eval(b)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also plot the loss history:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Plot loss history" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# %load solutions/sol13.py" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Final Note:\n", + "\n", + "Please switch back your backend to `tensorflow` before moving on. It may be useful for next notebooks !-)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.3" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/1.3 Introduction - Keras.ipynb b/1.3 Introduction - Keras.ipynb deleted file mode 100644 index 973ab2f..0000000 --- a/1.3 Introduction - Keras.ipynb +++ /dev/null @@ -1,878 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "\n", - "\n", - "## Keras: Deep Learning library for Theano and TensorFlow" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Keras is a minimalist, highly modular neural networks library, written in Python and capable of running on top of either TensorFlow or Theano. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.\n", - "ref: https://keras.io/" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Why this name, Keras?\n", - "\n", - "Keras (κέρας) means _horn_ in Greek. It is a reference to a literary image from ancient Greek and Latin literature, first found in the _Odyssey_, where dream spirits (_Oneiroi_, singular _Oneiros_) are divided between those who deceive men with false visions, who arrive to Earth through a gate of ivory, and those who announce a future that will come to pass, who arrive through a gate of horn. It's a play on the words κέρας (horn) / κραίνω (fulfill), and ἐλέφας (ivory) / ἐλεφαίρομαι (deceive).\n", - "\n", - "Keras was initially developed as part of the research effort of project ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System).\n", - "\n", - ">_\"Oneiroi are beyond our unravelling --who can be sure what tale they tell? Not all that men look for comes to pass. Two gates there are that give passage to fleeting Oneiroi; one is made of horn, one of ivory. The Oneiroi that pass through sawn ivory are deceitful, bearing a message that will not be fulfilled; those that come out through polished horn have truth behind them, to be accomplished for men who see them.\"_ Homer, Odyssey 19. 562 ff (Shewring translation)." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "### Kaggle Challenge Data (again)\n", - "\n", - "See: [Data Description](1.2 Introduction - Tensorflow.ipynb#kaggle)" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Using TensorFlow backend.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "9 classes\n", - "93 dims\n" - ] - } - ], - "source": [ - "from kaggle_data import load_data, preprocess_data, preprocess_labels\n", - "\n", - "X_train, labels = load_data('data/kaggle_ottogroup/train.csv', train=True)\n", - "X_train, scaler = preprocess_data(X_train)\n", - "Y_train, encoder = preprocess_labels(labels)\n", - "\n", - "X_test, ids = load_data('data/kaggle_ottogroup/test.csv', train=False)\n", - "\n", - "X_test, _ = preprocess_data(X_test, scaler)\n", - "\n", - "nb_classes = Y_train.shape[1]\n", - "print(nb_classes, 'classes')\n", - "\n", - "dims = X_train.shape[1]\n", - "print(dims, 'dims')" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "---" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Hands On - Keras Logistic Regression\n" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "from keras.models import Sequential\n", - "from keras.layers import Dense, Activation" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "93 dims\n", - "Building model...\n", - "9 classes\n", - "Epoch 1/10\n", - "61878/61878 [==============================] - 2s - loss: 1.0577 \n", - "Epoch 2/10\n", - "61878/61878 [==============================] - 3s - loss: 0.7702 \n", - "Epoch 3/10\n", - "61878/61878 [==============================] - 2s - loss: 0.7283 \n", - "Epoch 4/10\n", - "61878/61878 [==============================] - 2s - loss: 0.7075 \n", - "Epoch 5/10\n", - "61878/61878 [==============================] - 2s - loss: 0.6945 \n", - "Epoch 6/10\n", - "61878/61878 [==============================] - 2s - loss: 0.6854 \n", - "Epoch 7/10\n", - "61878/61878 [==============================] - 2s - loss: 0.6787 \n", - "Epoch 8/10\n", - "61878/61878 [==============================] - 2s - loss: 0.6735 \n", - "Epoch 9/10\n", - "61878/61878 [==============================] - 2s - loss: 0.6694 \n", - "Epoch 10/10\n", - "61878/61878 [==============================] - 2s - loss: 0.6659 \n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "dims = X_train.shape[1]\n", - "print(dims, 'dims')\n", - "print(\"Building model...\")\n", - "\n", - "nb_classes = Y_train.shape[1]\n", - "print(nb_classes, 'classes')\n", - "\n", - "model = Sequential()\n", - "model.add(Dense(nb_classes, input_shape=(dims,)))\n", - "model.add(Activation('softmax'))\n", - "model.compile(optimizer='sgd', loss='categorical_crossentropy')\n", - "model.fit(X_train, Y_train)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Simplicity is pretty impressive right? :)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Now lets understand:\n", - "
The core data structure of Keras is a model, a way to organize layers. The main type of model is the Sequential model, a linear stack of layers.
\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "What we did here is stacking a Fully Connected (Dense) layer of trainable weights from the input to the output and an Activation layer on top of the weights layer." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "##### Dense" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, - "source": [ - "```python\n", - "from keras.layers.core import Dense\n", - "\n", - "Dense(units, activation=None, use_bias=True, \n", - " kernel_initializer='glorot_uniform', bias_initializer='zeros', \n", - " kernel_regularizer=None, bias_regularizer=None, \n", - " activity_regularizer=None, kernel_constraint=None, bias_constraint=None)\n", - "```" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "* `units`: int > 0.\n", - "\n", - "* `init`: name of initialization function for the weights of the layer (see initializations), or alternatively, Theano function to use for weights initialization. This parameter is only relevant if you don't pass a weights argument.\n", - "\n", - "* `activation`: name of activation function to use (see activations), or alternatively, elementwise Theano function. If you don't specify anything, no activation is applied (ie. \"linear\" activation: a(x) = x).\n", - "\n", - "* `weights`: list of Numpy arrays to set as initial weights. The list should have 2 elements, of shape (input_dim, output_dim) and (output_dim,) for weights and biases respectively.\n", - "\n", - "* `kernel_regularizer`: instance of WeightRegularizer (eg. L1 or L2 regularization), applied to the main weights matrix.\n", - "\n", - "* `bias_regularizer`: instance of WeightRegularizer, applied to the bias.\n", - "\n", - "* `activity_regularizer`: instance of ActivityRegularizer, applied to the network output.\n", - "\n", - "* `kernel_constraint`: instance of the constraints module (eg. maxnorm, nonneg), applied to the main weights matrix.\n", - "\n", - "* `bias_constraint`: instance of the constraints module, applied to the bias.\n", - "\n", - "* `use_bias`: whether to include a bias (i.e. make the layer affine rather than linear)." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## (some) others `keras.core.layers`" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "* `keras.layers.core.Flatten()`\n", - "* `keras.layers.core.Reshape(target_shape)`\n", - "* `keras.layers.core.Permute(dims)`\n", - "\n", - "```python\n", - "model = Sequential()\n", - "model.add(Permute((2, 1), input_shape=(10, 64)))\n", - "# now: model.output_shape == (None, 64, 10)\n", - "# note: `None` is the batch dimension\n", - "```\n", - "\n", - "* `keras.layers.core.Lambda(function, output_shape=None, arguments=None)`\n", - "* `keras.layers.core.ActivityRegularization(l1=0.0, l2=0.0)`" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "\n", - "\n", - "Credits: Yam Peleg ([@Yampeleg](https://twitter.com/yampeleg))" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "##### Activation" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, - "source": [ - "```python\n", - "from keras.layers.core import Activation\n", - "\n", - "Activation(activation)\n", - "```" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "**Supported Activations** : [https://keras.io/activations/]\n", - "\n", - "**Advanced Activations**: [https://keras.io/layers/advanced-activations/]" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "##### Optimizer" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "If you need to, you can further configure your optimizer. A core principle of Keras is to make things reasonably simple, while allowing the user to be fully in control when they need to (the ultimate control being the easy extensibility of the source code).\n", - "Here we used SGD (stochastic gradient descent) as an optimization algorithm for our trainable weights. " - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "\n", - "\n", - "Source & Reference: http://sebastianruder.com/content/images/2016/09/saddle_point_evaluation_optimizers.gif" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "\"Data Sciencing\" this example a little bit more\n", - "=====" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "What we did here is nice, however in the real world it is not useable because of overfitting.\n", - "Lets try and solve it with cross validation." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "##### Overfitting" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "In overfitting, a statistical model describes random error or noise instead of the underlying relationship. Overfitting occurs when a model is excessively complex, such as having too many parameters relative to the number of observations. \n", - "\n", - "A model that has been overfit has poor predictive performance, as it overreacts to minor fluctuations in the training data." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "source": [ - "\n", - "" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "
To avoid overfitting, we will first split out data to training set and test set and test out model on the test set.\n",
-    "Next: we will use two of keras's callbacks EarlyStopping and ModelCheckpoint
" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "---" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let's see first the model we implemented" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "_________________________________________________________________\n", - "Layer (type) Output Shape Param # \n", - "=================================================================\n", - "dense_2 (Dense) (None, 9) 846 \n", - "_________________________________________________________________\n", - "activation_2 (Activation) (None, 9) 0 \n", - "=================================================================\n", - "Total params: 846.0\n", - "Trainable params: 846.0\n", - "Non-trainable params: 0.0\n", - "_________________________________________________________________\n" - ] - } - ], - "source": [ - "model.summary()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "from sklearn.model_selection import train_test_split\n", - "from keras.callbacks import EarlyStopping, ModelCheckpoint" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Train on 52596 samples, validate on 9282 samples\n", - "Epoch 1/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6634 - val_loss: 0.6561\n", - "Epoch 2/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6626 - val_loss: 0.6562\n", - "Epoch 3/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6619 - val_loss: 0.6562\n", - "Epoch 4/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6613 - val_loss: 0.6562\n", - "Epoch 5/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6607 - val_loss: 0.6561\n", - "Epoch 6/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6601 - val_loss: 0.6557\n", - "Epoch 7/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6596 - val_loss: 0.6554\n", - "Epoch 8/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6591 - val_loss: 0.6551\n", - "Epoch 9/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6586 - val_loss: 0.6550\n", - "Epoch 10/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6582 - val_loss: 0.6548\n", - "Epoch 11/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6577 - val_loss: 0.6545\n", - "Epoch 12/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6572 - val_loss: 0.6544\n", - "Epoch 13/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6568 - val_loss: 0.6541\n", - "Epoch 14/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6563 - val_loss: 0.6538\n", - "Epoch 15/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6559 - val_loss: 0.6534\n", - "Epoch 16/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6555 - val_loss: 0.6533\n", - "Epoch 17/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6551 - val_loss: 0.6534\n", - "Epoch 18/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6548 - val_loss: 0.6529\n", - "Epoch 19/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6544 - val_loss: 0.6525\n", - "Epoch 20/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6540 - val_loss: 0.6523\n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "X_train, X_val, Y_train, Y_val = train_test_split(X_train, Y_train, test_size=0.15, random_state=42)\n", - "\n", - "fBestModel = 'best_model.h5' \n", - "early_stop = EarlyStopping(monitor='val_loss', patience=4, verbose=1) \n", - "best_model = ModelCheckpoint(fBestModel, verbose=0, save_best_only=True)\n", - "model.fit(X_train, Y_train, validation_data = (X_val, Y_val), epochs=20, \n", - " batch_size=128, verbose=True, callbacks=[best_model, early_stop]) " - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Multi-Layer Perceptron and Fully Connected" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "So, how hard can it be to build a Multi-Layer percepton with keras?\n", - "It is baiscly the same, just add more layers!" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "_________________________________________________________________\n", - "Layer (type) Output Shape Param # \n", - "=================================================================\n", - "dense_3 (Dense) (None, 100) 9400 \n", - "_________________________________________________________________\n", - "dense_4 (Dense) (None, 9) 909 \n", - "_________________________________________________________________\n", - "activation_3 (Activation) (None, 9) 0 \n", - "=================================================================\n", - "Total params: 10,309.0\n", - "Trainable params: 10,309.0\n", - "Non-trainable params: 0.0\n", - "_________________________________________________________________\n" - ] - } - ], - "source": [ - "model = Sequential()\n", - "model.add(Dense(100, input_shape=(dims,)))\n", - "model.add(Dense(nb_classes))\n", - "model.add(Activation('softmax'))\n", - "model.compile(optimizer='sgd', loss='categorical_crossentropy')\n", - "model.summary()" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Train on 52596 samples, validate on 9282 samples\n", - "Epoch 1/20\n", - "52596/52596 [==============================] - 1s - loss: 1.2076 - val_loss: 0.8897\n", - "Epoch 2/20\n", - "52596/52596 [==============================] - 1s - loss: 0.8247 - val_loss: 0.7779\n", - "Epoch 3/20\n", - "52596/52596 [==============================] - 0s - loss: 0.7595 - val_loss: 0.7378\n", - "Epoch 4/20\n", - "52596/52596 [==============================] - 1s - loss: 0.7289 - val_loss: 0.7153\n", - "Epoch 5/20\n", - "52596/52596 [==============================] - 1s - loss: 0.7101 - val_loss: 0.7008\n", - "Epoch 6/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6973 - val_loss: 0.6903\n", - "Epoch 7/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6880 - val_loss: 0.6814\n", - "Epoch 8/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6809 - val_loss: 0.6760\n", - "Epoch 9/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6753 - val_loss: 0.6711\n", - "Epoch 10/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6705 - val_loss: 0.6678\n", - "Epoch 11/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6669 - val_loss: 0.6642\n", - "Epoch 12/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6636 - val_loss: 0.6607\n", - "Epoch 13/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6608 - val_loss: 0.6588\n", - "Epoch 14/20\n", - "52596/52596 [==============================] - 1s - loss: 0.6584 - val_loss: 0.6565\n", - "Epoch 15/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6563 - val_loss: 0.6559\n", - "Epoch 16/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6545 - val_loss: 0.6547\n", - "Epoch 17/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6529 - val_loss: 0.6524\n", - "Epoch 18/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6513 - val_loss: 0.6503\n", - "Epoch 19/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6500 - val_loss: 0.6489\n", - "Epoch 20/20\n", - "52596/52596 [==============================] - 0s - loss: 0.6487 - val_loss: 0.6481\n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "model.fit(X_train, Y_train, validation_data = (X_val, Y_val), epochs=20, \n", - " batch_size=128, verbose=True)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Your Turn!" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Hands On - Keras Fully Connected\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Take couple of minutes and Try and optimize the number of layers and the number of parameters in the layers to get the best results. " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "model = Sequential()\n", - "model.add(Dense(100, input_shape=(dims,)))\n", - "\n", - "# ...\n", - "# ...\n", - "# Play with it! add as much layers as you want! try and get better results.\n", - "\n", - "model.add(Dense(nb_classes))\n", - "model.add(Activation('softmax'))\n", - "model.compile(optimizer='sgd', loss='categorical_crossentropy')\n", - "model.fit(X_train, Y_train, validation_data = (X_val, Y_val), epochs=20, \n", - " batch_size=128, verbose=True)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Building a question answering system, an image classification model, a Neural Turing Machine, a word2vec embedder or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful?" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "#### Theoretical Motivations for depth" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - ">Much has been studied about the depth of neural nets. Is has been proven mathematically[1] and empirically that convolutional neural network benifit from depth! " - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "[1] - On the Expressive Power of Deep Learning: A Tensor Analysis - Cohen, et al 2015" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "#### Theoretical Motivations for depth" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "One much quoted theorem about neural network states that:" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - ">Universal approximation theorem states[1] that a feed-forward network with a single hidden layer containing a finite number of neurons (i.e., a multilayer perceptron), can approximate continuous functions on compact subsets of $\\mathbb{R}^n$, under mild assumptions on the activation function. The theorem thus states that simple neural networks can represent a wide variety of interesting functions when given appropriate parameters; however, it does not touch upon the algorithmic learnability of those parameters." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "[1] - Approximation Capabilities of Multilayer Feedforward Networks - Kurt Hornik 1991" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.2" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/1.4 Keras Backend.ipynb b/1.4 Keras Backend.ipynb deleted file mode 100644 index b70d98c..0000000 --- a/1.4 Keras Backend.ipynb +++ /dev/null @@ -1,497 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "# Linear Regression\n", - "To get familiar with automatic differentiation, we start by learning a simple linear regression model using Stochastic Gradient Descent (SGD).\n", - "\n", - "Recall that given a dataset $\\{(x_i, y_i)\\}_{i=0}^N$, with $x_i, y_i \\in \\mathbb{R}$, the objective of linear regression is to find two scalars $w$ and $b$ such that $y = w\\cdot x + b$ fits the dataset. In this tutorial we will learn $w$ and $b$ using SGD and a Mean Square Error (MSE) loss:\n", - "\n", - "$$\\mathcal{l} = \\frac{1}{N} \\sum_{i=0}^N (w\\cdot x_i + b - y_i)^2$$\n", - "\n", - "Starting from random values, parameters $w$ and $b$ will be updated at each iteration via the following rule:\n", - "\n", - "$$w_t = w_{t-1} - \\eta \\frac{\\partial \\mathcal{l}}{\\partial w}$$\n", - "
\n", - "$$b_t = b_{t-1} - \\eta \\frac{\\partial \\mathcal{l}}{\\partial b}$$\n", - "\n", - "where $\\eta$ is the learning rate.\n", - "\n", - "**NOTE:** Recall that **linear regression** is indeed a **simple neuron** with a linear activation function!!" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Placeholders and variables\n", - "To implement and run this simple model, we will use the [Keras backend module](http://keras.io/backend/), which provides an abstraction over Theano and Tensorflow, two popular tensor manipulation libraries that provide automatic differentiation.\n", - "\n", - "First of all, we define the necessary variables and placeholders for our computational graph. Variables maintain state across executions of the computational graph, while placeholders are ways to feed the graph with external data.\n", - "\n", - "For the linear regression example, we need three variables: `w`, `b`, and the learning rate for SGD, `lr`. Two placeholders `x` and `target` are created to store $x_i$ and $y_i$ values." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Using TensorFlow backend.\n" - ] - } - ], - "source": [ - "import keras.backend as K\n", - "import numpy as np\n", - "\n", - "# Placeholders and variables\n", - "x = K.placeholder()\n", - "target = K.placeholder()\n", - "lr = K.variable(0.1)\n", - "w = K.variable(np.random.rand())\n", - "b = K.variable(np.random.rand())" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, - "source": [ - "## Model definition\n", - "Now we can define the $y = w\\cdot x + b$ relation as well as the MSE loss in the computational graph." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "# Define model and loss\n", - "y = w * x + b\n", - "loss = K.mean(K.square(y-target))" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "Then, given the gradient of MSE wrt to `w` and `b`, we can define how we update the parameters via SGD:" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "grads = K.gradients(loss, [w,b])\n", - "updates = [(w, w-lr*grads[0]), (b, b-lr*grads[1])]" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "The whole model can be encapsulated in a `function`, which takes as input `x` and `target`, returns the current loss value and updates its parameter according to `updates`." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "train = K.function(inputs=[x, target], outputs=[loss], updates=updates)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Training\n", - "Training is now just a matter of calling the `function` we have just defined. Each time `train` is called, indeed, `w` and `b` will be updated using the SGD rule.\n", - "\n", - "Having generated some random training data, we will feed the `train` function for several epochs and observe the values of `w`, `b`, and loss." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loss: 0.045, w, b: [0.48, 0.38]\n", - "Loss: 0.010, w, b: [0.64, 0.41]\n", - "Loss: 0.006, w, b: [0.72, 0.37]\n", - "Loss: 0.003, w, b: [0.78, 0.34]\n", - "Loss: 0.002, w, b: [0.82, 0.31]\n", - "Loss: 0.001, w, b: [0.86, 0.30]\n", - "Loss: 0.001, w, b: [0.88, 0.28]\n", - "Loss: 0.000, w, b: [0.90, 0.27]\n", - "Loss: 0.000, w, b: [0.92, 0.26]\n", - "Loss: 0.000, w, b: [0.93, 0.26]\n" - ] - } - ], - "source": [ - "# Generate data\n", - "np_x = np.random.rand(1000)\n", - "np_target = 0.96*np_x + 0.24\n", - "\n", - "# Training\n", - "loss_history = []\n", - "for epoch in range(200):\n", - " current_loss = train([np_x, np_target])[0]\n", - " loss_history.append(current_loss)\n", - " if epoch % 20 == 0:\n", - " print(\"Loss: %.03f, w, b: [%.02f, %.02f]\" % (current_loss, K.eval(w), K.eval(b)))" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "We can also plot the loss history:" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - }, - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEACAYAAABYq7oeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X+4lHWd//HnC/CgIKaEZKGgCWJqpVJo1tYYrmC1e7RS\noa2lr1Rb/mi/a+2Cu7Yedq/d0uuqtK9LfSv6hmQXV7H5i/xBhrPlZnJKgjSQ0w9YEFASTQQEPLy/\nf3zuA+PMHGbO4ZyZM+e8Htd1X3PPfX/mM58Zhnmdz+ee+/4oIjAzMys0qN4NMDOzvsfhYGZmJRwO\nZmZWwuFgZmYlHA5mZlbC4WBmZiWqCgdJ0yStkbRW0uwy+5skLZLUJukRSWOL9o+VtF3StQXb1kla\nKWmFpOWH/lLMzKynVAwHSYOAW4GpwOnADEmnFhWbBWyLiAnAzcBNRfu/BNxbtG0fkIuIsyJicnca\nb2ZmvaOansNkoC0i1kfEXmAR0FxUphlYkK0vBqZ07JDUDPwOeKLoMary+c3MrMaq+XIeA2wouL8x\n21a2TES0A89LGilpGPAPwFxSGBQK4AFJrZI+3p3Gm5lZ7xhSRZniL3VIX+wHK6OszFzgyxGxU1Jx\nufMiYoukY4EfSVodEQ9X2W4zM+tF1YTDRqDwAPPxwKaiM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R2kruMQ4PaI+EJ2QcTvkf6K+B/g0oh4vn4t7bskfRfI\nAa8GniZdefhO4PuUef8k3QpMA3YA/ysiHqtDs/ukTt7L80lj5fuAdcDfdHxhZfPAzCKdPLt/HhhL\nJL0d+AnpD76Oy2X8IylEy/7/7urns8+Gg5mZ1U9fHVYyM7M6cjiYmVkJh4OZmZVwOJiZWQmHg5mZ\nlXA4mJlZCYeDmZmVcDiYmVmJ/w856gDqst6XTAAAAABJRU5ErkJggg==\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "# Plot loss history\n", - "import matplotlib.pyplot as plt\n", - "%matplotlib inline\n", - "plt.plot(loss_history)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Your Turn\n", - "\n", - "Please switch to the **Theano** backend and re-run the notebook.\n", - "\n", - "You _should_ see no difference in the execution!\n", - "\n", - "**Reminder**: please keep in mind that you *can* execute shell commands from a notebook (pre-pending a `!` sign).\n", - "Thus:\n", - "\n", - "```shell\n", - " !cat ~/.keras/keras.json\n", - "```\n", - "should show you the content of your keras configuration file." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Logistic Regression" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let's try to re-implement the Logistic Regression Model using the `keras.backend` APIs.\n", - "\n", - "The following code will look like very similar to what we would write in Theano or Tensorflow - with the *only difference* that it may run on both the two backends." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "from kaggle_data import load_data, preprocess_data, preprocess_labels" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "9 classes\n", - "93 dims\n" - ] - } - ], - "source": [ - "X_train, labels = load_data('data/kaggle_ottogroup/train.csv', train=True)\n", - "X_train, scaler = preprocess_data(X_train)\n", - "Y_train, encoder = preprocess_labels(labels)\n", - "\n", - "X_test, ids = load_data('data/kaggle_ottogroup/test.csv', train=False)\n", - "\n", - "X_test, _ = preprocess_data(X_test, scaler)\n", - "\n", - "nb_classes = Y_train.shape[1]\n", - "print(nb_classes, 'classes')\n", - "\n", - "dims = X_train.shape[1]\n", - "print(dims, 'dims')" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "feats = dims\n", - "training_steps = 25" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "x = K.placeholder(dtype=\"float\", shape=X_train.shape) \n", - "target = K.placeholder(dtype=\"float\", shape=Y_train.shape)\n", - "\n", - "# Set model weights\n", - "W = K.variable(np.random.rand(dims, nb_classes))\n", - "b = K.variable(np.random.rand(nb_classes))" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "# Define model and loss\n", - "y = K.dot(x, W) + b\n", - "loss = K.categorical_crossentropy(y, target)" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "activation = K.softmax(y) # Softmax" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "# Minimize error using cross entropy\n", - "cross_entropy = K.categorical_crossentropy(activation, target)\n", - "loss = K.mean(-K.sum(cross_entropy))" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "grads = K.gradients(loss, [W,b])\n", - "updates = [(W, W-lr*grads[0]), (b, b-lr*grads[1])]" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "train = K.function(inputs=[x, target], outputs=[loss], updates=updates)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false, - "scrolled": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loss: -218494.890625\n", - "Loss: -989694.875\n" - ] - } - ], - "source": [ - "# Training\n", - "loss_history = []\n", - "for epoch in range(training_steps):\n", - " current_loss = train([X_train, Y_train])[0]\n", - " loss_history.append(current_loss)\n", - " if epoch % 20 == 0:\n", - " print(\"Loss: {}\".format(current_loss))" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaoAAAEPCAYAAAATXoCrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcFNW9///Xe1g0YBg2QQSEEYgajLtoFnXQqIiPiNeI\nwSBBXGLikvw0RjDEMIQkXkmMRr3e3K9ixBU1XhWjUVCcLNcFjMENQYyCMIgim4Bhm/n8/uiasWl6\nNpbp0nk/H496UP2pU+ecrmn60+dUdbUiAjMzs7QqKnQHzMzM6uJEZWZmqeZEZWZmqeZEZWZmqeZE\nZWZmqeZEZWZmqZbKRCVpoqQ3JM2W9KCkdlnbrpQ0P9l+QlZ8kKS5kt6UNDor3lvS85LmSbpXUssk\n3lrSlKSu5yTtVV8bZmbW9FKZqIBpQP+IOAiYD1wJIOmLwBnAfsBJwM3KKAJuAk4E+gNnSto3qesa\n4NqI2AdYBZybxM8FVkREP+B6YGJdbezk52tmZrVIZaKKiKcioip5+DzQI1k/BZgSEZsjYgGZJDYg\nWeZHxMKI2ARMAYYk+xwLPJisTwZOTdaHJI8B/piUq6sNMzMrgFQmqhznAI8n692BRVnbKpJYbnwx\n0F1SJ2BlVtJbnJTdoq6IqARWS+pYRxtmZlYALQvVsKTpQNfsEBDA2Ih4NCkzFtgUEfdmlckV5E+4\nkZTP3af6nlG11VVb3MzMCqBgiSoijq9ru6SRwGA+mZKDzIioZ9bjHsASMsllr9x4RHwoqb2komRU\nVV0+u64l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v/rVr+jbty/FxcUcfvjhVFRU1Nrf6k+whx56KP3792f27Nk129577z1O\nP/10unTpQp8+fbjxxhtrtq1fv56RI0fSsWNH+vfvz69//Wt69vzkRwRKSkqYOHEiBx54ILvtthtV\nVVV11jdr1iwOP/xwiouL6datG5dffjkAGzZsYMSIEXTu3JkOHTpwxBFHsGzZMgAGDhxYc/wigl/8\n4hf07t2bPfbYg7PPPpuPPvoIyIwei4qKuOOOO+jVqxddunThV7/6VYP/ptmefvppSkpKuPrqq+nW\nrRvf/e53WbFiBSeffDJdunShU6dOnHLKKSxZ8skPKBx11FHccccdAEyaNInS0lIuu+wyOnToQN++\nfZk+ffo2lX377bc56qijKC4uZtCgQVx44YWMGjWqzn5PmDCBzp0706dPH+67774tyixfvpzBgwfT\nrl07vvrVr27xPcZLLrmEnj170r59e4444giee+65mm0vvPAChx56aM3fLntU/n//9398+ctfpkOH\nDhxyyCH87W9/25bD3niFvpPup3XJHDprqHzHa/jwsoC1AZG1rI3hw8saXO+OqKN3797x9NNPbxV/\n+umno3PnzjF79uzYuHFjXHLJJXH00UdHRMSyZcuiXbt28fDDD0dlZWX87ne/i9atW8ekSZMiIuL2\n22+Po446KiIinnzyyTjssMPio48+ioiIuXPnxtKlSyMi4uyzz46rrrqq1v5MnDgxDjjggJg/f35E\nRLzyyiuxYsWKrfq6YMGCKCoqis2bN0dExHPPPRdt27aNhx9+OCIiqqqq4tBDD41f/OIXsXnz5njn\nnXeiT58+MW3atIiIGD16dJSWlsbq1aujoqIiDjjggOjZs+cWfTr44IOjoqIi1q9fX299X/7yl+Ou\nu+6KiIh169bFCy+8EBER//M//xOnnHJKTR0vvfRSrFmzJiIiSktLa47fpEmTol+/frFgwYJYt25d\nnHbaaTFixIia5yopvvvd78aGDRvi5Zdfjl122SXmzp1b598537F+6qmnomXLlvHTn/40Nm3aFOvX\nr49ly5bFww8/HBs2bIg1a9bEN7/5zRg6dGjNPl/72tdi8uTJERFx6623RuvWreP222+PqqqquPHG\nG7c4bo0pO2DAgLjyyitj06ZN8de//jU+//nPx6hRo/I+l+p+jx49OjZu3BgzZsyINm3axL/+9a+I\niDjrrLNi9913j5deeik2b94c3/rWt2qOX0TEXXfdFatWrYrKysqYOHFidO/ePTZu3BgREYcffnhM\nmTIlIiLWrl0bM2fOjIiIRYsWRadOnWL69OkRkXldd+7cOe/rMSL///mseKPebz2isoKpqKgC2uZE\n27JkSVW+4jutjtrcc889nHvuuRx44IG0atWKq6++mueff553332XP//5z+y///4MGTKEoqIifvCD\nH9C1a9e89bRq1Yo1a9YwZ84cIoJ99tmn1rK5Jk2axC9/+Uv69u0LwJe+9CU6dOiQt2xEsPvuu9Om\nTRu++tWvcuGFF9aM0mbNmsWHH37I2LFjadGiBb179+a8885jypQpADzwwAOMHTuWdu3aseeee/KD\nH/xgq/p/+MMfsueee7LLLrvUW1+rVq146623WL58OW3atGHAgAE18eXLl/Pmm28iiYMPPrjmvFru\nsb/sssvo1asXbdq04eqrr2bKlClUVWX+rpIoKyujdevWHHDAARx44IG8/PLLDTqmuVq1akVZWRkt\nW7Zkl112oXPnzgwZMoTWrVuz2267MWbMGP7yl7/Uun+fPn0YOXIkkhg5ciSLFy9mxYoVDSpbUVHB\nihUrePvtt3nllVcYN24cLVu25KijjuLkk0+us98tWrSgrKyMVq1aMXDgQAYNGsQDDzxQs/3000/n\n4IMPpkWLFgwfPnyL0fXw4cMpLi6mqKiIyy+/nI8++oi33noLgNatWzN//nxWrFhB27ZtOfzwwwG4\n4447GDJkCF//+tcBOOGEEzjwwAN54oknGnagt4MTlRVM9+5FwLqcaONuSbUj6qjNkiVL6NXrk3Nd\nbdu2pWPHjlRUVLBkyZItpsYAevTokbeegQMHcvHFF3PRRRexxx578L3vfY+1a9c2qA+LFi1i7733\nblBZSSxfvpx169bxm9/8hvLycjZv3gxkpssqKiro2LEjHTt2pEOHDlx99dV88MEHNc81u/+5zy33\n+dVX32233ca8efPYd999OeKII3jssceAzEn+E088kWHDhtGjRw9Gjx5NZWXlVm3lHvtevXqxefNm\n3n///ZpYdrJv06ZNg49prq5du25xXurjjz/mvPPOo1evXrRv357jjjuODz/8sNb999hjjy36AdTa\nl9yyEcHatWt577336NSpU82FHpD/b5CtU6dO7LrrrjWPe/XqtcUUZW5b2X2aOHEi++23Hx06dKBj\nx458/PHHNc/xD3/4A6+//jr77LMPRx55JH/+85+BzN/8nnvu2eJv/sILL2zR5s7iRGUFM2HC2fTp\nM45PEs06+vQZx4QJZzdpHbXZc889t5jXX7duHcuXL6d79+5069aNRYsWbVF+8eLFtdZ18cUX8+KL\nL/L6668zb948fv3rXwOZ5FKXnj178q9//avBfY4IJHHppZeyyy671FzV1rNnT/bee29WrFjBihUr\nWLlyJatXr+bRRx+tea7Z/X/33Xe3qju7r/XV16dPH+655x6WLVvGFVdcwemnn86///1vWrZsyVVX\nXcXrr7/Os88+y5/+9KeaczjZco/9woULadWqVYNHoo2R+zeYOHEiCxcu5MUXX2TVqlU15wt3pm7d\nurF8+XI2btxYE8t9feVavnw5GzZ88ruy7777LnvuuWe9bT3zzDNcd911PPTQQ6xcuZKVK1fStm3b\nmvOb/fr1495772XZsmVcdtllfPOb32Tjxo307NmTc845Z4u/+Zo1a/jRj360jc+64ZyorGBKSnox\nffolDB/+GwYOHLdNt6TaEXUAbNy4kQ0bNtQslZWVfPvb3+YPf/gDr7zyChs2bOAnP/kJRx55JHvt\ntRcnn3wyr732GlOnTqWyspKbbrppi0/72V588UVmzpzJ5s2b+dznPseuu+5a8wm+a9euvP3227X2\n67zzzuOqq66qmZZ59dVXWblyZd6y1W801caMGcM111zDxo0bGTBgAO3atWPixImsX7+eyspKXn/9\ndV588UUAhg4dytVXX82qVauoqKjgv/7rv+o8XvXVd/fdd9d8Qi8uLkYSLVq0oLy8nNdee42qqip2\n2203WrVqRcuWW198fOaZZ3LdddexYMEC1q5dy9ixYxk2bBhFRUV5n+uOtGbNGtq0aUNxcTHLly9n\n/Pid/8sIe++9N1/60pcYP348mzZt4u9//3vNKLQ2lZWVlJWV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fRbSa9Jmi6pU1L2IEnPJXekfrD6jtSS+iTlZkt6MbmjCMDnJT0g6Q1Jdxbs\nSZrVw4nKLKUk7UvmB+a+EhGHkLndzHCgDTAzIvYnc3uacckuk4EfJ3ekfi0rfjdwYxL/CvBeEj8I\n+AHwRaCPpK/s/Gdl1ngtC90BM6vVccAhwCxJAnYlcx+9KjL3jAO4C3hQUjugOPkBQ8gkrfuTmwZ3\nj4ipABGxESBTHTMj4r3k8WygN/BsEzwvs0ZxojJLLwGTI2LsFkHpqpxykVU+Xx212ZC1XonfDyyl\nPPVnll5PA6dL2h1AUgdJewEtgNOTMsOBv0fER8CK5G7VACOAv0TEGmCRpCFJHa0lfa5Jn4XZdvIn\nKLOUiog3JP0UmCapCNgIXAysAwYkI6v3yZzHgsxvHP1PkojeBkYl8RHA/5P086SOofma23nPxGz7\n+Gc+zD5lJK2JiM8Xuh9mTcVTf2afPv50ac2KR1RmZpZqHlGZmVmqOVGZmVmqOVGZmVmqOVGZmVmq\nOVGZmVmqOVGZmVmq/f8TBfwcp3ZQPwAAAABJRU5ErkJggg==\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#plotting\n", - "plt.plot(range(len(loss_history)), loss_history, 'o', label='Logistic Regression Training phase')\n", - "plt.ylabel('cost')\n", - "plt.xlabel('epoch')\n", - "plt.legend()\n", - "plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.2" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/2.2 CNN HandsOn - MNIST Dataset.ipynb b/2.0 - MNIST Dataset.ipynb similarity index 81% rename from 2.2 CNN HandsOn - MNIST Dataset.ipynb rename to 2.0 - MNIST Dataset.ipynb index 4c4fbc6..6c43362 100644 --- a/2.2 CNN HandsOn - MNIST Dataset.ipynb +++ b/2.0 - MNIST Dataset.ipynb @@ -3,21 +3,30 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } }, "source": [ - "# CNN HandsOn with Keras" + "# MNIST Dataset" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Also known as `digits` if you're familiar with `sklearn`:\n", + "\n", + "```python\n", + "\n", + "from sklearn.datasets import digits\n", + "\n", + "```" ] }, { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -32,8 +41,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -54,8 +61,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -72,9 +77,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -91,9 +94,7 @@ "execution_count": null, "metadata": { "code_folding": [], - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "fragment" } @@ -107,8 +108,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -121,9 +120,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -137,9 +134,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -153,9 +148,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -169,9 +162,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -185,9 +176,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -201,9 +190,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -217,9 +204,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -233,9 +218,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -249,9 +232,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, + "collapsed": true, "slideshow": { "slide_type": "subslide" } @@ -265,8 +246,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -284,8 +263,6 @@ "execution_count": null, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -302,8 +279,6 @@ "execution_count": null, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -317,9 +292,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -337,8 +310,6 @@ "execution_count": null, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -352,9 +323,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [] @@ -376,9 +345,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.5.3" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/2.1 Hidden Layer Representation and Embeddings.ipynb b/2.1 Hidden Layer Representation and Embeddings.ipynb new file mode 100644 index 0000000..64f17ab --- /dev/null +++ b/2.1 Hidden Layer Representation and Embeddings.ipynb @@ -0,0 +1,871 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Fully Connected Feed-Forward Network\n", + "\n", + "In this notebook we will play with Feed-Forward FC-NN (Fully Connected Neural Network) for a *classification task*: \n", + "\n", + "Image Classification on MNIST Dataset\n", + "\n", + "**RECALL**\n", + "\n", + "In the FC-NN, the output of each layer is computed using the activations from the previous one, as follows:\n", + "\n", + "$$h_{i} = \\sigma(W_i h_{i-1} + b_i)$$\n", + "\n", + "where ${h}_i$ is the activation vector from the $i$-th layer (or the input data for $i=0$), ${W}_i$ and ${b}_i$ are the weight matrix and the bias vector for the $i$-th layer, respectively. \n", + "
\n", + "$\\sigma(\\cdot)$ is the activation function. In our example, we will use the *ReLU* activation function for the hidden layers and *softmax* for the last layer.\n", + "\n", + "To regularize the model, we will also insert a Dropout layer between consecutive hidden layers. \n", + "\n", + "Dropout works by “dropping out” some unit activations in a given layer, that is setting them to zero with a given probability.\n", + "\n", + "Our loss function will be the **categorical crossentropy**." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Model definition\n", + "Keras supports two different kind of models: the [Sequential](http://keras.io/models/#sequential) model and the [Graph](http://keras.io/models/#graph) model. The former is used to build linear stacks of layer (so each layer has one input and one output), and the latter supports any kind of connection graph.\n", + "\n", + "In our case we build a Sequential model with three [Dense](http://keras.io/layers/core/#dense) (aka fully connected) layers, with some [Dropout](http://keras.io/layers/core/#dropout). Notice that the output layer has the softmax activation function. \n", + "\n", + "The resulting model is actually a `function` of its own inputs implemented using the Keras backend. \n", + "\n", + "We apply the binary crossentropy loss and choose SGD as the optimizer. \n", + "\n", + "Please remind that Keras supports a variety of different [optimizers](http://keras.io/optimizers/) and [loss functions](http://keras.io/objectives/), which you may want to check out. " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Introducing ReLU" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The **ReLu** function is defined as $f(x) = \\max(0, x),$ [1]\n", + "\n", + "A smooth approximation to the rectifier is the *analytic function*: $f(x) = \\ln(1 + e^x)$\n", + "\n", + "which is called the **softplus** function.\n", + "\n", + "The derivative of softplus is $f'(x) = e^x / (e^x + 1) = 1 / (1 + e^{-x})$, i.e. the **logistic function**.\n", + "\n", + "[1] [http://www.cs.toronto.edu/~fritz/absps/reluICML.pdf]() by G. E. Hinton " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Note: Keep in mind this function as it is heavily used in CNN" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Using TensorFlow backend.\n" + ] + } + ], + "source": [ + "from keras.models import Sequential\n", + "from keras.layers.core import Dense\n", + "from keras.optimizers import SGD\n", + "\n", + "nb_classes = 10\n", + "\n", + "# FC@512+relu -> FC@512+relu -> FC@nb_classes+softmax\n", + "# ... your Code Here" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# %load solutions/sol21.py" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Data preparation (`keras.dataset`)\n", + "\n", + "We will train our model on the MNIST dataset, which consists of 60,000 28x28 grayscale images of the 10 digits, along with a test set of 10,000 images. \n", + "\n", + "![](imgs/mnist.png)\n", + "\n", + "Since this dataset is **provided** with Keras, we just ask the `keras.dataset` model for training and test data.\n", + "\n", + "We will:\n", + "\n", + "* download the data\n", + "* reshape data to be in vectorial form (original data are images)\n", + "* normalize between 0 and 1.\n", + "\n", + "The `binary_crossentropy` loss expects a **one-hot-vector** as input, therefore we apply the `to_categorical` function from `keras.utilis` to convert integer labels to **one-hot-vectors**." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from keras.datasets import mnist\n", + "from keras.utils import np_utils\n", + "\n", + "(X_train, y_train), (X_test, y_test) = mnist.load_data()\n", + "X_train = X_train.reshape(60000, 784)\n", + "X_test = X_test.reshape(10000, 784)\n", + "X_train = X_train.astype(\"float32\")\n", + "X_test = X_test.astype(\"float32\")\n", + "\n", + "# Put everything on grayscale\n", + "X_train /= 255\n", + "X_test /= 255\n", + "\n", + "# convert class vectors to binary class matrices\n", + "Y_train = np_utils.to_categorical(y_train, 10)\n", + "Y_test = np_utils.to_categorical(y_test, 10)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Split Training and Validation Data" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from sklearn.model_selection import train_test_split\n", + "\n", + "X_train, X_val, Y_train, Y_val = train_test_split(X_train, Y_train)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(784,)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "X_train[0].shape" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALE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Cw9EDqd8bpuTYR/l6SV0x5fIGl3A33MKCJ2V7f7JD2uwZt9eO+pSVKr230N9/P/Bmnm\n5plmltYAvHaDNON1E+F/RtIq2xfZPkPSByVtbqCPt7A9Uv0hRrZHJL1fgzf78GZJ66v76yU90WAv\nP2NQZm5uNbO0Gn7tBm3G60ZO8qmGMj4raUjSRET8dd+bmIHtX9TU0V6amsT04SZ7s/2IpGs19auv\nvZLulvQvkh6T9POSXpf0gYjo+x/eWvR2reY4c3OPems1s/Q2Nfja1TnjdS39cIYfkBNn+AFJEX4g\nKcIPJEX4gaQIP5AU4QeSIvxAUoQfSOr/AJdb49R+7hOAAAAAAElFTkSuQmCC\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plt.imshow(X_train[0].reshape(28, 28))" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0 1 2 3 4 5 6 7 8 9]\n", + "[0 0 0 0 0 0 0 1 0 0]\n" + ] + } + ], + "source": [ + "print(np.asarray(range(10)))\n", + "print(Y_train[0].astype('int'))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADohJREFUeJzt3X+QVfV5x/HP47osBPAHEAxFDMQwqDWT1a4QozVmjA4Y\nJ5CksSEzKf3lph1pk6nTaG06Oh3rOJ38kDYZRow74kz8NTVUkjqJlppqWoa4EAsYUmTMqht2WBET\n0FZgl6d/7CHdwJ7v3b333Hvu7vN+zTD33vOcc88zd/jsufd+zz1fc3cBiOeUshsAUA7CDwRF+IGg\nCD8QFOEHgiL8QFCEHwi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cu0df1KuF1K+PIv1jSHnd/yd2PSHpY0vIS+mh67v6MpAMnLF4uaX12f72G\n/vM0XE5vTcHd+9x9W3b/kKTjM0uX+tol+ipFGeGfK+nVYY971VxTfrukJ81sq5l1lt3MCM7Kpk0/\nPn367JL7OVHFmZsb6YSZpZvmtatmxuuilRH+kWb/aaYhh8vc/WJJyyTdmL29xeiMaubmRhlhZumm\nUO2M10UrI/y9kuYNe3y2pL0l9DEid9+b3fZL2qDmm3143/FJUrPb/pL7+ZVmmrl5pJml1QSvXTPN\neF1G+J+TtNDMFpjZJEmflrSxhD5OYmZTsy9iZGZTJV2j5pt9eKOkVdn9VZIeL7GXX9MsMzfnzSyt\nkl+7ZpvxupSTfLKhjLsltUjqcve/a3gTIzCz92joaC8NTWL6YJm9mdlDkq7U0K++9km6TdI/S3pU\n0jmSXpH0KXdv+BdvOb1dqaG3rr+aufn4Z+wG93a5pGcl7ZB0LFt8q4Y+X5f22iX6WqkSXjfO8AOC\n4gw/ICjCDwRF+IGgCD8QFOEHgiL8QFCEHwiK8ANB/R+rqTZuA0QxYwAAAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plt.imshow(X_val[0].reshape(28, 28))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0 1 2 3 4 5 6 7 8 9]\n", + "[0 0 0 1 0 0 0 0 0 0]\n" + ] + } + ], + "source": [ + "print(np.asarray(range(10)))\n", + "print(Y_val[0].astype('int'))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Training\n", + "Having defined and compiled the model, it can be trained using the `fit` function. We also specify a validation dataset to monitor validation loss and accuracy." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 45000 samples, validate on 15000 samples\n", + "Epoch 1/2\n", + "45000/45000 [==============================] - 6s - loss: 1.2717 - acc: 0.7238 - val_loss: 0.6574 - val_acc: 0.8535\n", + "Epoch 2/2\n", + "45000/45000 [==============================] - 6s - loss: 0.5226 - acc: 0.8696 - val_loss: 0.4406 - val_acc: 0.8867\n" + ] + } + ], + "source": [ + "network_history = model.fit(X_train, Y_train, batch_size=128, \n", + " epochs=2, verbose=1, validation_data=(X_val, Y_val))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Plotting Network Performance Trend\n", + "The return value of the `fit` function is a `keras.callbacks.History` object which contains the entire history of training/validation loss and accuracy, for each epoch. We can therefore plot the behaviour of loss and accuracy during the training phase." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VOX5//H3nT2BLIQQFsMS2ZMYIISlbAmgFBBcKUrF\nFkWpuKAiP6v92opba1sUiqKIC1apKK0W2QStJLIIQpBFCEECAVkNCRCWELI9vz9mSAYIIZBMzkzm\nfl3XXJ0588zkPkj55DnnWcQYg1JKKQXgZXUBSimlXIeGglJKqTIaCkoppcpoKCillCqjoaCUUqqM\nhoJSSqkyGgpKKaXKaCgopZQqo6GglFKqjI/VBVypiIgI06pVK6vLUEopt7Jhw4YcY0yjy7Vzu1Bo\n1aoVaWlpVpehlFJuRUT2VqWdXj5SSilVRkNBKaVUGQ0FpZRSZdzunoJSqu4oKipi//79FBQUWF1K\nnREQEEBUVBS+vr5X9XkNBaWUZfbv309wcDCtWrVCRKwux+0ZY8jNzWX//v1ER0df1Xfo5SOllGUK\nCgpo2LChBkINEREaNmxYrZ6XhoJSylIaCDWrun+eHhMKOafO8sKidI7nF1pdilJKuSyPCYXVmTnM\nXp1F/ympzFm7l5JS3ZtaKU+Xm5tL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nZZQx7vxLnojMxXb5L8J+n+RZwBfAGDMT232ToUAmkA/cU6M/343/7JRSStWwunj5SCml1FXSUFBK\nKVVGQ0EppVQZDQWllFJlNBSUUkqV0VBQyk5ESkRkk8PjkiuvXsV3t7rUqpdKuZI6N09BqWo4Y4zp\nbHURSllJewpKXYaI7BGRv4rIOvujjf14S/veFOf2qGhhP95YRP4rIpvtj172r/IWkbft+xx8KSKB\n9vYTHPa6+Nii01QK0FBQylHgBZeP7nB474QxpjvwOjDNfux1bEsYxwP/Aqbbj08HvjHGdMK2Lv42\n+/G22Ja1jgWOA7fbjz8FdLF/zwPOOjmlqkJnNCtlJyKnjDH1Kzi+BxhgjNktIr7AYWNMQxHJAZoa\nY4rsxw8ZYyJE5AgQ5bjooNh29/vKGNPW/vr3gK8x5kURWQqcwrZu0XxjzCknn6pSl6Q9BaWqxlzi\n+aXaVMRxZdoSyu/p3QjMALoCG+wr9yplCQ0FparmDof/XWN//i3liyneBayyP/8a25aniIi3iJzb\nFewi9n0fmhtjUoAngTBsCxcqZQn9jUSpcoEissnh9VJjzLlhqf4i8h22X6RG2Y9NAN4Tkf+Hbanm\nc6tVPgrMEpGx2HoE44FLLW3sDcwRkVBsm6dMdeMNcVQdoPcUlLoM+z2FRGNMjtW1KOVsevlIKaVU\nGe0pKKWUKqM9BaWUUmU0FJRSSpXRUFBKKVVGQ0EppVQZDQWllFJlNBSUUkqV+f8nbM4pALBz1AAA\nAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd4VGXa+PHvTUhISKeXEBJ6QqSEIYgNEXABRewSC4vr\nymt/X8uu6I9VQF1Z166sigrWlXV1dQNSbNhRCBY0oQUIEELvpJf798cMMAkJGSCTyST357pyMefM\n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ZAJlwJ9Udbfvoj41Hl7z3cDLInInzuaYCf785U9E3sHZjNjK9Rzm\nQSAQQFVfxPlcZjSQBeQD19fq5/vx350xxpg60piaoYwxxpwkSxbGGGNqZMnCGGNMjSxZGGOMqZEl\nC2OMMTWyZGFMDUSkTER+dvupdibbkzh3XHWziBpTnzSacRbGnIICVe3n6yCM8SWrWRhzkkQkW0T+\nJiJLXT/dXPs7u9YGObxGSKxrf1sR+UBEfnH9nOE6VYCIvOxaZ+JjEQlxlb/Dba2ROT66TGMASxbG\neCKkUjPUVW7vHVDVFOB54GnXvudxThXdB3gbeNa1/1ngS1Xti3NdggzX/u44pw/vDewDLnPtnwT0\nd53nJm9dnDGesBHcxtRARA6palgV+7OB81R1vYgEAttUtaWI7ALaq2qJa/9WVW0lIjuBGPfJGsW5\nGuMnqtrdtX0vEKiqD4vIQuAQznmdPlTVQ16+VGOqZTULY06NVvO6ujJVcZ/pt4yjzxIvAGYAA4Dl\nrpmQjfEJSxbGnJqr3P5c4nr9HUcnobwG+Mb1+jOcS9ciIgEicngVt2O41t3opKqLgT8DUTgnfDTG\nJ+ybijE1CxGRn922F6rq4e6zzUTkB5xfvFJd++4AZonIn3BOiX149s//BWaKyA04axA3A9VNIR0A\nvCUikTgXtXnKjxcqMg2APbMw5iS5nlk4VHWXr2MxxtusGcoYY0yNrGZhjDGmRlazMMYYUyNLFsYY\nY2pkycIYY0yNLFkYY4ypkSULY4wxNbJkYYwxpkb/H/4VJ1MBiwVHAAAAAElFTkSuQmCC\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import matplotlib.pyplot as plt\n", + "%matplotlib inline\n", + "\n", + "def plot_history(network_history):\n", + " plt.figure()\n", + " plt.xlabel('Epochs')\n", + " plt.ylabel('Loss')\n", + " plt.plot(network_history.history['loss'])\n", + " plt.plot(network_history.history['val_loss'])\n", + " plt.legend(['Training', 'Validation'])\n", + "\n", + " plt.figure()\n", + " plt.xlabel('Epochs')\n", + " plt.ylabel('Accuracy')\n", + " plt.plot(network_history.history['acc'])\n", + " plt.plot(network_history.history['val_acc'])\n", + " plt.legend(['Training', 'Validation'], loc='lower right')\n", + " plt.show()\n", + "\n", + "plot_history(network_history)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "After `2` epochs, we get a `~88%` validation accuracy. \n", + "\n", + "* If you increase the number of epochs, you will get definitely better results." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Quick Exercise: \n", + "\n", + "Try increasing the number of epochs (if you're hardware allows to)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Your code here\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Introducing the Dropout Layer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The **dropout layers** have the very specific function to *drop out* a random set of activations in that layers by setting them to zero in the forward pass. Simple as that. \n", + "\n", + "It allows to avoid *overfitting* but has to be used **only** at training time and **not** at test time. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "```python\n", + "\n", + "keras.layers.core.Dropout(rate, noise_shape=None, seed=None)\n", + "```\n", + "\n", + "Applies Dropout to the input.\n", + "\n", + "Dropout consists in randomly setting a fraction rate of input units to 0 at each update during training time, which helps prevent overfitting.\n", + "\n", + "Arguments\n", + "\n", + "* rate: float between 0 and 1. Fraction of the input units to drop.\n", + "* noise_shape: 1D integer tensor representing the shape of the binary dropout mask that will be multiplied with the input. For instance, if your inputs have shape (batch_size, timesteps, features) and you want the dropout mask to be the same for all timesteps, you can use noise_shape=(batch_size, 1, features).\n", + "* seed: A Python integer to use as random seed." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Note** Keras guarantess automatically that this layer is **not** used in **Inference** (i.e. Prediction) phase\n", + "(thus only used in **training** as it should be!)\n", + "\n", + "See `keras.backend.in_train_phase` function" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from keras.layers.core import Dropout\n", + "\n", + "## Pls note **where** the `K.in_train_phase` is actually called!!\n", + "Dropout??" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from keras import backend as K\n", + "\n", + "K.in_train_phase?" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Exercise:\n", + "\n", + "Try modifying the previous example network adding a Dropout layer:" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from keras.layers.core import Dropout\n", + "\n", + "# FC@512+relu -> DropOut(0.2) -> FC@512+relu -> DropOut(0.2) -> FC@nb_classes+softmax\n", + "# ... your Code Here" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# %load solutions/sol22.py" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 45000 samples, validate on 15000 samples\n", + "Epoch 1/4\n", + "45000/45000 [==============================] - 7s - loss: 1.3793 - acc: 0.6377 - val_loss: 0.6832 - val_acc: 0.8490\n", + "Epoch 2/4\n", + "45000/45000 [==============================] - 6s - loss: 0.6157 - acc: 0.8335 - val_loss: 0.4507 - val_acc: 0.8828\n", + "Epoch 3/4\n", + "45000/45000 [==============================] - 7s - loss: 0.4775 - acc: 0.8635 - val_loss: 0.3786 - val_acc: 0.8983\n", + "Epoch 4/4\n", + "45000/45000 [==============================] - 7s - loss: 0.4165 - acc: 0.8798 - val_loss: 0.3410 - val_acc: 0.9056\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VPW9//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UrgfjxwIfBFrc2C9h0W1RI7CSXOuXIzuwV4G2/0zjPOueVmdh+w\nyDk3F+8fz/+a2Rq8dL3av4rr18RjudXMLgXK8Y7lWt8KboCZzcAb/dHZzPKBe/A60HDOPQG8gTfS\nZQ1QDHzPn0ob14RjGQ/cZGblQAlwdYj+0jEG+DawNNB+DXAX0AfC7nNpyrGEy+fSHfirmUXiBdds\n59xrrfUdphnNIiJSrS02H4mISDMpFEREpJpCQUREqikURESkmkJBRESqKRREAsysosYKmrlWx6q0\nJ7DvjPpWVRUJJW1unoLICSgJLC0g0m7pTEGkEWa2wcx+G1jjfoGZ9Q88f5KZvRtYjPBdM+sTeL6r\nmb0cWHgtz8zODOwq0syeCqyR/8/AbFXM7FYzWxHYz0yfDlMEUCiI1BRfq/loYo3X9jnnRgJ/BKYH\nnvsj3rLSmcDzwCOB5x8B/hNYeC0bWB54fgDwmHNuCFAIXBl4fiowIrCfKcE6OJGm0IxmkQAzO+Cc\nS6jj+Q3AV5xz6wKLrm13zqWZ2W6gu3PucOD5bc65zma2C+hVY6HCquWc33HODQg8/gkQ7Zz7lZm9\nBRzAW7XzlRpr6Yu0Op0piDSNq+d+fdvU5VCN+xUc6dP7GvAY3gq3iwOrXor4QqEg0jQTa/w5P3B/\nHkcWIvsW8FHg/rvATVB9sZSk+nZqZhFAb+fc+8CPgRTgmLMVkdai30hEjoivscImwFvOuaphqbFm\n9ineL1KTAs/dCjxjZj8CdnFkBdEfAE+a2fV4ZwQ3AfUtNx0J/N3MkvEunDItsIa+iC/UpyDSiECf\nQo5zbrfftYgEm5qPRESkms4URESkms4URESkmkJBRESqKRRERKSaQkFERKopFEREpJpCQUREqv1/\nbP7w4+XSn3MAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAAC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2qsO5Mf4FWKOqD7ZTLCI+l2DOJYI+l74i4nNfJwLnAp+1Khaya1i3eVKeqtaJyM3A\nmzh3Ez2pqqtEZDZQqKoLcP5R/VVE1uNk4+neRdy+IM/lVhG5GKjDOZfrPAv4CETkOZy7UfqISDFw\nD07HHar6J+B1nDtv1gOHgOu9iTSwIM7lCuBGEakDKoHpYfpl5DTg68BKt30c4EdANkTc5xLMuUTK\n5zIQeEZEYnAS2nxVfa2rrmE2gtsYY0xA3akZyhhjTAdZsjDGGBOQJQtjjDEBWbIwxhgTkCULY4wx\nAVmyMCYAEan3m5G0SNqY5fcYjp3T3iy1xoSTbjPOwphjUOlOsWBMt2U1C2M6SEQ2ichv3GcMfCwi\nx7vrh4jI2+4kjm+LSLa7vr+IvOxOWLdcRCa5h4oRkcfdZxT8wx2di4jcKiKr3ePM9eg0jQEsWRgT\njMRWzVDT/LaVq+pE4I/AHHfdH3Gm7x4PPAv83l3/e+Df7oR1+cAqd/1w4BFVHQOUApe762cBee5x\nbgjVyRkTDBvBbUwAIlKhqsltrN8EfElVN7iT1e1Q1QwR2QMMVNVad/12Ve0jIruBLL8JHhunzX5L\nVYe7y/8JxKrqL0RkIVCBMwvqK37PMjCmy1nNwphjo+28bq9MW6r9XtfT3Jf4ZeARnBmDl7qziBrj\nCUsWxhybaX6/P3Bfv0/zBG5XA++5r98GboSmh9iktndQEekBDFbVRcAPAB9wWO3GmK5i31SMCSzR\nb8ZSgIWq2nj7bLyIfITzxWuGu+5W4EkR+T6wm+YZWb8HPCYi38KpQdwItDetdwzwNxFJw3mgzUPu\nMwyM8YT1WRjTQW6fRYGq7vE6FmNCzZqhjDHGBGQ1C2OMMQFZzcIYY0xAliyMMcYEZMnCGGNMQJYs\njDHGBGTJwhhjTECWLIwxxgT0/8JXmCG/empdAAAAAElFTkSuQmCC\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "network_history = model.fit(X_train, Y_train, batch_size=128, \n", + " epochs=4, verbose=1, validation_data=(X_val, Y_val))\n", + "plot_history(network_history)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* If you continue training, at some point the validation loss will start to increase: that is when the model starts to **overfit**. \n", + "\n", + "It is always necessary to monitor training and validation loss during the training of any kind of Neural Network, either to detect overfitting or to evaluate the behaviour of the model **(any clue on how to do it??)**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# %load solutions/sol23.py" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Inspecting Layers" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "_________________________________________________________________\n", + "Layer (type) Output Shape Param # \n", + "=================================================================\n", + "dense_4 (Dense) (None, 512) 401920 \n", + "_________________________________________________________________\n", + "dropout_1 (Dropout) (None, 512) 0 \n", + "_________________________________________________________________\n", + "dense_5 (Dense) (None, 512) 262656 \n", + "_________________________________________________________________\n", + "dropout_2 (Dropout) (None, 512) 0 \n", + "_________________________________________________________________\n", + "dense_6 (Dense) (None, 10) 5130 \n", + "=================================================================\n", + "Total params: 669,706\n", + "Trainable params: 669,706\n", + "Non-trainable params: 0\n", + "_________________________________________________________________\n" + ] + } + ], + "source": [ + "# We already used `summary`\n", + "model.summary()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### `model.layers` is iterable" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model Input Tensors: Tensor(\"dense_4_input:0\", shape=(?, 784), dtype=float32)\n", + "\n", + "Layers - Network Configuration:\n", + "\n", + "dense_4 True\n", + "Layer Configuration:\n", + "{'kernel_constraint': None, 'use_bias': True, 'trainable': True, 'dtype': 'float32', 'units': 512, 'name': 'dense_4', 'bias_constraint': None, 'kernel_regularizer': None, 'bias_initializer': {'config': {}, 'class_name': 'Zeros'}, 'kernel_initializer': {'config': {'seed': None, 'mode': 'fan_avg', 'distribution': 'uniform', 'scale': 1.0}, 'class_name': 'VarianceScaling'}, 'activity_regularizer': None, 'batch_input_shape': (None, 784), 'activation': 'relu', 'bias_regularizer': None}\n", + "----------------------------------------\n", + "dropout_1 True\n", + "Layer Configuration:\n", + "{'name': 'dropout_1', 'rate': 0.2, 'trainable': True}\n", + "----------------------------------------\n", + "dense_5 True\n", + "Layer Configuration:\n", + "{'bias_constraint': None, 'use_bias': True, 'trainable': True, 'units': 512, 'name': 'dense_5', 'kernel_constraint': None, 'kernel_regularizer': None, 'bias_initializer': {'config': {}, 'class_name': 'Zeros'}, 'kernel_initializer': {'config': {'seed': None, 'mode': 'fan_avg', 'distribution': 'uniform', 'scale': 1.0}, 'class_name': 'VarianceScaling'}, 'activity_regularizer': None, 'activation': 'relu', 'bias_regularizer': None}\n", + "----------------------------------------\n", + "dropout_2 True\n", + "Layer Configuration:\n", + "{'name': 'dropout_2', 'rate': 0.2, 'trainable': True}\n", + "----------------------------------------\n", + "dense_6 True\n", + "Layer Configuration:\n", + "{'bias_constraint': None, 'use_bias': True, 'trainable': True, 'units': 10, 'name': 'dense_6', 'kernel_constraint': None, 'kernel_regularizer': None, 'bias_initializer': {'config': {}, 'class_name': 'Zeros'}, 'kernel_initializer': {'config': {'seed': None, 'mode': 'fan_avg', 'distribution': 'uniform', 'scale': 1.0}, 'class_name': 'VarianceScaling'}, 'activity_regularizer': None, 'activation': 'softmax', 'bias_regularizer': None}\n", + "----------------------------------------\n", + "Model Output Tensors: Tensor(\"dense_6/Softmax:0\", shape=(?, 10), dtype=float32)\n" + ] + } + ], + "source": [ + "print('Model Input Tensors: ', model.input, end='\\n\\n')\n", + "print('Layers - Network Configuration:', end='\\n\\n')\n", + "for layer in model.layers:\n", + " print(layer.name, layer.trainable)\n", + " print('Layer Configuration:')\n", + " print(layer.get_config(), end='\\n{}\\n'.format('----'*10))\n", + "print('Model Output Tensors: ', model.output)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Extract hidden layer representation of the given data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "One simple way to do it is to use the weights of your model to build a new model that's truncated at the layer you want to read. \n", + "\n", + "Then you can run the `._predict(X_batch)` method to get the activations for a batch of inputs." + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "model_truncated = Sequential()\n", + "model_truncated.add(Dense(512, activation='relu', input_shape=(784,)))\n", + "model_truncated.add(Dropout(0.2))\n", + "model_truncated.add(Dense(512, activation='relu'))\n", + "\n", + "for i, layer in enumerate(model_truncated.layers):\n", + " layer.set_weights(model.layers[i].get_weights())\n", + "\n", + "model_truncated.compile(loss='categorical_crossentropy', optimizer=SGD(), \n", + " metrics=['accuracy'])" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Check\n", + "np.all(model_truncated.layers[0].get_weights()[0] == model.layers[0].get_weights()[0])" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "hidden_features = model_truncated.predict(X_train)" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(45000, 512)" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hidden_features.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(45000, 784)" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "X_train.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "from sklearn.manifold import TSNE\n", + "\n", + "tsne = TSNE(n_components=2)\n", + "X_tsne = tsne.fit_transform(hidden_features) " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "colors = np.ar" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "colors = 'bgrcmykpoa'\n", + "color_classes = np.argmax()\n", + "plt.scatter(X_tsne[:,0], X_tsne[:, 1], c=colors[Y_train])" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.3" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/2.2.1 CNN HandsOn - MNIST & FC Nets.ipynb b/2.2.1 CNN HandsOn - MNIST & FC Nets.ipynb deleted file mode 100644 index feb5bc0..0000000 --- a/2.2.1 CNN HandsOn - MNIST & FC Nets.ipynb +++ /dev/null @@ -1,254 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "# Fully Connected Feed-Forward Network\n", - "\n", - "In this notebook we will play with Feed-Forward FC-NN (Fully Connected Neural Network) for a *classification task*: Image Classification on MNIST Dataset\n", - "\n", - "**RECALL**\n", - "\n", - "In the FC-NN, the output of each layer is computed using the activations from the previous one, as follows:\n", - "\n", - "$$h_{i} = \\sigma(W_i h_{i-1} + b_i)$$\n", - "\n", - "where ${h}_i$ is the activation vector from the $i$-th layer (or the input data for $i=0$), ${W}_i$ and ${b}_i$ are the weight matrix and the bias vector for the $i$-th layer, respectively. \n", - "
\n", - "$\\sigma(\\cdot)$ is the activation function. In our example, we will use the *ReLU* activation function for the hidden layers and *softmax* for the last layer.\n", - "\n", - "To regularize the model, we will also insert a Dropout layer between consecutive hidden layers. \n", - "\n", - "Dropout works by “dropping out” some unit activations in a given layer, that is setting them to zero with a given probability.\n", - "\n", - "Our loss function will be the **categorical crossentropy**." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Model definition\n", - "Keras supports two different kind of models: the [Sequential](http://keras.io/models/#sequential) model and the [Graph](http://keras.io/models/#graph) model. The former is used to build linear stacks of layer (so each layer has one input and one output), and the latter supports any kind of connection graph.\n", - "\n", - "In our case we build a Sequential model with three [Dense](http://keras.io/layers/core/#dense) (aka fully connected) layers, with some [Dropout](http://keras.io/layers/core/#dropout). Notice that the output layer has the softmax activation function. \n", - "\n", - "The resulting model is actually a `function` of its own inputs implemented using the Keras backend. \n", - "\n", - "We apply the binary crossentropy loss and choose SGD as the optimizer. \n", - "\n", - "Please remind that Keras supports a variety of different [optimizers](http://keras.io/optimizers/) and [loss functions](http://keras.io/objectives/), which you may want to check out. " - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Using TensorFlow backend.\n" - ] - } - ], - "source": [ - "from keras.models import Sequential\n", - "from keras.layers.core import Dense, Dropout\n", - "from keras.optimizers import SGD\n", - "\n", - "nb_classes = 10\n", - "\n", - "# FC@512+relu -> DropOut(0.2) -> FC@512+relu -> DropOut(0.2) -> FC@nb_classes+softmax\n", - "# ... your Code Here" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "# Decomment and Execute this cell to get the solution\n", - "# %load solutions/sol_221_1.py" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Data preparation (`keras.dataset`)\n", - "\n", - "We will train our model on the MNIST dataset, which consists of 60,000 28x28 grayscale images of the 10 digits, along with a test set of 10,000 images. \n", - "\n", - "![](imgs/mnist.png)\n", - "\n", - "Since this dataset is **provided** with Keras, we just ask the `keras.dataset` model for training and test data.\n", - "\n", - "We will:\n", - "\n", - "* download the data\n", - "* reshape data to be in vectorial form (original data are images)\n", - "* normalize between 0 and 1.\n", - "\n", - "The `binary_crossentropy` loss expects a **one-hot-vector** as input, therefore we apply the `to_categorical` function from `keras.utilis` to convert integer labels to **one-hot-vectors**." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "from keras.datasets import mnist\n", - "from keras.utils import np_utils\n", - "\n", - "(X_train, y_train), (X_test, y_test) = mnist.load_data()\n", - "X_train = X_train.reshape(60000, 784)\n", - "X_test = X_test.reshape(10000, 784)\n", - "X_train = X_train.astype(\"float32\")\n", - "X_test = X_test.astype(\"float32\")\n", - "X_train /= 255\n", - "X_test /= 255\n", - "\n", - "# convert class vectors to binary class matrices\n", - "Y_train = np_utils.to_categorical(y_train, 10)\n", - "Y_test = np_utils.to_categorical(y_test, 10)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "## Training\n", - "Having defined and compiled the model, it can be trained using the `fit` function. We also specify a validation dataset to monitor validation loss and accuracy." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, - "scrolled": true - }, - "outputs": [], - "source": [ - "network_history = model.fit(X_train, Y_train, batch_size=128, \n", - " epochs=100, verbose=1, validation_data=(X_test, Y_test))" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "### Plotting Network Performance Trend\n", - "The return value of the `fit` function is a `keras.callbacks.History` object which contains the entire history of training/validation loss and accuracy, for each epoch. We can therefore plot the behaviour of loss and accuracy during the training phase." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "%matplotlib inline\n", - "\n", - "plt.figure()\n", - "plt.xlabel('Epochs')\n", - "plt.ylabel('Loss')\n", - "plt.plot(network_history.history['loss'])\n", - "plt.plot(network_history.history['val_loss'])\n", - "plt.legend(['Training', 'Validation'])\n", - "\n", - "plt.figure()\n", - "plt.xlabel('Epochs')\n", - "plt.ylabel('Accuracy')\n", - "plt.plot(network_history.history['acc'])\n", - "plt.plot(network_history.history['val_acc'])\n", - "plt.legend(['Training', 'Validation'], loc='lower right')" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, - "source": [ - "After `100` epochs, we get a `98.8%` validation accuracy. \n", - "\n", - "If you continue training, at some point the validation loss will start to increase: that is when the model starts to **overfit**. \n", - "\n", - "It is always necessary to monitor training and validation loss during the training of any kind of Neural Network, either to detect overfitting or to evaluate the behaviour of the model **(any clue on how to do it??)**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "# %load solutions/sol_221_2.py" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.2" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/2.1 Convolutional Neural Networks.ipynb b/Intro cnn.ipynb similarity index 90% rename from 2.1 Convolutional Neural Networks.ipynb rename to Intro cnn.ipynb index bc08ba0..53358e9 100644 --- a/2.1 Convolutional Neural Networks.ipynb +++ b/Intro cnn.ipynb @@ -3,8 +3,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -16,8 +14,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "skip" } @@ -31,8 +27,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -44,8 +38,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -59,8 +51,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -73,8 +63,6 @@ "cell_type": "markdown", "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "-" } @@ -88,8 +76,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -103,8 +89,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -118,8 +102,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -131,8 +113,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -143,10 +123,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "\n", "\n", @@ -156,8 +133,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -173,8 +148,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -185,10 +158,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "What we want the computer to do is to be able to differentiate between all the images it’s given and figure out the unique features that make a dog a dog or that make a cat a cat. " ] @@ -196,8 +166,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -211,8 +179,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -223,10 +189,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "> A more detailed overview of what CNNs do would be that you take the image, pass it through a series of convolutional, nonlinear, pooling (downsampling), and fully connected layers, and get an output. As we said earlier, the output can be a single class or a probability of classes that best describes the image. \n", "\n", @@ -236,8 +199,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -249,8 +210,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -261,10 +220,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "\n", "" @@ -273,8 +229,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -286,10 +240,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "A Convolutional Filter much like a **kernel** in image recognition is a small matrix useful for blurring, sharpening, embossing, edge detection, and more. \n", "\n", @@ -301,8 +252,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -314,10 +263,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -325,8 +271,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -338,8 +282,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -351,8 +293,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -366,8 +306,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -379,8 +317,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -392,8 +328,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -404,10 +338,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -415,8 +346,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -428,8 +357,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -441,8 +368,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -454,8 +379,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -467,8 +390,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -482,8 +403,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -495,8 +414,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -511,8 +428,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -524,8 +439,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -537,8 +450,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -556,8 +467,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -571,8 +480,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -594,8 +501,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -607,8 +512,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -620,8 +523,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -633,8 +534,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -645,10 +544,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -656,8 +552,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -669,8 +563,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -686,8 +578,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -701,8 +591,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -714,8 +602,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -729,8 +615,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -742,8 +626,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -755,8 +637,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -767,10 +647,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -801,8 +678,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -814,8 +689,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -838,8 +711,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -905,8 +776,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -918,8 +787,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -944,8 +811,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1023,8 +888,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1051,8 +914,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1064,8 +925,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1077,8 +936,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1090,8 +947,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1111,8 +966,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1162,9 +1015,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.5.3" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/solutions/sol11.py b/solutions/sol11.py new file mode 100644 index 0000000..e957570 --- /dev/null +++ b/solutions/sol11.py @@ -0,0 +1,2 @@ +y = w * x + b +loss = K.mean(K.square(y-target)) \ No newline at end of file diff --git a/solutions/sol12.py b/solutions/sol12.py new file mode 100644 index 0000000..70ad4a6 --- /dev/null +++ b/solutions/sol12.py @@ -0,0 +1,2 @@ +grads = K.gradients(loss, [w,b]) +updates = [(w, w-lr*grads[0]), (b, b-lr*grads[1])] \ No newline at end of file diff --git a/solutions/sol13.py b/solutions/sol13.py new file mode 100644 index 0000000..181d8e2 --- /dev/null +++ b/solutions/sol13.py @@ -0,0 +1,5 @@ +plt.plot(range(len(loss_history)), loss_history, 'o', label='Linear Regression Training phase') +plt.ylabel('cost') +plt.xlabel('epoch') +plt.legend() +plt.show() \ No newline at end of file diff --git a/solutions/sol21.py b/solutions/sol21.py new file mode 100644 index 0000000..1f54912 --- /dev/null +++ b/solutions/sol21.py @@ -0,0 +1,11 @@ +from keras.models import Sequential +from keras.layers.core import Dense, Dropout +from keras.optimizers import SGD + +model = Sequential() +model.add(Dense(512, activation='relu', input_shape=(784,))) +model.add(Dense(512, activation='relu')) +model.add(Dense(10, activation='softmax')) + +model.compile(loss='categorical_crossentropy', optimizer=SGD(), + metrics=['accuracy']) \ No newline at end of file diff --git a/solutions/sol_221_1.py b/solutions/sol22.py similarity index 100% rename from solutions/sol_221_1.py rename to solutions/sol22.py diff --git a/solutions/sol_221_2.py b/solutions/sol23.py similarity index 100% rename from solutions/sol_221_2.py rename to solutions/sol23.py diff --git a/1.1 Introduction - Deep Learning and ANN.ipynb b/to remove/1.1 Introduction - Deep Learning and ANN.ipynb similarity index 98% rename from 1.1 Introduction - Deep Learning and ANN.ipynb rename to to remove/1.1 Introduction - Deep Learning and ANN.ipynb index 19e169d..c75b7e0 100644 --- a/1.1 Introduction - Deep Learning and ANN.ipynb +++ b/to remove/1.1 Introduction - Deep Learning and ANN.ipynb @@ -3,8 +3,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "24ca50a0-b9ad-425d-a28f-6bd3ca3ac378" }, @@ -19,8 +17,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "3896ecb2-47fa-4dbc-a2ff-9c76e9dfe93e" }, @@ -35,8 +31,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "8c3060aa-fee9-438c-bc60-4685c0eb4750" }, @@ -51,8 +45,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "6287766f-972f-4b4d-bee7-5418f0af74de" }, @@ -67,8 +59,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "2f1c6299-954a-461a-b5c1-a86a1d12ad15" }, @@ -83,8 +73,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -101,8 +89,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "5e13607b-3ec5-4a95-a2d8-f898f20748da" }, @@ -117,8 +103,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "4fa2e86a-be32-4e78-96d9-f511a07e3908" }, @@ -133,8 +117,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "df0121bc-10f1-4ace-840e-6fc89c6fdc7f" }, @@ -149,8 +131,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "c25d7194-10bd-4196-9d4c-592bf6e188f9" }, @@ -165,8 +145,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "15260f90-13d1-4fcc-afc6-379c507cb950" }, @@ -181,8 +159,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "nbpresent": { "id": "92d4603e-7e39-4156-818c-785df6189fe8" }, @@ -198,8 +174,6 @@ "cell_type": "markdown", "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "nbpresent": { "id": "356d5ec7-3392-4daa-9671-4cc7111c5c91" }, @@ -216,8 +190,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -228,10 +200,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -239,8 +208,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -251,10 +218,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "\n", "\n", @@ -271,8 +235,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -304,10 +266,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "In **gradient descent optimization**, we update all the **weights simultaneously** after each epoch, and we define the _partial derivative_ for each weight $w_j$ in the weight vector $w$ as follows:\n", "\n", @@ -359,8 +318,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -372,8 +329,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -556,8 +511,6 @@ "cell_type": "markdown", "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "nbpresent": { "id": "5678486b-caf4-440b-be62-2f1286982c71" }, @@ -581,8 +534,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -593,10 +544,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -604,8 +552,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "skip" } @@ -619,8 +565,6 @@ "execution_count": 1, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "skip" } @@ -640,8 +584,6 @@ "execution_count": 2, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "skip" } @@ -659,8 +601,6 @@ "execution_count": 3, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -676,8 +616,6 @@ "execution_count": 4, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -691,9 +629,6 @@ "cell_type": "code", "execution_count": 5, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -718,9 +653,6 @@ "cell_type": "code", "execution_count": 6, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -745,9 +677,6 @@ "cell_type": "code", "execution_count": 7, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -783,8 +712,6 @@ "cell_type": "markdown", "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -798,8 +725,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -810,10 +735,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "" ] @@ -823,8 +745,6 @@ "execution_count": 8, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -842,8 +762,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -859,8 +777,6 @@ "execution_count": 9, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -875,8 +791,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -889,9 +803,7 @@ "cell_type": "code", "execution_count": 10, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -904,8 +816,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -920,9 +830,7 @@ "cell_type": "code", "execution_count": 11, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -934,8 +842,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -951,8 +857,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -988,8 +892,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1000,10 +902,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "```python\n", "def activate(self, inputs):\n", @@ -1037,8 +936,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1049,10 +946,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "```python\n", "def backPropagate(self, targets, N, M):\n", @@ -1103,9 +997,6 @@ "cell_type": "code", "execution_count": 12, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1236,8 +1127,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1249,11 +1138,7 @@ { "cell_type": "code", "execution_count": 13, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1276,8 +1161,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1289,11 +1172,7 @@ { "cell_type": "code", "execution_count": 14, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1311,9 +1190,6 @@ "cell_type": "code", "execution_count": 15, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1385,9 +1261,6 @@ "cell_type": "code", "execution_count": 16, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1411,8 +1284,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1426,8 +1297,6 @@ "execution_count": 17, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "skip" } @@ -1458,11 +1327,7 @@ { "cell_type": "code", "execution_count": 18, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -1493,8 +1358,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1511,9 +1374,7 @@ "cell_type": "code", "execution_count": 19, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -1525,9 +1386,6 @@ "cell_type": "code", "execution_count": 20, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1540,8 +1398,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1558,9 +1414,7 @@ "cell_type": "code", "execution_count": 21, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -1571,9 +1425,6 @@ "cell_type": "code", "execution_count": 22, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "scrolled": false, "slideshow": { "slide_type": "subslide" @@ -1587,8 +1438,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1619,7 +1468,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.5.3" }, "nbpresent": { "slides": { @@ -1944,5 +1793,5 @@ } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/1.2 Introduction - Tensorflow.ipynb b/to remove/1.2 Introduction - Tensorflow.ipynb similarity index 94% rename from 1.2 Introduction - Tensorflow.ipynb rename to to remove/1.2 Introduction - Tensorflow.ipynb index 8629f51..c631dff 100644 --- a/1.2 Introduction - Tensorflow.ipynb +++ b/to remove/1.2 Introduction - Tensorflow.ipynb @@ -3,8 +3,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -16,8 +14,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -34,8 +30,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -46,10 +40,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "* Defining, optimizing, and efficiently calculating mathematical expressions involving multi-dimensional arrays (tensors).\n", "\n", @@ -63,8 +54,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -76,8 +65,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -90,9 +77,6 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -117,9 +101,6 @@ "cell_type": "code", "execution_count": 2, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -133,9 +114,6 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -159,8 +137,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -172,8 +148,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -188,9 +162,6 @@ "cell_type": "code", "execution_count": 4, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -204,9 +175,6 @@ "cell_type": "code", "execution_count": 5, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -229,8 +197,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -242,8 +208,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -257,8 +221,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -273,8 +235,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -285,10 +245,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "* **Node**: In TensorFlow, each node represents the instantion of an operation. \n", " - Each operation has inputs (`>= 2`) and outputs `>= 0`.\n", @@ -303,8 +260,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -315,10 +270,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "* **Operation**: This represents an abstract computation, such as adding or multiplying matrices. \n", " - An operation manages tensors, and It can just be polymorphic: the same operation can manipulate different tensor element types. \n", @@ -332,8 +284,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -344,10 +294,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "**Session**: When the client program has to establish communication with the TensorFlow runtime system, a session must be created. \n", " \n", @@ -361,8 +308,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -373,10 +318,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "**TensorBoard** is a visualization tool, devoted to analyzing Data Flow Graph and also to better understand the machine learning models. \n", "\n", @@ -386,8 +328,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -399,8 +339,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -411,10 +349,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "```shell\n", "tensorboard --logdir=/tmp/tf_logs\n", @@ -424,8 +359,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -444,11 +377,7 @@ { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -479,8 +408,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -492,8 +419,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -506,9 +431,6 @@ "cell_type": "code", "execution_count": 7, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -524,9 +446,6 @@ "cell_type": "code", "execution_count": 8, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -552,8 +471,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -566,9 +483,6 @@ "cell_type": "code", "execution_count": 9, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -600,8 +514,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -614,9 +526,6 @@ "cell_type": "code", "execution_count": 10, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "-" } @@ -630,11 +539,7 @@ { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "tf_mat1 = tf.constant(matrix1) \n", @@ -645,9 +550,6 @@ "cell_type": "code", "execution_count": 12, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -662,9 +564,6 @@ "cell_type": "code", "execution_count": 13, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -679,8 +578,6 @@ "execution_count": 14, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -697,9 +594,6 @@ "cell_type": "code", "execution_count": 15, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -731,8 +625,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -755,11 +647,7 @@ { "cell_type": "code", "execution_count": 17, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.image as mp_image\n", @@ -771,9 +659,6 @@ "cell_type": "code", "execution_count": 18, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -799,9 +684,6 @@ "cell_type": "code", "execution_count": 19, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -826,10 +708,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "### Slicing" ] @@ -839,8 +718,6 @@ "execution_count": 20, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "-" } @@ -855,9 +732,6 @@ "cell_type": "code", "execution_count": 21, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -881,9 +755,6 @@ "cell_type": "code", "execution_count": 22, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -908,8 +779,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -921,11 +790,7 @@ { "cell_type": "code", "execution_count": 23, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "x = tf.Variable(input_image,name='x')\n", @@ -941,9 +806,6 @@ "cell_type": "code", "execution_count": 24, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -968,8 +830,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -983,11 +843,7 @@ { "cell_type": "code", "execution_count": 25, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1009,8 +865,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -1023,9 +877,6 @@ "cell_type": "code", "execution_count": 26, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "skip" } @@ -1067,8 +918,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1079,10 +928,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "This algorithm has nothing to do with the canonical linear regression, but it is an algorithm that allows us to solve problems of classification(supervised learning). \n", "\n", @@ -1103,9 +949,7 @@ { "cell_type": "code", "execution_count": 27, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stderr", @@ -1122,9 +966,7 @@ { "cell_type": "code", "execution_count": 29, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1154,9 +996,7 @@ { "cell_type": "code", "execution_count": 30, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1177,8 +1017,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1192,8 +1030,6 @@ "execution_count": 31, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1211,8 +1047,6 @@ "execution_count": 32, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1226,10 +1060,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## The Model" ] @@ -1238,9 +1069,7 @@ "cell_type": "code", "execution_count": 33, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -1254,8 +1083,6 @@ "execution_count": 34, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1271,8 +1098,6 @@ "execution_count": 35, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1289,8 +1114,6 @@ "execution_count": 36, "metadata": { "collapsed": true, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1305,9 +1128,6 @@ "cell_type": "code", "execution_count": 37, "metadata": { - "collapsed": false, - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1321,8 +1141,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1335,9 +1153,7 @@ "cell_type": "code", "execution_count": 38, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -1353,8 +1169,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1367,9 +1181,7 @@ "cell_type": "code", "execution_count": 39, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -1384,8 +1196,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1397,11 +1207,7 @@ { "cell_type": "code", "execution_count": 40, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1453,8 +1259,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1466,8 +1270,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "slide" } @@ -1478,10 +1280,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "On a typical system, there are multiple computing devices. \n", "\n", @@ -1497,8 +1296,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1512,8 +1309,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1526,10 +1321,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "```python\n", "# Creates a graph.\n", @@ -1546,8 +1338,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1568,8 +1358,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "subslide" } @@ -1580,10 +1368,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "```python\n", "# Creates a graph.\n", @@ -1605,8 +1390,6 @@ { "cell_type": "markdown", "metadata": { - "deletable": true, - "editable": true, "slideshow": { "slide_type": "fragment" } @@ -1632,10 +1415,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## More on Tensorflow\n", "\n", @@ -1659,9 +1439,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.5.3" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/additional materials/1.5.1 Introduction - Theano.ipynb b/to remove/1.5.1 Introduction - Theano.ipynb similarity index 95% rename from additional materials/1.5.1 Introduction - Theano.ipynb rename to to remove/1.5.1 Introduction - Theano.ipynb index fabb440..6631871 100644 --- a/additional materials/1.5.1 Introduction - Theano.ipynb +++ b/to remove/1.5.1 Introduction - Theano.ipynb @@ -27,7 +27,6 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -61,7 +60,6 @@ "cell_type": "code", "execution_count": 2, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -75,7 +73,6 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -111,7 +108,6 @@ "cell_type": "code", "execution_count": 4, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "-" } @@ -147,7 +143,6 @@ "cell_type": "code", "execution_count": 5, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "-" } @@ -195,7 +190,6 @@ "cell_type": "code", "execution_count": 6, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -217,7 +211,6 @@ "cell_type": "code", "execution_count": 7, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -242,7 +235,6 @@ "cell_type": "code", "execution_count": 8, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -283,9 +275,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -328,7 +318,6 @@ "cell_type": "code", "execution_count": 11, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -394,9 +383,7 @@ { "cell_type": "code", "execution_count": 13, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "x = T.scalar()\n", @@ -407,7 +394,6 @@ "cell_type": "code", "execution_count": 14, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -446,9 +432,7 @@ { "cell_type": "code", "execution_count": 15, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", @@ -458,9 +442,7 @@ { "cell_type": "code", "execution_count": 16, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -492,7 +474,6 @@ "cell_type": "code", "execution_count": 17, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "-" } @@ -517,9 +498,7 @@ { "cell_type": "code", "execution_count": 18, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "x.set_value(values)" @@ -540,7 +519,6 @@ "cell_type": "code", "execution_count": 19, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "-" } @@ -575,9 +553,7 @@ { "cell_type": "code", "execution_count": 20, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -598,9 +574,7 @@ { "cell_type": "code", "execution_count": 21, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -636,7 +610,6 @@ "cell_type": "code", "execution_count": 22, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "slide" } @@ -654,7 +627,6 @@ "cell_type": "code", "execution_count": 23, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -679,7 +651,6 @@ "cell_type": "code", "execution_count": 24, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -704,7 +675,6 @@ "cell_type": "code", "execution_count": 25, "metadata": { - "collapsed": false, "slideshow": { "slide_type": "fragment" } @@ -746,9 +716,7 @@ { "cell_type": "code", "execution_count": 27, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", @@ -788,9 +756,7 @@ { "cell_type": "code", "execution_count": 28, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "import os\n", @@ -803,9 +769,7 @@ { "cell_type": "code", "execution_count": 29, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stderr", @@ -822,9 +786,7 @@ { "cell_type": "code", "execution_count": 30, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -882,9 +844,7 @@ { "cell_type": "code", "execution_count": 31, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -981,9 +941,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.5.3" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 }