Deep Learning Frameworks Compared

Siraj Raval · Beginner ·🧬 Deep Learning ·9y ago

Key Takeaways

This video compares 5 popular deep learning frameworks, including SciKit Learn, TensorFlow, Theano, Keras, and Caffe, discussing their pros and cons, and providing code samples in TensorFlow and Theano.

Full Transcript

hello world it's SJ in this video we're going to compare the most popular deep learning Frameworks out there right now to see what works best the Deep learning space is exploding with Frameworks right now it's like every single week some major tech company decides to open source their own deep learning library and that's not including the dozens of deep learning Frameworks being released every single week on GitHub by Cowboy developers how many layers you get let's start off with scikit learn scikit was made to provide an easytouse interface for developers to use off the shelf general purpose machine learning algorithms for both supervised and unsupervised learning psyit provides functions that let you apply classic machine learning algorithms like support Vector machines logistic regressions and kous neighbor very easily but the one type of machine learning algorithm it doesn't let you implement is a neural network it doesn't provide GPU support either which is what helps neural networks scale since like 2 months ago pretty much every single general purpose algorithm that pyit learn implemented has since been implemented intenser flow pyit you just got learned there's also Cafe which was basically the first mainstream production grade deep learning library started in 2013 but Cafe isn't very flexible think of a neural network as a computational graph in Cafe each node is considered a layer so if you want new layer types you have to define the full forward backward and gradient updates these layers are building blocks that are unnecessarily big there's an endless list of them that you can pick from in tensorflow each node is considered a tensor operation like Matrix add or Matrix multiply or convolution and a layer can be defined as a composition of those operations so tensorflow's building blocks are smaller which allows for more modularity Cafe also requires a lot of unnecessary verbosity if you want to support both the CPU and the GPU you need to implement extra functions for each and you have to Define your model using a plain text editor that is just ghetto model should be defined programmatically because it's better for modularity between different components also Cafe's main architect now works on the tensorflow team we're all out of Cafe but speaking of modularity let's talk about Kos Kos has been the go-to source to get started with deep learning for a while because it provides a very high level API to build deep learning models Cara sits on top of the other deep learning libraries like theano and tensorflow it uses an objectoriented design so everything is considered an object be that layers models optimizers and all the parameters of a model can be accessed as object properties like model. layers 3 . output will give you the output tensor for the third layer in the model and model. layers 3. weights is a list of symbolic weight tensors this is a cleaner interface as opposed to the functional approach of making layers functions that create weights when being called great documentation it's all Gucci yes I'm bringing that back but because it's so general purpose it lacks on the side of performance Kos has been known to have performance issues when used with a tensorflow backend since it's not really optimized for it but it does work pretty well with the theano backend the two Frameworks that are neck and neck right now and the race to be the best library for both research and Industry are tensorflow and theano theano currently outperforms tensorflow on a single GPU but tensorflow outperforms theano for parallel execution across multiple gpus Theo's got more documentation because it's been around for a while and it's got native Windows support which tensorflow doesn't yet damn it windows in terms of syntax let's just take a look at some code to see some differences we're going to compare two scripts in tensorflow and Theo both do the same thing initialize some phony data and then learn the line of best fit for that data so it can predict future data points let's look at the first step in both tensorflow and Theo we're generating the data pretty much the same way using numpy arrays so there's not really a difference there let's look at the model initialization Parts this is the basic yal MX plus b slope formula in tensorflow it doesn't require any special treatment of the X and Y variables they're just there natively but in theano we have to specifically say that the variables are symbolic inputs to the function the tensorflow syntax of defining the B and variables is cleaner then we Implement our gradient descent function which is what helps us learn we're trying to minimize the mean squared error over time which is what makes our model more accurate as we train the Syntax for defining what we're minimizing is pretty similar then when we look at the actual Optimizer which helps us do that we'll notice a difference in syntax again tensorflow just gives you access to a bunch of optimizers right out of the box things like radiant descent or atom theano makes you do this from scratch then we have our training function which is again more verbose see the trend here theano so far is making us Implement more code than tensorflow so it seems to give us more fine grain control but at the cost of readability finally we'll get to the actual training part itself they look pretty identical but tensor flow's methodology of encapsulating the computational graph feels conceptually cleaner than theano's tensorflow is just growing so fast that it seems inevitable that whatever feature it lacks right now because of how new it is it will gain very rapidly I mean just look at the amount of activity happening in the tensorflow repo versus the Theo repo on GitHub right now and while Kos serves as an easyuse wrapper around different liaries it's not optimized for tensorflow a better alternative if you want to learn and get started easily with deep learning is TF learn which is basically Kos but optimized for tensorflow so to sum things up the best library to use for research is tensorflow the world-class researchers at both open Ai and Deep Mind are now using it for production the best library to use is still tensorflow since it scales better across multiple gpus than its closest competitor theano lastly for learning the best library to use is tflearn which is a highle rapper around tensorflow that lets you get started really easily also shout out to Rahul Dio for being able to generate an upbeat midi file badass of the week please subscribe for more programming videos for now I've got to go worship tensorflow some more so thanks for watching

