Build a Neural Net in 4 Minutes
Skills:
Neural Network Basics80%
Key Takeaways
Builds a neural network using NumPy and Python in under 4 minutes
Full Transcript
oh hello world welcome to audiology today we're going to be building a neural net in four minutes let's get started they're like a million-in-one machine learning models out there but neural nets in particular have gotten really popular recently because of two things that's our computers and more data they've helped produce some amazing breakthroughs in everything from image recognition to generating rap songs they're really just three steps involved in machine learning build it train it and test it once we build our model we can train it against our input and output data to make it better and better at pattern recognition so let's build our model a three layer neural network in Python we'll want to start off by importing numpy which is my gotu library for scientific computing in python then we'll want to create a function that will map any value to a value between zero and one this is called a sigmoid this function will be run in every neuron of our network when data hits it it's useful for creating probabilities out of numbers once we've created that let's initialize our input data set as a matrix each row is a different training example each column represents a different neuron so we have four training examples with three input neurons each then we'll create our output data set for examples one output neuron each since we'll be generating random numbers in a second let's seed them to make them deterministic this just means give random numbers that are generated the same starting point or seed so that we'll get the same sequence of generated numbers every time we run our program this is useful for debugging next we'll create our synapse matrices synapses are the connections between each neuron in one layer to every neuron in the next layer since we'll have three layers in our network we need to synapse matrices each synapse has a random weight assigned to it after that we'll begin the training code we'll create a for loop that iterates over the training code to optimize a network for the given data set we'll start off by creating our first layer it's just our input data now comes the prediction step we'll perform matrix multiplication between each layer and it's synapse then we'll run our sigmoid function on all the values in the matrix to create the next layer the next layer contains a prediction of the output data then we do the same thing on that layer to get our next layer which is a more refined prediction so now that we have a prediction of the output value and layer two let's compare it to the expected data using subtraction to get the error rate will also want to print out the average error rate at a set interval to make sure it goes down every time next we'll multiply our error rate by the result of our sigmoid function the function is used to get the derivative of our output prediction from layer two this will give us a delta which we'll use to reduce the error rate of our predictions when we update our synapses every iteration then we'll want to see how much layer one contributed to the error in layer two this is called back propagation we'll get this error by multiplying layer twos Delta by synapse Ones transpose then we'll get layer ones Delta by multiplying its error by the result of our sigmoid function the function is used to get the derivative of layer one now that we have Delta's for each of our layers we can use them to update our synapse weights to reduce the error rate more and more every iteration this is an algorithm called gradient descent to do this we'll just multiply each layer by a delta finally let's print the predicted output and there you have it let's run this in terminal and see what we get awesome we can see that our error rate decreases every iteration and the predicted output is very very close to the actual output there is so much we can do to improve our neural network for more information check out the links in the description below and please subscribe for more technology videos thanks for watching
Original Description
How does a Neural network work? Its the basis of deep learning and the reason why image recognition, chatbots, self driving cars, and language translation work! In this video, i'll use python to code up a neural network in just 4 minutes using just the numpy library, capable of doing matrix mathematics.
Code for this video:
https://github.com/llSourcell/Make_a_neural_network
I created a Slack channel for us, sign up here:
https://wizards.herokuapp.com/
Please Subscribe! That is the thing you could do that would make me happiest.
I recently created a Patreon page. If you like my videos, feel free to help support my effort here!:
https://www.patreon.com/user?ty=h&u=3191693
2 Great Neural Net Tutorials:
(please subscribe for more videos like these! )
1. https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1#.l51z38s7f
2. https://iamtrask.github.io/2015/07/12/basic-python-network/
Awesome Tutorial Series on Neural Networks:
http://lumiverse.io/series/neural-networks-demystified
The Canonical Machine Learning Course:
https://www.coursera.org/learn/machine-learning
Curious just how inspired neural networks are from brain architecture? Take some time to learn about the human brain! This is my favorite intro to neuroscience course:
https://www.mcb80x.org/
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 · 12 of 60
1
2
3
4
5
6
7
8
9
10
11
▶
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Bitcoin?
Siraj Raval
5 Ways to Use Bitcoin
Siraj Raval
BTC Fever - Siraj [Music Video]
Siraj Raval
5 Reasons to Build Decentralized Apps
Siraj Raval
The Interplanetary File System
Siraj Raval
How to Build a Dapp in 3 min
Siraj Raval
Life Before Smartphones
Siraj Raval
4 Ways to Use Smart Contracts
Siraj Raval
3 Dapps You HAVE to See
Siraj Raval
Char's Life as a BitTorrent Engineer
Siraj Raval
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
Build a Neural Net in 4 Minutes
Siraj Raval
Sentiment Analysis in 4 Minutes
Siraj Raval
The Hackathon Life
Siraj Raval
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
Build a Chatbot - ML for Hackers #6
Siraj Raval
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
Build a Recurrent Neural Net in 5 Min
Siraj Raval
Build a Simulation in 5 Min
Siraj Raval
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
Tensorboard Explained in 5 Min
Siraj Raval
Generate Music in TensorFlow
Siraj Raval
Build a Game Bot (LIVE)
Siraj Raval
Deep Learning Frameworks Compared
Siraj Raval
Introduction - Learn Python for Data Science #1
Siraj Raval
Build a Neural Network (LIVE)
Siraj Raval
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
Pong Neural Network (LIVE)
Siraj Raval
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
Visualizing Data with D3.js (LIVE)
Siraj Raval
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
Enter Siraj [Music Video]
Siraj Raval
Build a Web Scraper (LIVE)
Siraj Raval
Why is P vs NP Important?
Siraj Raval
How to Make a Neural Network (LIVE)
Siraj Raval
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
How to Make an Amazing Video Game Bot Easily
Siraj Raval
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
The Best Way to Prepare a Dataset Easily
Siraj Raval
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval
More on: Neural Network Basics
View skill →Related Reads
📰
📰
📰
📰
ML Infrastructure vs. AI Infrastructure: Are They the Same Thing?
Dev.to · Conor Breathnach
Formula Solver: Step-by-Step Math & Science Help
Medium · AI
Independence you can't prove — so price it
Dev.to · Colin Easton
Asyncio for I/O-Heavy Pipelines: aiohttp, asyncpg, Rate Limiting, Backpressure
Dev.to · Gowtham Potureddi
🎓
Tutor Explanation
DeepCamp AI