Тёмный

Build a Neural Net in 4 Minutes 

Siraj Raval
Подписаться 770 тыс.
Просмотров 820 тыс.
50% 1

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:
github.com/llSourcell/Make_a_...
I created a Slack channel for us, sign up here:
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!:
www.patreon.com/user?ty=h&u=3...
2 Great Neural Net Tutorials:
(please subscribe for more videos like these! )
1. medium.com/technology-inventi...
2. iamtrask.github.io/2015/07/12...
Awesome Tutorial Series on Neural Networks:
lumiverse.io/series/neural-net...
The Canonical Machine Learning Course:
www.coursera.org/learn/machin...
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:
www.mcb80x.org/
Follow me:
Twitter: / sirajraval
Facebook: / sirajology Instagram: / sirajraval Instagram: / sirajraval
Signup for my newsletter for exciting updates in the field of AI:
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: chatgptschool.io/ Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available):
www.wagergpt.co

Опубликовано:

 

8 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1 тыс.   
@robertmielewczyk9804
@robertmielewczyk9804 6 лет назад
if you watch it at 2x speed you can build your network in 2 minutes!!!!!
@SirajRaval
@SirajRaval 6 лет назад
thats my man
@vjp2866
@vjp2866 5 лет назад
lol
@_nikdo
@_nikdo 5 лет назад
I didn't get it at 0,75 speed how it would look when it will bombard you with so much information xD
@jakemkultra
@jakemkultra 5 лет назад
If I watch it at 1/8 speed I might be able to understand .01% of it
@yashwanthreddy366
@yashwanthreddy366 5 лет назад
LoL best comment Ever😂😂😂
@Vancha112
@Vancha112 8 лет назад
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):
@SirajRaval
@SirajRaval 8 лет назад
thank you for this! This comment needs more upvotes, great corrections
@Vancha112
@Vancha112 8 лет назад
+Sirajology Thanks, that means a lot to me. I just hope you keep adding more video's! they are all very informative.
@TheMightyMagic
@TheMightyMagic 7 лет назад
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.
@wilguineralessandro
@wilguineralessandro 7 лет назад
You can mark the comment to stay at the top
@hansolo1428
@hansolo1428 6 лет назад
One more thing. line 3 correction: def nonlin(x, deriv=False)
@cristiansoare8456
@cristiansoare8456 7 лет назад
*walks away from computer and starts reconsidering life choices*
@SirajRaval
@SirajRaval 7 лет назад
very good
@vladimirleon2487
@vladimirleon2487 7 лет назад
This seriously made me LOLLLLLLL.
@yousifhela
@yousifhela 6 лет назад
😂
@aaronr7991
@aaronr7991 6 лет назад
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.
@getparadox
@getparadox 6 лет назад
Cristian Soare Lol
@Attakijing
@Attakijing 7 лет назад
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"
@Th4w
@Th4w 7 лет назад
I would. In fact, I'd prefer a 10-hour version.
@MrBroybros
@MrBroybros 7 лет назад
But I wouldn't. High schoolers don't have 10 hours on hand lol.
@sworoopmahapatra6921
@sworoopmahapatra6921 7 лет назад
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. :)
@nandfednu3502
@nandfednu3502 6 лет назад
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?
@honkytonk4465
@honkytonk4465 6 лет назад
Nand Fednu do you identify as a PJW?(programming justice warrior)
@plaaosert
@plaaosert 8 лет назад
watch for 3 minutes, understand for 3 hours
@SirajRaval
@SirajRaval 8 лет назад
hahah
@juubes5557
@juubes5557 7 лет назад
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.
@synetic707x
@synetic707x 7 лет назад
@Juubes recreating this in C# and I feel your pain
@synetic707x
@synetic707x 7 лет назад
good job :D I ended up using a math library to do the job
@patrickrobinson317
@patrickrobinson317 7 лет назад
Synetic -Have you been able to recreate this in C# yet? If so, please post the code. Thanks !!!!
@MyFrenchfries
@MyFrenchfries 8 лет назад
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
@SirajRaval
@SirajRaval 8 лет назад
Thanks! Yeah I tried, i'll definitely make more of em
@tellvivk
@tellvivk 7 лет назад
check this blog to read more about the code iamtrask.github.io/2015/07/12/basic-python-network/
@mailoisback
@mailoisback 6 лет назад
Always watch at 2x speed to learn 2x faster. Time is precious!
@SirajRaval
@SirajRaval 6 лет назад
so precious
@benrex7775
@benrex7775 6 лет назад
I do the same. If you ignore music videos I watch nearly all videos on RU-vid twice the speed. I would say about three times the speed would be the limit for me in videos with speaking in it but RU-vid doesn't offer that.
@raisalengko9056
@raisalengko9056 5 лет назад
More fast more close to God. Wait till your nose got bleeding. Then you'll learn how to fly
@Martinit0
@Martinit0 5 лет назад
Here's a trick I learned from a friend playing poker online: open several browser windows. Learn in parallel x10 faster !
@jacksonzheng3103
@jacksonzheng3103 3 года назад
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.
@fuzzypenguino
@fuzzypenguino 8 лет назад
completes python class realizes knows nothing about python
@SirajRaval
@SirajRaval 8 лет назад
dude keep watching my vids, i want to be the go to source for learning python for ML
@fuzzypenguino
@fuzzypenguino 8 лет назад
ML?
@talesseed
@talesseed 7 лет назад
Machine learning
@danialkhan1556
@danialkhan1556 7 лет назад
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
@Roy51794
@Roy51794 7 лет назад
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.
@osmanbaskaya7400
@osmanbaskaya7400 7 лет назад
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.
@wfpnknw32
@wfpnknw32 7 лет назад
awesome, was just reading the comments to fix these errors!
@zephram0326
@zephram0326 7 лет назад
Same
@Trophonix
@Trophonix 6 лет назад
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
@sindhudakavarapu8101
@sindhudakavarapu8101 6 лет назад
thanks....i was searching for corrections
@cyruslloyd6372
@cyruslloyd6372 5 лет назад
Thanks ! I couldn't figure out what was up with error 3
@troy8423
@troy8423 7 лет назад
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
@SirajRaval
@SirajRaval 7 лет назад
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
@kinsleyKJV
@kinsleyKJV 7 лет назад
please do more of those explanatory vids,coz these ones are just too fast my man
@CharltonLepkofker
@CharltonLepkofker 7 лет назад
+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!
@DanielGallagherMusic
@DanielGallagherMusic 6 лет назад
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*
@Learning_Daily
@Learning_Daily 2 года назад
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!
@StephenRoseDuo
@StephenRoseDuo 7 лет назад
bro import numpy as numpy?
@SirajRaval
@SirajRaval 7 лет назад
Lol
@hagopvittali3465
@hagopvittali3465 6 лет назад
lolllllllll
@RiedlerMusics
@RiedlerMusics 5 лет назад
bro that's not the worst part. I mean, how many syntax errors can one make? Turns out, 5.
@parthaprateempatra4278
@parthaprateempatra4278 5 лет назад
He is importing numpy as alias numpy ..nothing wrong if we don't use the alias np
@user-tj4ut8ox9r
@user-tj4ut8ox9r 4 года назад
Hahah
@Goldenfightinglink
@Goldenfightinglink 5 лет назад
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
@StingerSecSol
@StingerSecSol 6 лет назад
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!
@nands4410
@nands4410 7 лет назад
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.
@RunstarHomer
@RunstarHomer 6 лет назад
Wow, okay, so I see all the steps you did, but have absolutely no idea why you did any of it.
@jarrellmark
@jarrellmark 8 лет назад
This video helped me understand today's dark art
@SirajRaval
@SirajRaval 8 лет назад
Glad I could help!
@w4rsch3inlich95
@w4rsch3inlich95 5 лет назад
I have watched so many tutorials, but never fully understood the logic, but this example is done so simple and brilliant, that i finally got it.
@eleos5
@eleos5 3 года назад
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.
@villikuha7387
@villikuha7387 7 лет назад
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".
@SirajRaval
@SirajRaval 7 лет назад
good point thanks
@deidyomega
@deidyomega 6 лет назад
To answer the implied question: The objective is to get your prediction to equal the correct output - [0,1,1,0]
@akshayraj4627
@akshayraj4627 6 лет назад
Matthew Harris thanks man
@MegaJefflin
@MegaJefflin 6 лет назад
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],
@tamasbarath8659
@tamasbarath8659 6 лет назад
I actually have neural networks subject on the 6th semester of computer scientist bachelor (so in the last) and what you said in this 3 minutes was equal to the past month of lectures (roughly 6 hours total time) and made it witha clearer code and better explanation even if it wasn't on my native language. You also made me way more enthusiastic about the topic as i see it's not impossible. Looking forward to study more from your videwos :D
@mcm1024
@mcm1024 8 лет назад
Man I have read over neural net tutorial and watched videos for years but nobody ever broke it down this well and cut right to the point. You rock!!
@SirajRaval
@SirajRaval 8 лет назад
wow, huge compliment thanks so much :)
@bop8566
@bop8566 7 лет назад
"A refrigerator filled with lots of foods and drinks"
@MatteoProgrammer
@MatteoProgrammer 7 лет назад
i hope i'm not the only one who has set the "video speed" to 0.5 :P one subscribed from italy
@SirajRaval
@SirajRaval 7 лет назад
lol ciao!
@aaron7c
@aaron7c 6 лет назад
0.75 sounds like normal talking^
@CarlosReyes-vd6om
@CarlosReyes-vd6om 6 лет назад
I did it too lol
@ShubhamSingh-vh1vw
@ShubhamSingh-vh1vw 6 лет назад
0.75
@Hm-mn3ip
@Hm-mn3ip 6 лет назад
MatteoProgrammer ITALIAAAAA
@hardwareful
@hardwareful 7 лет назад
At first I was frustrated with the forget-everything-you-just-heard speed but then I saw your other videos, detailed description and code on GitHub! Nice job getting people into this!
@DeusExMach
@DeusExMach 8 лет назад
Dude, finally. Thank you. I knew I understood this, but just couldn't slap it all together. This video was like finding a missing Lego instruction manual.
@SirajRaval
@SirajRaval 8 лет назад
anytime, more to come thank you
@EddieKMusic
@EddieKMusic 7 лет назад
Here's the code: import numpy as np # sigmoid function def nonlin(x,deriv=False): if(deriv==True): return x*(1-x) return 1/(1+np.exp(-x)) # input dataset X = np.array([ [0,0,1], [0,1,1], [1,0,1], [1,1,1] ]) # output dataset y = np.array([[0,0,1,1]]).T # seed random numbers to make calculation # deterministic (just a good practice) np.random.seed(1) # initialize weights randomly with mean 0 syn0 = 2*np.random.random((3,1)) - 1 for iter in xrange(10000): # forward propagation l0 = X l1 = nonlin(np.dot(l0,syn0)) # how much did we miss? l1_error = y - l1 # multiply how much we missed by the # slope of the sigmoid at the values in l1 l1_delta = l1_error * nonlin(l1,True) # update weights syn0 += np.dot(l0.T,l1_delta) print "Output After Training:" print l1
@SmokCode
@SmokCode 7 лет назад
I don't know who is this video for - the audience that doesn't understand nn will learn nothing, guys who already understand nn won't benefit from video either. Please slow down or split the topic into smaller chunks.
@nahiyanalamgir7614
@nahiyanalamgir7614 6 лет назад
The title itself is the reason why he got so many views. Guys who genuinely explain the stuff get way fewer views. Check out "giant_neural_network." The guy makes really top notch videos but gets few views. And here we have Siraj, who copied code from iamtrask.github.io/2015/07/12/basic-python-network/ and didn't explain shit.
@DudeBronkster
@DudeBronkster 6 лет назад
Wow, it really looks like the code is straight out copied... Hm. Also, thanks for suggesting giant_neural_network! Seems like exactly the channel I've been looking for.
@ghostkr3676
@ghostkr3676 5 лет назад
@@nahiyanalamgir7614 yeah giant neural network is the best
@wafaawardah3264
@wafaawardah3264 6 лет назад
Just watched this again after about 5 months into my NN journey, realizing this was my first nn program and it's written so perfectly!
@tostupidforname
@tostupidforname 6 лет назад
I HAVE NEVER SEEN A THING WITH THAT MUCH INFORMATION PER TIME HOLY MOLY THIS IS SO COOL.
@kray97
@kray97 8 лет назад
Couple of suggestions: 1. maybe slow down a bit? A Neural Net built in 6 minutes might be easier to communicate than one built in 4. 2. Also please comment your code more. Your comments are very sparse/high level and provide little to no detail about how backprop is implemented in your NN. Thx!
@SirajRaval
@SirajRaval 8 лет назад
great feedback, will do thanks
@miniwarrior7
@miniwarrior7 8 лет назад
+Sirajology I feel bad because I'm a senior in my cybersecurity degree and I just took data mining and learned about neural networks but still couldn't keep up at all lol. some High level math you got going on there :c the fact that im still learning Python doesn't help either.
@DustinRodriguez1_0
@DustinRodriguez1_0 8 лет назад
I would also recommend naming your variables better. Why is l0 l0 and not layer0? Why are you using j as your loop counter rather than training_step, which would make your comment just prior to the loop superfluous? X and y are similar, though I imagine I know exactly where they came from. Since you are displaying the code being written in a sped-up fashion, however, making the variable names more readable rather than making them idiomatic in the way neural networks are typically taught by math PhDs would, I think, benefit the audience. Your editor features intelligent autocompletion, I'd recommend taking advantage of it. Also, if the code presented in the video was up on Github or made similarly available in textual format, I could have (and would have) gone through and made these changes myself to show you how much more readable the script could have been... perhaps post the code from your videos on Github and link it in the description?
@nevelis
@nevelis 8 лет назад
+Dustin Rodriguez I think that's all pedantic nit-pickery. l0 is perfectly fine in this context for layer 0 for two reasons: 1) It's demonstration code 2) L is the actual symbol used in the scientific field... L0 means layer 0 - people in this field know this. j is perfectly fine for a single loop, what are you talking about man?! Post the code on git hub for you to clean it up?! Do you honestly have nothing better to do :D :D +Sirajology thank you for the concise vid! This is a good starting point.
@nevelis
@nevelis 8 лет назад
To answer your question about the superfluous comment: Each *stage* has a title. If we follow your suggestion & rename 'j' to 'training_step' and remove the comment, we a: increase the variable name 13-fold to describe a LOOP variable, and b: we remove the comment from this single stage, making it inconsistent with the rest of your code. Far out... I hope I never have the displeasure of working on a development team with you Dustin :D
@FilipSollar
@FilipSollar 7 лет назад
Hey, isn't your derivative of the sigmoid incorrect ? you have there x*(1-x) but it is supposed to be exp(x)/((exp(x)-1)**2) I applied it and there error rates were lower by about 0.01
@sandor.kecskemeti
@sandor.kecskemeti 6 лет назад
The source code is correct, but tricky. The derivative of the sigmoid function is f_sigm'(x)=f_sigm(x) * (1 - f_sigm(x)). When calling it, the number passed is not x, but f_sigm(x). This is much faster, because f_sigm(x) is already calculated and the formula is much simpler. Nice trick, but took some headache to find out what is going on.
@benyaminewanganyahu
@benyaminewanganyahu 5 лет назад
"When calling it, the number passed is not x, but f_sigm(x)." facepalm... This was confusing me as well. The original article should at least make this clear, I, of course, don't expect Siraj to :p
@DrProfessor143
@DrProfessor143 6 лет назад
My dog was watching this video and he learned too. Thanks, man.
@2get
@2get 6 лет назад
I see many people complaining, but this is not the speed youtubers deserve. It is the speed youtubers need.
@wolfisraging
@wolfisraging 6 лет назад
Did u started like this? And understood forward propagation, back propagation, gradient descent..... In just 4 mins?
@Fidelity_Investments
@Fidelity_Investments 3 года назад
few mistakes in the code. using periods as commas and vice versa, using np when you imported numpy as numpy
@epiclysimple4208
@epiclysimple4208 6 лет назад
This is the most intense and brilliant video on how to code a neural network I have ever seen. Great job man
@danielgonzales2047
@danielgonzales2047 5 лет назад
Thank you for posting the suggested articles in your description. Those are helping out soooo much for understanding neural networks!!!!
@bryangarcia4153
@bryangarcia4153 7 лет назад
0:45 "import numpy as numpy" really? so much faster now that you got it down to the same number of letters lol
@rem7412
@rem7412 3 года назад
damn that's just pretty smart why am saying something to a 3-year-old comment
@waxwingvain
@waxwingvain 8 лет назад
Incredibly well explained in such a short amount of time! thank you!
@SirajRaval
@SirajRaval 8 лет назад
Thanks Bryan!
@calvinmousavi2980
@calvinmousavi2980 5 лет назад
I need a cup of coffee now! Three months worth of class in less than 4 minutes! Well done mate!
@maringuic2484
@maringuic2484 5 лет назад
wait how do I get the pyton version like yours mine looks like the one that you get when downloading windows and the one they use in the matrix with the green letters and black background I forgot what it's called?
@capeandcode
@capeandcode 6 лет назад
Those who didn't understand, seemingly similar code can be found here with explanation. iamtrask.github.io/2015/07/12/basic-python-network/
@diegoavendanohernandez9908
@diegoavendanohernandez9908 3 года назад
Thanks man, awesome.
@fuzzypenguino
@fuzzypenguino 8 лет назад
working code here (and you may have to install numpy in terminal with the command 'pip install numpy' and i also updated it after that): import numpy as np def nonlin(x,deriv=False): if(deriv==True): return x*(1-x) return 1/(1+np.exp(-x)) #input data X = np.array([[0,0,1], [0,1,1], [1,0,1], [1,1,1]]) #output data y = np.array([[0], [1], [1], [0]]) np.random.seed(1) #synapses syn0 = 2*np.random.random((3,4)) - 1 syn1 = 2*np.random.random((4,1)) - 1 #training step for j in xrange(60000): l0 = X l1 = nonlin(np.dot(l0, syn0)) l2 = nonlin(np.dot(l1, syn1)) l2_error = y - l2 if(j % 10000) == 0: print ("Error:" + str(np.mean(np.abs(l2_error))) ) l2_delta = l2_error*nonlin(l2, deriv=True) l1_error = l2_delta.dot(syn1.T) l1_delta = l1_error * nonlin(l1, deriv=True) #update weights syn1 += l1.T.dot(l2_delta) syn0 += l0.T.dot(l1_delta) print ("Output after training") print (l2)
@SirajRaval
@SirajRaval 8 лет назад
thanks for posting this :)
@mr.jacker3951
@mr.jacker3951 3 года назад
your activation function have some syntax error, how it can even compile/interpret by interpreter in one go?? ==> line number 8
@johnhammer8668
@johnhammer8668 7 лет назад
So much info packed in one video and it did a Avery good job of providing the skeleton of all neural network programs i think.
@duwangchew
@duwangchew 7 лет назад
I get errors such as np not defined, nonlin not defined and xrange not defined. I suppose it's because of python3, but the thing is while I found np and xrange for python3 I couldn't find nonlin. I'd appreciate if you replied with an answer to this :) Edit: Never mind I found out nonlin was function we created not numpy library function, I just misspelled it. Edit 2 : Still doesn't work, problem with np (now numpy). Edit 3: Looked at source code on github, everything works :D Edit 4: Except it really doesn't work, I mean there's no errors, but prediction is around 0.5 when it should be 0 or 1 and error rate doesn't go down. Edit 5: I was missing weight updating for synapses, now it works just great.
@SirajRaval
@SirajRaval 7 лет назад
awesome
@tristant9686
@tristant9686 7 лет назад
This is to difficult for me to understand. Do you have simpler videos to start with?
@SirajRaval
@SirajRaval 7 лет назад
i'll work on it
@maheshkoheda9194
@maheshkoheda9194 7 лет назад
Great work siraj,thanks.I been studying lot of books to get a clear picture on this.You did it just in 4minutes.kudos bro!
@Pavans3
@Pavans3 8 лет назад
great job showing a neural network example in under 4 mins Siraj! Way to go!
@SirajRaval
@SirajRaval 8 лет назад
woot, thanks Pavan !
@HT-uk4bo
@HT-uk4bo 5 лет назад
He imported numpy as numpy and then used np 😂
@mr.champion7304
@mr.champion7304 7 лет назад
wait, this is python 2.X, not python 3.X, can you update this for python 3.X?
@MegaJefflin
@MegaJefflin 5 лет назад
xrange->range
@RiedlerMusics
@RiedlerMusics 5 лет назад
pastebin.com/3HLCGFwC here you go, completely for python 3, and without all the syntax errors.
@ProtoMan137
@ProtoMan137 4 года назад
@@RiedlerMusics OMG thanks!
@ao9779
@ao9779 7 лет назад
Sincerly I think this is a good video, it is maybe a bit quick but it's been a long time I was searching for a first step like this, thank you !
@SirajRaval
@SirajRaval 7 лет назад
thanks Francis!
@leealmasy124
@leealmasy124 7 лет назад
Great concise explanation.! Most beginner's get 'bogged down' in trying to wade through a thick textbook.
@iLoveTurtlesHaha
@iLoveTurtlesHaha 7 лет назад
Help me understand what is going on ... I'm going to start learning python but I think I need to learn algebra and calculus too. I really want to do this as a career but I don't know where to start. :(
@RussellTeapot
@RussellTeapot 7 лет назад
for this specific "application", yes, I think you need algebra and calculus, since there are concepts like derivatives and matrices. But, if you want to just start learning Python, you don't _absolutely_ need calculus or algebra. Maybe you can start learning the basics of Python first, and then when you have the appropriate mathematical background do more :)
@xoreign
@xoreign 7 лет назад
Honestly these are pretty basic calculus concepts. Yes it's called calculus, but most of the actual calculations you would do are still based on algebra. It's the conceptual stuff that would be considered higher level.
@iLoveTurtlesHaha
@iLoveTurtlesHaha 6 лет назад
Thanks for the help guys. I'm currently learning Python and linear algebra. I already finished a fast tracked calculus course - I can't believe I did that. I guess I'm not as dumb as I thought I was. Either that or things just are easier when you are more interested in them.
@xoreign
@xoreign 6 лет назад
That's the beauty of applied learning. Knowledge that actually be applied to something useful.
@WerexZenok
@WerexZenok 6 лет назад
how did you learn linear algebra? I think I need to learn that to so i can understand the video.
@vikkyvikhnan6206
@vikkyvikhnan6206 7 лет назад
Hello i am a neuroscientist but new to neural networking. But i am fascinated to learn networking thing Oops i dont know programming also. So please suggest some lessons,videos,books etc. to starting this wonderful subjects
@nonya180
@nonya180 7 лет назад
either learn python or c++
@vikkyvikhnan6206
@vikkyvikhnan6206 7 лет назад
Thanks macha.
@DRSDavidSoft
@DRSDavidSoft 7 лет назад
Why no one suggest languages like JavaScript or Ruby, they are more easier and simpler than a language like C++ to start learning programming I highly endorse Python as well
@vladislavdracula1763
@vladislavdracula1763 7 лет назад
If you want to get something up and running as fast as possible, choose Ruby, JavaScript, or Python. If you want the maximum functionality possible, choose Java or C++
@kalechips965
@kalechips965 7 лет назад
Even though I know a bit of Matlab and Python, I still use R for this sort of thing lol.
@luis96xd
@luis96xd 6 лет назад
Amazing video, I really liked it! Finally I just understood all the code, and more of Machine Learning!
@micssr
@micssr 5 лет назад
This is the single best video on youtube I've watched so far. Efficiency wise.
@brianboss
@brianboss 7 лет назад
ohh so...potato?
@bakk.
@bakk. 7 лет назад
No potato
@SirajRaval
@SirajRaval 7 лет назад
potato
@gmoreira_
@gmoreira_ 5 лет назад
Not the best intro to Neural Networks. If you wanted to do it even faster just import TensorFlow or another library and be done with it. Now since you actually wanted to explain the basics behind an NN, 3 minutes won't cut it for the people getting started. As an example, you referred to the Sigmoid function as the function that maps every real number to a number between 0 and 1. Well, I can define an infinite number of functions that satisfy this criterion. The sigmoid is just an example. The Heaviside function works too. You should've thus referred to it as the activation function, and maybe explain why it needs to be differentiable, i.e., to allow for the implementation of a gradient descent backpropagation while training the net. Deep Learning isn't about writing fast code but rather understand what you're doing. Cheers
@tanan8116
@tanan8116 7 лет назад
There is a "input layer" which just estimulate a neuron of the next layer, this could be he sensors for example. That second neuron when is estimulated it directly estimulate another layer (this is the layer which changes over time). And the next layer just outputs data like for example jump or press a button. Is this how it works?
@sklify1232
@sklify1232 5 лет назад
With the 3 typos corrected (as discussed in the coms below), this exact code in the video works great! Thanks, Siraj!
@ozziejohnny2230
@ozziejohnny2230 4 года назад
He even playgiarizes this from udeemy course. Shameless scaammer
@voze1905
@voze1905 7 лет назад
He crazy?
@SirajRaval
@SirajRaval 7 лет назад
just passionate
@nahiyanalamgir7614
@nahiyanalamgir7614 6 лет назад
Copying code from iamtrask.github.io/2015/07/12/basic-python-network/ and vaguely explaining anything.
@aitorjara100
@aitorjara100 6 лет назад
Lol Eyan good catch. Too many ghosts on youtube and besides that not even credit is given
@LuthandoMaqondo
@LuthandoMaqondo 7 лет назад
Thank you Siraj Raval, I'm really grateful of your work, I'm catching up on your videos; from South Africa.
@johnhammer8668
@johnhammer8668 6 лет назад
Every frame has new content. No bullshit. That's awesome
7 лет назад
That was quick and interesting, but I got lost somewhere around half the video, my own neural network in MY BRAIN couldn't keep up with all the terms poping up. Damn, I must study this a LOT more.
@bhooshannagaokar6236
@bhooshannagaokar6236 4 года назад
Great, very well illustrated example of a NN mirroring XOR gate... Thanks.
@dragosstrugar3097
@dragosstrugar3097 5 лет назад
Proud of how you developed over time.
@LeetGuitar
@LeetGuitar 6 лет назад
I'm getting a syntax error at line 12, and looking at your code the last period in that line is white instead of purple like the others. Mine turns purple automatically and I assume that's the problem, but what am I doing wrong? Help would be greatly appreciated.
@evanwilliam9582
@evanwilliam9582 3 года назад
Where do you add the bias? , is that in the same line as the synapse/ feedforward/activation function.
@BlenderBeanie
@BlenderBeanie 6 лет назад
oh of course you added the code in the description... how good i did not try to write all of it by hand haha, that would be sooo stupid...
@tuberads4055
@tuberads4055 7 лет назад
Finally i found this amazing video on this topic to have a quickstart into NN thanks
@SirajRaval
@SirajRaval 7 лет назад
+tuberads yay
@WaqarAhmed-ng1ws
@WaqarAhmed-ng1ws 6 лет назад
@Siraj :I have written my own python code that reduces RMSE to 0.049 when i try to approximate artificial case of SinC function using sigmoid activation function. My target is to reduce it to as low as 0.01 than i try your code but it converge it 0.33 RMSE. what can be problem?
@olfmombach260
@olfmombach260 7 лет назад
So does this network have 3 neurons in the input layer, 4 neurons in the hidden layer and 1 neuron in the output layer?
@keremkurban8156
@keremkurban8156 7 лет назад
I got a question. Tried for 3 synapses got better results. wrote sth like this syn0 = 2*np.random.random((3,7)) - 1 syn1 = 2*np.random.random((7,4)) - 1 syn2 = 2*np.random.random((4,1)) - 1 but I totally make up the number (7). When I tried something like: syn0 = 2*np.random.random((3,400)) - 1 syn1 = 2*np.random.random((400,1)) - 1 I got significantly worse results. So how can we know the optimum number of synapses and the dimensions in the matrix. Thanks
@dp0813
@dp0813 5 лет назад
1) Need to add open and closing parentheses to lines 57, 58, 69, 70, 73, and 74. 2) Need to delete the "x" from "xrange" so you just have "range(number_of_training_iterations)" on line 30. That should do 'er. ;)
@davidcain3752
@davidcain3752 7 лет назад
I'm having some trouble with line 32, its telling me l2 is undefined. Literally wrote everything the exact way, im not sure what im doing wrong here? Any suggestions I'd be more than willing to email my version rn.
@christianbalderrama3179
@christianbalderrama3179 8 лет назад
Just want to recommend that you should have a series or playlist of this learning algorithms and explain it deeply Theoretically and Mathematically speaking! Especially Neural Networks, people may think that its just plain simple but it has a deep background behind it and I know that you know it. Anyway, I love your videos keep doing great more things about Machine Learning and looking forward to your future videos.
@SirajRaval
@SirajRaval 8 лет назад
Thanks a lot for the advice and the compliment!
@AstaStarz
@AstaStarz 7 лет назад
SyntaxError: invalid syntax >>> def nonlin(x,deriv-False): File "", line 1 def nonlin(x,deriv-False): Please help
@dr.mikeybee
@dr.mikeybee 6 лет назад
Very cool. I like how you home brewed this.
@luckynewman
@luckynewman 7 лет назад
great video thanks so much. i am researching whether or not i can train a robot im building with tensorflow or some type of similar machine learning base. is that even possible? Thanks so much
@curiously-cinnamon
@curiously-cinnamon 3 года назад
Please help. On line 40, l1_error = l2.delta*dot(syn1.T) I'm getting this error : AttributeError: 'numpy.ndarray' object has no attribute 'delta'
@Hyraethian
@Hyraethian 4 года назад
Okay so now I have an idea of what the code looks like compared to visual models. Time to think on this and then learn some more.
@EwanWills
@EwanWills 5 лет назад
i finished it all and the first line has a invalid syntax i'm doing it on windows is that why it doesn't work
@user-wr2uy9pj4m
@user-wr2uy9pj4m 5 лет назад
how do i go from this to ai that beat games or write songs?
@ianfinn4353
@ianfinn4353 7 лет назад
Saraj how do you import tensorflow into idle and how do you figure out the sigmoid. I'm new to AI and I really want to learn
@alchyseznam
@alchyseznam 7 лет назад
excellent 4 minutes of compressed of information. thank you. i think the picture illustrating the net has different properties than the implementation.
@SirajRaval
@SirajRaval 7 лет назад
thanks!!
@adityapaithon6499
@adityapaithon6499 5 лет назад
Nice breakdown Siraj.
@shariquenavali9994
@shariquenavali9994 6 лет назад
Hi Siraj. I tried running for AND data. (3 vars,epochs=100K) showing wrong results. Can you plz help me out ?
@bjoernliganfi1
@bjoernliganfi1 6 лет назад
Clear concise and short explanation of backpropagation. Thanks!
@venkateshr6031
@venkateshr6031 5 лет назад
Ok this showed up in my recommendation! I found the crazy Siraj!
@Sam-bg8vr
@Sam-bg8vr 6 лет назад
Great video! One question though, how many neurons are there in the hidden layer? I'm guessing 4 since in synapse0 there are 4 connections on each of the input neurons... also there are 4 connections in synapse1 while there is only 1 output neuron. Can anyone confirm this?
@asdk2006
@asdk2006 5 лет назад
how we can take the result and use it in vbnet code
@toni3doom
@toni3doom 6 лет назад
Thanks a lot Siraj for all your hard work. It means a lot for all of us.
@indhucs4642
@indhucs4642 6 лет назад
I used the exact same code, but my error hovers around 0.497 and 0.501 at the end of each 10000th iteration and the output is nowhere closer to the desired o/p. ?! Can someone help
@nabilelmasri4510
@nabilelmasri4510 6 лет назад
what does multiplying (not dot product) 2 arrays do in python as done in line 85 ?
@marcelmersch6797
@marcelmersch6797 7 лет назад
When i tested the code i got a error by importing numpy: 'There is no module called numpy'. What can i do?
Далее