Original Description

In this video, I compare 5 of the most popular deep learning frameworks (SciKit Learn, TensorFlow, Theano, Keras, and Caffe). We go through the pros and cons of each, as well as some code samples, eventually coming to a definitive conclusion. The code for the TensorFlow vs Theano part of the video is here: https://github.com/llSourcell/tensorflow_vs_theano An article that explains the differences in more detail: https://medium.com/@sentimentron/faceoff-theano-vs-tensorflow-e25648c31800#.bg4xmz1au I created a Slack channel for us, sign up here: https://wizards.herokuapp.com/ Learn more about TF Learn here: https://github.com/tflearn/tflearn and here: https://www.tensorflow.org/versions/r0.9/tutorials/tflearn/index.html Learn more about TensorFlow here: https://www.oreilly.com/learning/hello-tensorflow More on Keras here: http://machinelearningmastery.com/tutorial-first-neural-network-python-keras/ More on SciKit Learn here: http://scikit-learn.org/stable/tutorial/ More on Caffe here: http://christopher5106.github.io/deep/learning/2015/09/04/Deep-learning-tutorial-on-Caffe-Technology.html More on Theano here: https://github.com/Newmu/Theano-Tutorials Thanks for watching guys, I do this for you. If you like my videos, feel free to support me on Patreon and please LIKE, SUBSCRIBE, COMMENT, AND SHARE! https://www.patreon.com/user?u=3191693 Follow me: Twitter: https://twitter.com/sirajraval Facebook: https://www.facebook.com/sirajology Instagram: https://www.instagram.com/sirajraval/ Instagram: https://www.instagram.com/sirajraval/ Signup for my newsletter for exciting updates in the field of AI: https://goo.gl/FZzJ5w Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: http://chatgptschool.io/ Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available): https://www.wagergpt.xyz
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Siraj Raval · Siraj Raval · 38 of 60

