Train an Artificial Neural Network with TensorFlow's Keras API

deeplizard · Intermediate ·🧬 Deep Learning ·6y ago

Key Takeaways

This video demonstrates how to train an artificial neural network using TensorFlow's Keras API, covering model compilation, training, and evaluation.

Full Transcript

hey I'm Mandy from deep lizard in this episode we'll see how to train an artificial neural network using the Charis api integrated with tensorflow [Music] in previous episodes we went through steps to generate data and also build an artificial neural network so now we'll bring these two together to actually train the network on the data that we created and processed all right so picking up where we were last time in our jupiter notebook make sure that you still have all of your imports included and already ran so that we can continue where we were before so first we have after building our model we are going to call this model dot compiled function and this just prepares the model for training so it gets everything in order that's needed before we can actually train the model so first we are specifying to the compile function what optimizer that we want to use and we are choosing to use the very common optimizer atom with a learning rate of 0.0001 and next we specify the type of loss that we need to use which is in our case we're going to use sparse categorical cross symbol we're going to use sparse categorical cross entropy and then lastly we specify what metrics we want to see so this is just for the model performance what we want to be able to judge our model by and we are specifying this list which just includes accuracy which is a very common way to be able to evaluate model performance so if we run this cell all right so the model has been compiled and is ready for training and training occurs whenever we call this fit function now recall earlier in the course we actually looked at the documentation for this fit function so that we knew how to process our input data so to fit the first parameter that we're specifying is X here which is our input data which is currently stored in this scale to Train samples variable then Y which is our target data or our labels our labels are currently stored in the Train Bulls variable so we are specifying that here next we specify our batch size that we want to use for training so this is how many samples are included in one batch to be passed and processed by the network at one time so we're setting this to 10 and the number of epochs that we want to run we're setting this to 30 so that means that the model is going to process or train on all of the data in the data set 30 times before completing the total training process next we're specifying this shuffle shuffle parameter which we are setting to true now by default this is already set to true but I was just bringing it to your attention to show to make you aware of the fact that the data is being shuffled by default when we pass it to the network which is a good thing because we want any order that is inside of the data set to be kind of erased before we pass the data to the model so that the models not necessarily learning anything about the order of the data set so this is true by default so we don't necessarily have to specify that I was just letting you know and actually we'll see something about that in the next episode about why this is important regarding validation data but we'll see that coming up the last parameter that we specify here is verbose which is just an option to allow us to see output from whenever we run this fit function so we can either set it to 0 1 or 2 2 is the most verbose level in terms of output messages so we are setting that here so that we can get the highest level of output so now let's run the cell so that training can begin all right so training has just stopped and we have run for 30 epochs and if we look at the progress of the model so we're starting out on our first epoch our loss value is currently 0.68 and our accuracy is 50% so no better than chance but pretty quickly looking at the accuracy we can tell that it is steadily increasing all the way until we get to our last epoch which we are yielding 94% accuracy and our losses also steadily be crease from the 0.65 range to now being at point two seven so as you can see the this model trained very quickly with each epoch taking only under one second to run and within 30 Hawks we are already at a 94% accuracy rate now although this is a very simple model and we were training it on very simple data we can see that without much effort at all we were able to yield pretty great results in a relatively quick manner of time as well in subsequent episodes we'll demonstrate how to work with more complex models as well as more complex data but for now hopefully this example serve the purpose of encouraging you on how easy it is to get started with Kerris by the way we are currently in Vietnam filming this episode if you didn't know we also have a vlog channel where we document our travels and share a little bit more about ourselves so check that out at people's our vlog on YouTube also be sure to check out the corresponding blog for this episode along with other resources available on beep laser comm and check out the people's r-type mine where you can gain exclusive access to perks and rewards thanks for contributing to collective intelligence I'll see you next time [Music] [Music]

Original Description

In this episode, we'll demonstrate how to train an artificial neural network using the Keras API integrated within TensorFlow. 🕒🦎 VIDEO SECTIONS 🦎🕒 00:00 Welcome to DEEPLIZARD - Go to deeplizard.com for learning resources 00:30 Compiling the Model 01:40 Training the Model 05:35 Collective Intelligence and the DEEPLIZARD HIVEMIND 💥🦎 DEEPLIZARD COMMUNITY RESOURCES 🦎💥 👋 Hey, we're Chris and Mandy, the creators of deeplizard! 👉 Check out the website for more learning material: 🔗 https://deeplizard.com 💻 ENROLL TO GET DOWNLOAD ACCESS TO CODE FILES 🔗 https://deeplizard.com/resources 🧠 Support collective intelligence, join the deeplizard hivemind: 🔗 https://deeplizard.com/hivemind 🧠 Use code DEEPLIZARD at checkout to receive 15% off your first Neurohacker order 👉 Use your receipt from Neurohacker to get a discount on deeplizard courses 🔗 https://neurohacker.com/shop?rfsn=6488344.d171c6 👀 CHECK OUT OUR VLOG: 🔗 https://youtube.com/deeplizardvlog ❤️🦎 Special thanks to the following polymaths of the deeplizard hivemind: Tammy Mano Prime Ling Li 🚀 Boost collective intelligence by sharing this video on social media! 👀 Follow deeplizard: Our vlog: https://youtube.com/deeplizardvlog Facebook: https://facebook.com/deeplizard Instagram: https://instagram.com/deeplizard Twitter: https://twitter.com/deeplizard Patreon: https://patreon.com/deeplizard YouTube: https://youtube.com/deeplizard 🎓 Deep Learning with deeplizard: Deep Learning Dictionary - https://deeplizard.com/course/ddcpailzrd Deep Learning Fundamentals - https://deeplizard.com/course/dlcpailzrd Learn TensorFlow - https://deeplizard.com/course/tfcpailzrd Learn PyTorch - https://deeplizard.com/course/ptcpailzrd Natural Language Processing - https://deeplizard.com/course/txtcpailzrd Reinforcement Learning - https://deeplizard.com/course/rlcpailzrd Generative Adversarial Networks - https://deeplizard.com/course/gacpailzrd 🎓 Other Courses: DL Fundamentals Classic - https://deeplizard.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from deeplizard · deeplizard · 0 of 60

