
Welcome to the course!
This is a hands-on course where you learn to train deep learning models. Deep learning models are used in real world applications to power technologies such as language translation and object recognition.
Lets get our development environment ready. Let's install Anaconda python and additional python packages you will need in order to follow the course.
Clone the course repository from GitHub and create the Xpdl conda environment. Activate the environment, install Python 3.6, TensorFlow, and Keras, then launch Jupyter Notebook to run the first notebook.
Let's get the source code that we will use during the course.
Running your first model will help us check that you have installed all the material correctly.
First of all let's establish a common vocabulary and introduce some common terms that will be used throughout the course
Descriptive statistics and a few simple checks can be very useful to formulate an initial intuition about the data.
Plotting is a powerful way to explore the data and different kinds of plots are useful in different situations.
Let's show an example of plotting with Matplotlib!
Most often than not data is not just tabular. Deep learning can handle text documents, images, sound, and even binary data.
Often Deep Learning uses Image or Audio data, let's see how we can work with it in the Jupyter Environment!
Feature engineering is the process through which we can transform an unstructured datapoint to a structured, tabular record.
In this exercise you will load and plot a dataset, exploring it visually to gather some insights and also to familiarize with python's plotting library: Matplotlib.
Load the weight height csv dataset, inspect its columns, and create a scatter plot of weight versus height; differentiate male and female data with two colors and label the axes.
Let's continue working through and explaining the solutions!
Practice creating overlapping histograms of heights for males and females from the same dataset, using alpha for transparency. Add vertical lines at the mean of each population.
Let's continue working through and explaining the solutions!
Plot male and female weights using a box plot from the same dataset, and compare readability with a histogram, including titles, axes, and legends.
Let's continue working through and explaining the solutions!
Learn to use a scatter matrix to explore the Titanic train dataset, visualizing gender, fare, cabin, embark port, and survival status with sample code.
Let's continue working through and explaining the solutions!
Section 3 introduces machine learning, outlining how cheap memory, compute, and data spurred its growth. It reviews core concepts like regression, classification, cross-validation, and cost function optimization as pillars.
There are several types of machine learning, including supervised learning, unsupervised learning, reinforcement learning etc. This course focuses primarily on Supervised Learning.
Supervised learning allows computers to learn patterns from examples. It is used in several domains and applications and here you learn to identify problems that can be solved using it.
The easiest example of supervised learning is Linear Regression. LR looks for a functional relation between input and output variables.
In order to find the best possible linear model to describe our data, we need to define a criterion to evaluate the "goodness" of a particular model. This is the role of the cost function.
Let's begin to work through the notebook example for the cost function!
Now that we have both a hypothesis (linear model) and a cost function (mean squared error), we need to find the combination of parameters that minimizes such cost.
Let's play with Keras to create a Linear Regression Model!
How can we know if the model we just trained is good? Since the purpose of our model is to learn to generalize from examples let's test how the model performs on a new set of data not used for training.
Let's code through an example of evaluating model performance!
Classification is a technique to use when the target variable is discrete, instead of continuous. Here we introduce similarities and differences from a regression.
Let's code through a classification example!
In some cases our model may seem to be performing really well on the training data, but poorly on the test data. This is called overfitting.
A more accurate way to assess the ability of our model to generalize to unseen datapoints is to repeat the train/test split procedure multiple times and then average the results. This is called cross-validation.
Let's code through some cross validation!
Explore the confusion matrix as a better metric than accuracy to assess model errors in binary and multi-class classification, and learn about precision, recall, and the F1 score.
In a binary classification we can define several types of error and choose which one to reduce.
Sometimes we need to preprocess the features, for example if we have categorical data or if the scale is too big or too small.
Build a house price regression model in Keras using features like bedrooms, square feet, and age. Load data, create X and Y, train, test, and evaluate with R2.
Let's code through an example solution of the pre-processing problems!
Practice binary classification on employee left company data, from loading and benchmarking to feature engineering with dummy columns, train-test split, and model evaluation using confusion matrix, precision, recall, and cross-validation.
Let's code through an example solution of the pre-processing problems!
Discover section four of deep learning with Python and Keras, introducing the perceptron and neural nets for regression and classification, covering weights, biases, nodes, layers, and activation functions.
Deep learning is successfully applied to many different domains. Here we review a few of them.
The perceptron is the simplest neural network and here we learn all about Nodes, Edges, Biases, Weights as well as the need for an Activation function
We can combine the output of a perceptron to the input of another one, stacking them into layers. A fully connected architecture is just a series of such layers. Forward propagation still applies.
Let's code through a NN example!
Let's learn how to work with multiple outputs!
Let's code through an example of multi-class classification!
The activation function is what makes neural networks so powerful. In this lecture we review several types of activation functions and understand why it is necessary.
A neural network formulates a prediction using "forward propagation". Here you will learn what it is.
Predict diabetes using a Pima Indians dataset; load data, inspect features with histograms and Seaborn pair plots, consider standardization, and prepare X and Y for a binary classifier.
Let's work through our Deep Learning Introduction exercises!
Let's work through our Deep Learning Introduction exercises!
Compare neural networks to other models on the Pima Indian dataset, using the same train/test split, and test with four features; then review the solution in the next video.
Let's work through our Deep Learning Introduction exercises!
Explore TensorFlow Playground in exercise four to build and experiment with simple, fully connected neural nets on two labeled data groups, blue and orange, building intuition through playful exploration.
The Tensorflow playground is a nice web app that allows you to play around with simple neural network parameters to get a feel for what they do.
What is the gradient and why is it important? In this lecture we introduce the gradient in 1 dimension and then extend it to many dimensions.
The gradient is important because it allows us to know how to adjust the parameters of our model in order to find the best model. Here I will give you some intuition about it.
Let's quickly cover the Chain Rule that you'll need to understand!
How does backpropagation work when we have a more complex neural network? The chain rule of derivation is the answer. As we shall see this reduces to a lot of matrix multiplications.
The learning rate is the external parameter that we can control to decide the size of our updates to the weights.
How do we feed the data to our model in order to adjust the weights by gradient descent? The answer is in batches. In this lecture you will learn all about epochs, batches and mini-batches.
Let's briefly go over working with NumPy arrays!
The learning rate is an important parameter of your model, let's go over it!
Let's see how models can be effected using the learning rate
Gradient descent is a first-order iterative optimization algorithm. To find a local minimum of a function using gradient descent, one takes steps proportional to the negative of the gradient (or of the approximate gradient) of the function at the current point.
Let's code through an example of Gradient Descent!
Exponentially Weighted Moving Average is one of the most common algorithms used for smoothing!
Many improved optimization algorithms use the ewma filter. Here we review a few improvements to the naive backpropagation algorithm.
Let's code through some optimization algorithms that are using ewma.
Let's code through some initialization, assigning weights to the initial values of our model.
Let's visualize the inner layers of our network!
practice exercise one in section five guides you to build a deep learning classifier predicting wine quality, from loading data to choosing cost function, optimizer, batch size, and epochs.
Let's work through the solutions for exercise 1!
Build a fully connected deep network with 8-5-2-3 nodes, train it, and use the first three layers as feature encoders to plot a two-dimensional scatter of layer three's two outputs.
Let's work through the solutions for exercise 2!
Explore building and training a model with the functional API to display data in a smaller dimensional space, contrasting it with the sequential API, and appreciate its versatility.
Let's work through the solutions for exercise 3!
Explore three Keras callbacks—early stopping, model checkpoint, and TensorBoard—to monitor training across epochs, save models, and visualize accuracy and loss in an interactive web UI.
Let's work through the solutions for exercise 4!
Tensorflow comes equipped with a small visualization server that allows us to display a bunch of things.
Explore convolutional neural networks and their image and sequence processing strengths by learning about convolutions and tensors, and applying convolutional neural network concepts in section six.
Images can be viewed as a sequence of pixels or we can extract ad hoc features from them. Both approaches offer advantages and limitations.
Let's work through this classic dataset to identify and classify hand written digits!
Nearby pixels are correlated and this can be exploited to build a more intelligent model.
In this lecture we introduce tensors as extensions of matrices and see how they are added and multiplied.
Let's work through some of the mathematics related to Tensors!
Let's explore 1 dimensional convolution!
Let's code through an example 1 dimensional convolution!
Let's explore 2 dimensional convolution!
What is the effect of convolving an image with a gaussian filter? Here we find out.
How are layers connected in a CNN. Here we look at weights, channels and feature maps.
Let's code through some convolutional layers examples
Max pooling and Average pooling layers are useful to reduce the size of our model, forcing it to focus on the most important features.
Let's code through an example of pooling layers!
Combine several pooling and convolutional layers and finally connect them to a prediction fully connected layer.
Let's code through a CNN example!
Compare the parameter count and the performance of convolutional and fully connected architectures.
CNNs are not just useful when dealing with images. We can use them to classify other data such as sound and text. Convolutional architectures are useless when there is no correlation between nearby rows and columns, for example with tabular data
Set up a classifier to classify images (hot or not, cat or dog etc.), realize training is too slow and a GPU is needed.
Set up a classifier to classify images (hot or not, cat or dog etc.), realize training is too slow and a GPU is needed.
A more complex exercise involving CNNs
Let's work through another exercise solution!
Let's work through an example of setting up our notebook on Floydhub!
Explore recurrent neural networks for sequence data like text, music, and movies, generating continuous predictions from a single input, with gru s and lstm s for anomaly detection and data generation.
If you have never dealt with time-series, this lecture reviews a few concepts like rolling windows, feature extraction and validation on time series.
We introduce several sequence-specific problems including one to one, one to many and many to many and show practical cases of where they are encountered.
Explore vanilla recurrent neural networks, unrolling time to form shallow and deep rnn with u and w, using tanh to blend outputs with inputs, noting short-term memory and long-term dependency.
Recently introduced, GRUs solve the vanishing gradient problem and allow for an effective implementation of recurrent neural networks.
Forecast time series with neural networks using a Canada retail sales dataset, clean and index by date, compare unadjusted versus seasonally adjusted series, and test a simple fully connected model.
Load the LSTM layer from Keras, reshape inputs to [batch, time steps, features], and build a one-layer LSTM with six units; training shows only marginal improvement over the prior approach.
Explore rolling windows to extract time-series features and predict future values by sliding a fixed-size window and using its features with RNNs, CNNs, or fully connected models.
Explore predicting time-series values using past twelve months with a recurrent neural network and a fully connected model. Build features via pandas shift, train with early stopping, and compare performances.
Reshape the 12 months into sequences for the lstm, turning a 12-coordinate vector into a sequential input, retrain the model, and compare performance with the previous approach.
Apply RNNs to images by reshaping the Mnist dataset into a long sequence of pixels, train a recurrent model, and compare its performance with fully connected and convolutional models.
Learning curves are a useful tool to answer the question: do we need more data or a better algorithm? The performance of a large neural network keeps improving the more data we throw at it.
Plot learning curves for a small eight-by-eight digits dataset using a Keras fully connected model, comparing training and test performance across progressively larger training sizes.
One technique to speed up training is batch normalization.
Another technique to improve convergence of a network is to make it more robust to internal failure.
Let's code through a dropout example!
In some cases, more data can be obtained by slightly modifying the existing training data. For example, applying noise to sound or distortions to an image.
In some cases we can continuously generate new data to feed to deep learning model.
Let's create an image generator!
Let's show how we can search for optimal network architecture
Sometimes we can represent data in a better way before feeding it to a model.
Demonstrate a Keras embedding layer that maps indices 0–99 to 2D vectors, contrast with a fully connected layer, in a simple model with input 100 and output 2.
Train a sentiment classifier on IMDb movie reviews using embedding layers and an LSTM, loading the IMDb dataset, padding sequences, and evaluating performance on train and test sets.
Review exercise one by reloading IMDb data with the first 20,000 most common words and padding reviews to a max length. Rerun the model and compare training time and performance.
Let's work through an image recognition system!
Let's work through the second exercise solution!
Review exercise three by building a 64x64 color image binary gender classifier using Crowdflower data, applying augmentation and a generator-based training loop, and evaluating misclassifications.
This course is designed to provide a complete introduction to Deep Learning. It is aimed at beginners and intermediate programmers and data scientists who are familiar with Python and want to understand and apply Deep Learning techniques to a variety of problems.
We start with a review of Deep Learning applications and a recap of Machine Learning tools and techniques. Then we introduce Artificial Neural Networks and explain how they are trained to solve Regression and Classification problems.
Over the rest of the course we introduce and explain several architectures including Fully Connected, Convolutional and Recurrent Neural Networks, and for each of these we explain both the theory and give plenty of example applications.
This course is a good balance between theory and practice. We don't shy away from explaining mathematical details and at the same time we provide exercises and sample code to apply what you've just learned.
The goal is to provide students with a strong foundation, not just theory, not just scripting, but both. At the end of the course you'll be able to recognize which problems can be solved with Deep Learning, you'll be able to design and train a variety of Neural Network models and you'll be able to use cloud computing to speed up training and improve your model's performance.