1 What is Bitcoin?
What is Bitcoin?
Siraj Raval
2 5 Ways to Use Bitcoin
5 Ways to Use Bitcoin
Siraj Raval
3 BTC Fever - Siraj [Music Video]
BTC Fever - Siraj [Music Video]
Siraj Raval
4 5 Reasons to Build Decentralized Apps
5 Reasons to Build Decentralized Apps
Siraj Raval
5 The Interplanetary File System
The Interplanetary File System
Siraj Raval
6 How to Build a Dapp in 3 min
How to Build a Dapp in 3 min
Siraj Raval
7 Life Before Smartphones
Life Before Smartphones
Siraj Raval
8 4 Ways to Use Smart Contracts
4 Ways to Use Smart Contracts
Siraj Raval
9 3 Dapps You HAVE to See
3 Dapps You HAVE to See
Siraj Raval
10 Char's Life as a BitTorrent Engineer
Char's Life as a BitTorrent Engineer
Siraj Raval
11 4 Reasons AlphaGo is a Huge Deal
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
12 Build a Neural Net in 4 Minutes
Build a Neural Net in 4 Minutes
Siraj Raval
13 Sentiment Analysis in 4 Minutes
Sentiment Analysis in 4 Minutes
Siraj Raval
14 The Hackathon Life
The Hackathon Life
Siraj Raval
15 Your First ML App - Machine Learning for Hackers #1
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
16 Build an AI Composer - Machine Learning for Hackers #2
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
17 Build a Game AI - Machine Learning for Hackers #3
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
18 Build a Movie Recommender - Machine Learning for Hackers #4
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
19 Build an AI Artist - Machine Learning for Hackers #5
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
20 Build a Chatbot - ML for Hackers #6
Build a Chatbot - ML for Hackers #6
Siraj Raval
21 Build an AI Reader - Machine Learning for Hackers #7
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
22 Build an AI Writer - Machine Learning for Hackers #8
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
23 Build a Chatbot w/ an API - ML for Hackers #9
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
24 One-Shot Learning - Fresh Machine Learning #1
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
25 Generative Adversarial Nets - Fresh Machine Learning #2
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
26 Tone Analysis - Fresh Machine Learning #3
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
27 Generate Rap Lyrics - Fresh Machine Learning #4
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
28 Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
29 Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
30 Build an Antivirus in 5 Min - Fresh Machine Learning #7
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
31 TensorFlow in 5 Minutes (tutorial)
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
32 Build a Recurrent Neural Net in 5 Min
Build a Recurrent Neural Net in 5 Min
Siraj Raval
33 Build a Simulation in 5 Min
Build a Simulation in 5 Min
Siraj Raval
34 Build a TensorFlow Image Classifier in 5 Min
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
35 Tensorboard Explained in 5 Min
Tensorboard Explained in 5 Min
Siraj Raval
36 Generate Music in TensorFlow
Generate Music in TensorFlow
Siraj Raval
37 Build a Game Bot (LIVE)
Build a Game Bot (LIVE)
Siraj Raval
Deep Learning Frameworks Compared
Deep Learning Frameworks Compared
Siraj Raval
39 Introduction - Learn Python for Data Science #1
Introduction - Learn Python for Data Science #1
Siraj Raval
40 Build a Neural Network (LIVE)
Build a Neural Network (LIVE)
Siraj Raval
41 Twitter Sentiment Analysis - Learn Python for Data Science #2
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
42 Recommendation Systems - Learn Python for Data Science #3
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
43 Predicting Stock Prices - Learn Python for Data Science #4
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
44 Pong Neural Network (LIVE)
Pong Neural Network (LIVE)
Siraj Raval
45 Deep Dream in TensorFlow - Learn Python for Data Science #5
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
46 Visualizing Data with D3.js (LIVE)
Visualizing Data with D3.js (LIVE)
Siraj Raval
47 Genetic Algorithms - Learn Python for Data Science #6
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
48 Enter Siraj [Music Video]
Enter Siraj [Music Video]
Siraj Raval
49 Build a Web Scraper (LIVE)
Build a Web Scraper (LIVE)
Siraj Raval
50 Why is P vs NP Important?
Why is P vs NP Important?
Siraj Raval
51 How to Make a Neural Network (LIVE)
How to Make a Neural Network (LIVE)
Siraj Raval
52 How to Make an Amazing Tensorflow Chatbot Easily
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
53 How to Make an Amazing Video Game Bot Easily
How to Make an Amazing Video Game Bot Easily
Siraj Raval
54 How to Make a Tensorflow Neural Network (LIVE)
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
55 How to Make a Simple Tensorflow Speech Recognizer
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
56 Joel Shor - Really Quick Questions with an Awesome Google Engineer
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
57 How to Make a Path Planning Algorithm Easily (LIVE)
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
58 The Best Way to Prepare a Dataset Easily
The Best Way to Prepare a Dataset Easily
Siraj Raval
59 Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
60 How to Make a Tic Tac Toe Neural Network Easily (LIVE)
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval

This video compares popular deep learning frameworks, discussing their pros and cons, and providing code samples in TensorFlow and Theano, to help viewers choose the best framework for their needs.

Key Takeaways
  1. Choose a deep learning framework
  2. Compare the pros and cons of each framework
  3. Implement a neural network with TensorFlow or Theano
  4. Evaluate the performance of the framework
💡 TensorFlow is a popular and rapidly growing framework that scales well across multiple GPUs, while Theano provides more fine-grained control but is more verbose.

Related AI Lessons

Want to get started with deep learning
Get started with deep learning by leveraging resources like Andrew Karpathy's playlist and frameworks such as TensorFlow or PyTorch
Reddit r/deeplearning
Building a Deepfake Detector From Scratch — What Nobody Tells You
Learn to build a deepfake detector from scratch and understand the challenges involved in detecting AI-generated fake media
Medium · Deep Learning
Unfolding the Meandering Path: High-Dimensional Invariance and the Flat 2D Plane of Neural…
Learn about high-dimensional invariance and its relation to the flat 2D plane of neural networks, and how to apply these concepts to improve model performance
Medium · Deep Learning
Implementing Neural Style Transfer from Scratch: The Project That Started It All
Learn to implement Neural Style Transfer from scratch and understand its significance in deep learning
Medium · Deep Learning
Up next
Image Classification with ml5.js
The Coding Train
Watch →