← Previous Next →
1 Install Jaxx cryptocurrency wallet on Windows 10 and verify file hash
Install Jaxx cryptocurrency wallet on Windows 10 and verify file hash
deeplizard
2 Jaxx cryptocurrency wallet overview - A Blockchain Interface
Jaxx cryptocurrency wallet overview - A Blockchain Interface
deeplizard
3 Remove Jaxx cryptocurrency wallet from Windows 10
Remove Jaxx cryptocurrency wallet from Windows 10
deeplizard
4 Install Jaxx cryptocurrency wallet Chrome extension
Install Jaxx cryptocurrency wallet Chrome extension
deeplizard
5 Send Litecoin from GDAX to Jaxx wallet
Send Litecoin from GDAX to Jaxx wallet
deeplizard
6 Send Litecoin from Jaxx wallet to GDAX
Send Litecoin from Jaxx wallet to GDAX
deeplizard
7 Backup and restore Jaxx wallet with passphrase
Backup and restore Jaxx wallet with passphrase
deeplizard
8 Send Litecoin to Bittrex using Jaxx and monitor confirmations with BlockCypher
Send Litecoin to Bittrex using Jaxx and monitor confirmations with BlockCypher
deeplizard
9 Join a mining pool on Waves platform and lease Waves
Join a mining pool on Waves platform and lease Waves
deeplizard
10 ZCASH Explained | An introduction to a privacy based cryptocurrency
ZCASH Explained | An introduction to a privacy based cryptocurrency
deeplizard
11 ZCash t address creation with Jaxx wallet and private key blockchain discussion
ZCash t address creation with Jaxx wallet and private key blockchain discussion
deeplizard
12 Buy ZCash with Litecoin using the Shifty button in the Jaxx wallet
Buy ZCash with Litecoin using the Shifty button in the Jaxx wallet
deeplizard
13 Buy ZCash with Litecoin using ShapeShift - FAILURE
Buy ZCash with Litecoin using ShapeShift - FAILURE
deeplizard
14 Litecoin | Jaxx | Shapeshift | zcash | failed
Litecoin | Jaxx | Shapeshift | zcash | failed
deeplizard
15 Buy ZCash with Litecoin using ShapeShift - SUCCESS even with Jaxx issues
Buy ZCash with Litecoin using ShapeShift - SUCCESS even with Jaxx issues
deeplizard
16 Explore ZCash blockchain with Zchain block explorer
Explore ZCash blockchain with Zchain block explorer
deeplizard
17 Zchain ZCash block explorer API - PowerShell Code
Zchain ZCash block explorer API - PowerShell Code
deeplizard
18 Zchain ZCash block explorer API - Introduction
Zchain ZCash block explorer API - Introduction
deeplizard
19 Zchain ZCash block explorer API - Application
Zchain ZCash block explorer API - Application
deeplizard
20 Coinbase's Trading Platform | Previously known as GDAX
Coinbase's Trading Platform | Previously known as GDAX
deeplizard
21 Coinbase Social Security Number (SSN) Requirement Explained
Coinbase Social Security Number (SSN) Requirement Explained
deeplizard
22 Who owns Coinbase? Here are some KEY people
Who owns Coinbase? Here are some KEY people
deeplizard
23 How does Coinbase/GDAX secure Bitcoin, Litecoin, Ether?
How does Coinbase/GDAX secure Bitcoin, Litecoin, Ether?
deeplizard
24 Coinbase | HackerOne bug bounty program
Coinbase | HackerOne bug bounty program
deeplizard
25 Is Bitcoin safe at Coinbase/GDAX?
Is Bitcoin safe at Coinbase/GDAX?
deeplizard
26 Coinbase Login Demo Using Google Authenticator (2FA)
Coinbase Login Demo Using Google Authenticator (2FA)
deeplizard
27 Coinbase Pro - GDAX | Trading Interface Overview
Coinbase Pro - GDAX | Trading Interface Overview
deeplizard
28 Coinbase gives $10 in Bitcoin | Watch this before signing up
Coinbase gives $10 in Bitcoin | Watch this before signing up
deeplizard
29 Coinbase around the globe | What countries are supported?
Coinbase around the globe | What countries are supported?
deeplizard
30 Order book explained | Trading concept to know
Order book explained | Trading concept to know
deeplizard
31 Bid/Ask spread explained | Trading concept to know
Bid/Ask spread explained | Trading concept to know
deeplizard
32 Maker vs Taker | Trading concept to know
Maker vs Taker | Trading concept to know
deeplizard
33 Market Orders are Always TAKERS (HIGHER FEES)!
Market Orders are Always TAKERS (HIGHER FEES)!
deeplizard
34 Buy as a MAKER (LOWER FEE) on Coinbase Pro - GDAX | Limit Order - Part 1
Buy as a MAKER (LOWER FEE) on Coinbase Pro - GDAX | Limit Order - Part 1
deeplizard
35 Buy as a MAKER (LOWER FEE) on Coinbase Pro - GDAX | Limit Order - Part 2
Buy as a MAKER (LOWER FEE) on Coinbase Pro - GDAX | Limit Order - Part 2
deeplizard
36 Time-in-force explained | Trading concept to know
Time-in-force explained | Trading concept to know
deeplizard
37 Stop order explained | How to stop a loss | Coinbase Pro - GDAX
Stop order explained | How to stop a loss | Coinbase Pro - GDAX
deeplizard
38 Stop Order on Coinbase Pro - GDAX | What the WARNINGS Mean
Stop Order on Coinbase Pro - GDAX | What the WARNINGS Mean
deeplizard
39 Market price vs Last price | Trading concept to know
Market price vs Last price | Trading concept to know
deeplizard
40 Stop Order on Coinbase Pro - GDAX | How it is ACTIVATED
Stop Order on Coinbase Pro - GDAX | How it is ACTIVATED
deeplizard
41 Stop-limit order | How to set the limit | Coinbase Pro - GDAX
Stop-limit order | How to set the limit | Coinbase Pro - GDAX
deeplizard
42 Flash CRASH Part 1 | ETH/USD currency pair traded at $0.10
Flash CRASH Part 1 | ETH/USD currency pair traded at $0.10
deeplizard
43 Slippage explained | Trading concept to know
Slippage explained | Trading concept to know
deeplizard
44 Flash CRASH Part 2 | How did Coinbase Respond?
Flash CRASH Part 2 | How did Coinbase Respond?
deeplizard
45 Buy side stop-limit order | Crypto trading strategy for buying a breakout
Buy side stop-limit order | Crypto trading strategy for buying a breakout
deeplizard
46 Buy side stop-limit order | Triggering under the market price
Buy side stop-limit order | Triggering under the market price
deeplizard
47 What is an order book?
What is an order book?
deeplizard
48 What is a market?
What is a market?
deeplizard
49 What is an exchange?
What is an exchange?
deeplizard
50 What is a broker-dealer?
What is a broker-dealer?
deeplizard
51 Keras prerequisites
Keras prerequisites
deeplizard
52 Change Keras backend to Theano
Change Keras backend to Theano
deeplizard
53 #1 Order types and parameters | Trading on Coinbase Pro - GDAX
#1 Order types and parameters | Trading on Coinbase Pro - GDAX
deeplizard
54 Trading strategy for stopping a loss | Don't trade all at once!
Trading strategy for stopping a loss | Don't trade all at once!
deeplizard
55 #2 Order matching engine | Trading on Coinbase Pro - GDAX
#2 Order matching engine | Trading on Coinbase Pro - GDAX
deeplizard
56 Batch Size in a Neural Network explained
Batch Size in a Neural Network explained
deeplizard
57 Deep Learning playlist overview & Machine Learning intro
Deep Learning playlist overview & Machine Learning intro
deeplizard
58 Artificial Neural Networks explained
Artificial Neural Networks explained
deeplizard
59 Regularization in a Neural Network explained
Regularization in a Neural Network explained
deeplizard
60 Create confusion matrix for predictions from Keras model
Create confusion matrix for predictions from Keras model
deeplizard

This video teaches how to train an artificial neural network using TensorFlow's Keras API, including model compilation, training, and evaluation. The example demonstrates how to prepare a model for training, specify an optimizer and loss function, and evaluate model performance. The video also covers how to use the Keras API to train a model on a dataset.

Key Takeaways
  1. Import necessary libraries and load data
  2. Compile the model with a specified optimizer and loss function
  3. Train the model using the fit function
  4. Evaluate model performance using metrics such as accuracy
  5. Adjust hyperparameters such as batch size and number of epochs
💡 The Keras API provides a simple and intuitive way to train artificial neural networks, allowing users to easily compile, train, and evaluate models.

Related Reads

Chapters (4)

Welcome to DEEPLIZARD - Go to deeplizard.com for learning resources
0:30 Compiling the Model
1:40 Training the Model
5:35 Collective Intelligence and the DEEPLIZARD HIVEMIND
Up next
RNNs Explained in 60 Seconds #ai #coding #machinelearning
Ascent
Watch →