Build a Neural Net in 4 Minutes
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:
I created a Slack channel for us, sign up here:
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!:
2 Great Neural Net Tutorials:
(please subscribe for more videos like these! )
1.
2.
Awesome Tutorial Series on Neural Networks:
The Canonical Machine Learning Course:
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:
Follow me:
Twitter:
Facebook: Instagram: Instagram:
Signup for my newsletter for exciting updates in the field of AI:
Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available):
This is amazing! You managed to squeeze all that info into a 3 min video, but I had to watch it like 5 times, so my mind can keep up with your voice. lol
Thanks! Yeah I tried, i’ll definitely make more of em
check this blog to read more about the code
http://iamtrask.github.io/2015/07/12/basic-python-network/
alright, first of all, amazing video’s! but i would like to point out that when running this program, in addition to the import numpy as np you corrected in the video yourself, there are a couple of other problems 🙂
on line 7: return 1/(1+np,exp(-x)), the comma after np has to be changed to a dot.
on line 10: X = np.array([[0..,1]], the last square bracket has to be removed because it would make for invalid syntax, and the dots should be comma’s.
on line 28: for j in xrange(60000):, the xrange has to be changed to just range, xrange is not recognized.
i guess that’s about it, after running it now it works like a charm!
thanks again!
here are the same lines after the corrections:
line 7: return 1/(1+np.exp(-x))
line 10: X = np.array([[0,0,1],
line 28: for j in range(60000):
thank you for this! This comment needs more upvotes, great corrections
+Sirajology Thanks, that means a lot to me. I just hope you keep adding more video’s! they are all very informative.
xrange is python2 syntax, which is the same as range in python3. In python2, it’s better to use xrange, because it creates a generator instead of range which creates a giant list taking up a ton of memory.
You can mark the comment to stay at the top
One more thing.
line 3 correction: def nonlin(x, deriv=False)
watch for 3 minutes, understand for 3 hours
hahah
I’m trying to recreate this in Java… Figuring out how to multiply arrays is the hardest part. I don’t have NumPy doing it for me.
@Juubes recreating this in C# and I feel your pain
good job 😀 I ended up using a math library to do the job
Synetic -Have you been able to recreate this in C# yet? If so, please post the code. Thanks !!!!
completes python class
realizes knows nothing about python
dude keep watching my vids, i want to be the go to source for learning python for ML
ML?
Machine learning
ye im in grade 11 and in my second year of computer science in high school and we don’t do anything interesting and the class moves so slow so your vids are my main source to learn some advanced topics
What do you think about the MOOC “Learning from data” ? I understand the math and theory but there’s not a whole lot of application (yet) I’m halfway through.
would be pretty fucking helpful to mention what the objective of the network is. now it’s just “layer layer layer prediction layer layer error DONE next video”.
good point thanks
To answer the implied question: The objective is to get your prediction to equal the correct output – [0,1,1,0]
Matthew Harris thanks man
I get that your channel is branded by these quick videos, but you should consider doing a follow up “explanatory” video; I think a lot of people would find it helpful
thanks Troy. I want the live streams to be that, but they aren’t really connected directly to the quick videos. I can do that more often
please do more of those explanatory vids,coz these ones are just too fast my man
+Siraj Raval Yes I totally agree with this comment and I think many other people will too once this channel scales. I’m a high schooler trying to learn computer science on my own and this stuff is obviously way above my head, but I still find it incredibly enjoyable. However, a more in-depth, elucidative video would be great for people like me to really let the concepts sink in. Your content is great though!
the people saying “you should slow down” are not aware that they probably wouldn’t have clicked on a video titled “build a neural net in 24 minutes”
I would. In fact, I’d prefer a 10-hour version.
But I wouldn’t. High schoolers don’t have 10 hours on hand lol.
Then label the video as “in 11 lines”, instead of “4 minutes”. and take more time in explaining.
The video is awesome, but some of us are not fast learners. We need some explaining as well. 🙂
I feel like the internet should be the safe space wherein I dont have to learn at a snails pace to avoid that social distaste that comes along with self-identity tied to rat race by those whose wits leave them in disgrace?
Nand Fednu do you identify as a PJW?(programming justice warrior)
1. import numpy as np
2. deriv=False # should be equal sign in nonlin function. deriv variable’s default value.
3. same function 1/(1+np.exp(-x)) # not comma.
awesome, was just reading the comments to fix these errors!
Same
yeah he made a ton of mistakes… apparently when he ran the code after he was running a pre-written file instead of the one he was showing us
thanks….i was searching for corrections
Thanks ! I couldn’t figure out what was up with error 3
bro import numpy as numpy?
Lol
lolllllllll
bro that’s not the worst part.
I mean, how many syntax errors can one make? Turns out, 5.
He is importing numpy as alias numpy ..nothing wrong if we don’t use the alias np
Hahah
*walks away from computer and starts reconsidering life choices*
very good
This seriously made me LOLLLLLLL.
😂
Skwisgaar Skwigelf: Pfft. This is dildos, doesn’t he knows there’s no such things as religion?
Nathan Explosion: You mean you don’t believe in God. There IS such thing as religion.
Skwisgaar Skwigelf: Well, then proves it! Show me, uh, miracles that religion exists!
Nathan Explosion: Well, you know, um… there’s the Bible right there.
[he points at it]
Skwisgaar Skwigelf: Welllll… maybe I reevaluates… my life then.
Cristian Soare Lol
There’s something in you that makes me watch more of your videos even if I don’t understand them unlike those boring MIT/IIT lectures.
Makes me feel smarter.
if you watch it at 2x speed you can build your network in 2 minutes!!!!!
thats my man
lol
I didn’t get it at 0,75 speed how it would look when it will bombard you with so much information xD
If I watch it at 1/8 speed I might be able to understand .01% of it
LoL best comment Ever😂😂😂
Always watch at 2x speed to learn 2x faster. Time is precious!
so precious
I do the same. If you ignore music videos I watch nearly all videos on YouTube twice the speed. I would say about three times the speed would be the limit for me in videos with speaking in it but YouTube doesn’t offer that.
More fast more close to God. Wait till your nose got bleeding. Then you’ll learn how to fly
Here’s a trick I learned from a friend playing poker online: open several browser windows. Learn in parallel x10 faster !
Also I always make sure I have a spare few ram sticks lying around ready to plug into that DIMM slot on the back of my head for those high intensity moments.
I didn’t understand much of the code you shared, but copied it into the IDE and it ran after a little troubleshooting. Now I get to play with it and figure out exactly what each line does. Thank you for putting out a short but working program to explain it. Love your videos!
First, I like that he kept his promise (too many videos say under 4 minutes and it’s like 12 minutes long). Second, the speed is actually great for learning efficiently, in that you can just watch it all the way through, and pause rewind where you need to. This makes it really accessible to learners at many different levels so people can easily take it at their own pace. Third, just plain ole good explanation. Bravo. *round of applause*
1:17
the first line of code should be
import numpy as np
and at line 8 is
return 1/(1+np.exp(-x))
at line 12
X = np.array([0, 0, 1],
I remember watching this back in late May, knowing nothing of what you’re going through. After messing around for a short while in python, I have a vague sense of the blur in front of me
Thank you for posting the suggested articles in your description. Those are helping out soooo much for understanding neural networks!!!!
Thank you so much for this! I love this style. It tells me everything I need to know and I can learn those things at my own pace by watching other videos about it.
Have you ever experienced frustration in learning something new to you, then you come across a video which gives you that “Ah ha, it all clicks!” moment? This video did that for me, thanks!