10.11: Neural Networks: Matrix Class Improvements - The Nature of Code

  Рет қаралды 46,093

The Coding Train

The Coding Train

Күн бұрын

Пікірлер
@MrHenryG123
@MrHenryG123 7 жыл бұрын
I wish I had this guy as my professor, I would never get bored in class again lol
@omg_look_behind_you
@omg_look_behind_you 7 жыл бұрын
Henry Goodman and you'd only need to go to the last 15min of class! love you, shiffman, but you know it to be true. i'd still attemt full on most days just to absorb some good juju.
@Truephoria
@Truephoria 6 жыл бұрын
All I can say, is that you're the perfect teacher. You make very complicated topics so easy to understand! Thank thank thank THANK you for existing and being the hero that the programming world needs! I tell everyone about your channel. To 1 million subs!
@nickbrougher2337
@nickbrougher2337 7 жыл бұрын
3rd year compsci major @ well-known school, learned more from a couple of your videos in a day than i have in the past two years of programming classes.
@voidemon490
@voidemon490 Жыл бұрын
fr tho
@paladin1147
@paladin1147 4 жыл бұрын
INCREDIBLE Video, my mind got blown to bits when you said you could just pass down functions within a function.
@hydra4370
@hydra4370 7 жыл бұрын
For some reason I always watch these videos while programming, even if it doesn't have anything to do with what I'm making.
@pawemonster7768
@pawemonster7768 6 жыл бұрын
I think that in Java is actually possible to create map function. You just have to use lambda expressions. In your example it could be like that: void map(Func map) { for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { float val = data [ i ] [ j ]; data [ i ] [ j ] = map.apply(val); } } } Func is interface and is annotated by @FunctionalInterface (but it isn't neccesary). Func has one metod. float apply(float val); In code possible is: Matrix m = new Matrix(2, 3); m.map(x -> x * 2);
@matveyryabov4551
@matveyryabov4551 6 жыл бұрын
Thank you sooooo much. I spent 4 hours today researching and asking questions on stack overflow and finally noticed your comment. Works like a charm! Would you have any resource which you would recommend to learn about lambda expressions or could you perhaps explain to me further how your code works?
@pawemonster7768
@pawemonster7768 6 жыл бұрын
I'm very happy that I helped you. To be honest I began with kzbin.info/www/bejne/naGshpmgaLCUhcU , and after that, I started to study more about lambdas and streams on my own. Just by reading jdk8 overview
@samuelgunter
@samuelgunter 6 жыл бұрын
Can you send me the whole Func interface /* class *\ ? Thanks
@matveyryabov4551
@matveyryabov4551 6 жыл бұрын
@@samuelgunter sure i can tomorrow. How shall I?
@samuelgunter
@samuelgunter 6 жыл бұрын
still waiting...
@elainegallardo7478
@elainegallardo7478 6 жыл бұрын
I have never understood matrix math before, not the way I do now. THANK YOU SO MUCH
@M1ckeyD
@M1ckeyD 4 жыл бұрын
Its wierd watching a tutorial series on Neural networks, and needing to go through static functions. Very thorough.
@ya64
@ya64 7 жыл бұрын
Daniel, just wanna say that your videos are always inspiring, no matter the topic. Thank you!
@Pablo-pk2qi
@Pablo-pk2qi 2 жыл бұрын
Duuuuude, I hope you will never stop making new coding videos :D
@realcygnus
@realcygnus 7 жыл бұрын
really great stuff Dan.....I can't wait for the next parts.......its priceless content imo.....& I appreciate it.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Thank you, this series is a tough one!
@emteiks
@emteiks Жыл бұрын
Thanks for putting the course. Really helpful. I also noticed that chatGPT asked about simple neural-network example from JS provides code from your course! Food for thoughts! Positive fun to see your beard growing from video to video ;)
@QG1996
@QG1996 7 жыл бұрын
Where can I watch you live? I learnt a lot about deep learning from you.. I love that you don't cut out the errors you do.. This way I can learn and understand better from your errors!!
@tomhuibers333
@tomhuibers333 7 жыл бұрын
Already looking forward to the next one. Loving the nn videos!
@nathansoufflet
@nathansoufflet 7 жыл бұрын
Just had my Linear Algebra final exam this morning and only watching this now x)
@suprguy
@suprguy 7 жыл бұрын
The naming convention for functions as arguments is actually callback. For example take a look at the documentation for Array.map() on your preferred website MDN.
@stefanvanreeth5719
@stefanvanreeth5719 7 жыл бұрын
The transpose function should also swap the values of this.cols and this.rows. Like it is now, if you ask the Matrix object for its dimensions when it was transposed, it gives the original values back. Depending on the format of the Matrix, this will either result in reading non-existing values in one direction, while omitting a whole set of data in the other; or the program breaks and sends an error to the console. Say, you have a 2 rows by 3 columns matrix. You use transpose() on it. You then ask the cols/rows properties to read the data array using a double loop. You will only read 2 rows (while there now are 3), and in each row the last column would yield an unidentified value, since you try to read 3 columns while there are only 2. This might be a hard to spot error since in this case the program doesn't break immediately. It probably will do that later on, when trying to do math on the unidentified values. In the case of a 3 rows by 2 columns matrix, the program would first omit to read the last column (because it thinks there are only 2), then break when trying to access the array in the non-existent third row. Off course, one can always read the lengths directly from the arrays in this.data, but that kinda defeats the purpose of the cols and rows properties. Maybe I'm a bit verbose here, but i felt an example was in order to clarify.
@JersenMan
@JersenMan 6 жыл бұрын
@ 15:00 It's fairly easy to do in java using functional interfaces. This way you can just do something like: Function function = d -> d*d; //this now accepts a double and squares it using lambda. matrix.map(function); Or directly: matrix.map(d -> d*d); in the mapping method you simply do: public void map(Function func){ for(blabla){ for(blabla2){ this.data[i][j] = func.apply(this.data[i][j]); } } }
@OLApplin
@OLApplin 7 жыл бұрын
I started doing exactly that this weekend because of my linear algebra class. I'm also trying to Gauss-Jordan those matrices
@andyc178
@andyc178 5 жыл бұрын
16:37 *copies and pastes two characters*
@akaizn
@akaizn 7 жыл бұрын
"Matrix world", Agent Smith: stay right there, don't move!
@carlosbeizaga
@carlosbeizaga 2 жыл бұрын
This list is amazing! Thanks for it
@thefigmaster3519
@thefigmaster3519 5 жыл бұрын
Hey Dan, great video! How would i be able to apply the same idea of static methods to processing?
@0xTim
@0xTim 7 жыл бұрын
Isn't your map function technically more like a forEach function?
@LeRouxBel
@LeRouxBel 7 жыл бұрын
14:50 => Well, in Java 8, you have access to Function, Predicate and so on, which makes functional programming pretty feasible. Sure has a few more steps than JS (imports, type declaration, ...) but it ain't too crazy once you get the gist.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Thanks for this info!
@Dalendrion
@Dalendrion 7 жыл бұрын
Yup. you can even use lambda notation now! m1.map(x -> x * 2); //doubles every cell It's awesome.
@mehdiSupp
@mehdiSupp 7 жыл бұрын
Rocking that beard !
@TheBeast-rz8te
@TheBeast-rz8te 7 жыл бұрын
I really like your video style. You seem so human and flawed but still highly intelligent and just really relateable. Although I knew everything you said and wrote in your neural network videos, I still got something new out of it because you have your unique way of presenting and explaining. Thank you for that. Do you plan on doing some stuff with Recurrent Neural Networks? I would love that, cause I find them to be the most interesting type of network there is, I just hope that if you do plan on going over them, you do it without these fancy neural network libraries because it really diminishes the learning factor, imho. I would definitely not complain if you used faster matrix libraries. Again, thank you so much for doing what you do! :)
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Thanks for the nice feedback. Yes, I hope to get into RNN eventually, I will start using deeplearn.js at some point sooner than later, but I also like the idea of building simple examples without the library for explanatory purposes.
@TheBeast-rz8te
@TheBeast-rz8te 7 жыл бұрын
The Coding Train That sounds really cool, I didn't want to discourage you, I just like it when you figure it out for yourself and simultaneously for us. Additionally, I prefer building these things for myself too, they might not be as fast or complex as finished libraries but building smth for yourself is a valuable lesson. Looking forward to the continuation of the series!
@MultiLeandrini
@MultiLeandrini 6 жыл бұрын
Could you talk more about that "lambda function"?
@FlotteeMottee
@FlotteeMottee 4 жыл бұрын
I would prefer the name "foreach" for your map-Function and maybe you could call the function you pass in a "callback"?
@RRKS_TF
@RRKS_TF 5 жыл бұрын
6:25 i was writing this in c# and I already did this part. cool
@bennis9283
@bennis9283 7 жыл бұрын
17:15 this guy is amazing ^^
@francojohnc
@francojohnc 4 жыл бұрын
Other conventional name of func from map is callback
@ziedbenamor7658
@ziedbenamor7658 6 жыл бұрын
Actually with java 8 we can now call a method with an Other as parameter using lambda expression, functionnal interface, référence method and Other stuff in prety easy way. Otherwize we can Also use design pattern strategy witch consists basically on wrapping methods with an object, put the object as a paramter and then call that method
@haydergfg6702
@haydergfg6702 5 жыл бұрын
Good job
@akiilino
@akiilino 6 жыл бұрын
One thing I noticed is that the sketch.js with the function doubleit(x) written does not work on Opera. With Firefox, it returns 2 tables with the same values. Then I decided to try with Opera browser, and returned correctly (2nd table values are double of the first). Anyone knows the reason?
@Zakiyfarhanfuad
@Zakiyfarhanfuad 6 жыл бұрын
same here, i'm using edge.
@samuelgunter
@samuelgunter 6 жыл бұрын
for whatever reason, firefox is dumb and just console.table's the end result of the variable. I just used chrome while I was making mine :3
@Voltra_
@Voltra_ 7 жыл бұрын
You should extend from Array, that would be cleaner than using an inner array
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
good point!
@omg_look_behind_you
@omg_look_behind_you 7 жыл бұрын
grandpa crockford would send you out for a switch and bend you over his knee. shiffman...he might just toss him in a bag full of puppies and toss in a river.
@lcpholman
@lcpholman 7 жыл бұрын
But a matrix is not an array. Can't see anything clean about that
@Voltra_
@Voltra_ 7 жыл бұрын
Lindsay Holman a 2D array is basically an array of arrays. Of course there are drawbacks but in this case (just for fun) it can ease the job
@TakeiRyo
@TakeiRyo 7 жыл бұрын
3:43 oh I know. :%s/this.matrix/this.data/g Get it?
@Creuilcreuil
@Creuilcreuil 7 жыл бұрын
17:10 it's called a functor
@AliSher-ol4wc
@AliSher-ol4wc 4 жыл бұрын
Sir can we use MATLAB for implementing MLPN Neural Network
@AlexanderZotov
@AlexanderZotov 7 жыл бұрын
Where is "Love" button?)
@karthikd490
@karthikd490 7 жыл бұрын
Video Request : Could you make a tutorial to plot Elliot Waves pattern recognition neural network on stock prices. Thanks in advance.
@tell5243
@tell5243 7 жыл бұрын
where would i find the updated code for this lesson?
@ultra_nerd
@ultra_nerd 3 жыл бұрын
would it be possible to do the map function in java?
@nolachronicle7386
@nolachronicle7386 6 жыл бұрын
Can anyone direct me to a place to figure out how to use the lambda expressions in order to use this map function correctly? programming this in Java. Thanks!
@count_of_pizza
@count_of_pizza 7 жыл бұрын
This is truly awesome :) speaking of matrix, I have idea for coding challenge: create simple 3D object in canvas which can be rorated using keyboard or buttons :)
@samuelgunter
@samuelgunter 6 жыл бұрын
that isn't a challenge?
@rodolfoamaya4528
@rodolfoamaya4528 7 жыл бұрын
Daniel, I’ll be starting college this upcoming Tuesday (January 16) and I was wondering what computer should I buy? I’m going for my basics right now but overall I’m interested in getting a bachelors degree in computer science. I’ll be watching your videos in the mean time and doing any coding that you teach me. I’ve always wanted wanted a MacBook but price is an issue for me. Should I borrow some money and buy a MacBook? Or what do you think I should do? Thank you.
@LeRouxBel
@LeRouxBel 7 жыл бұрын
Hello Rodolfo. If I may, I just want to say that you don't necessarily need a powerful computer for college coding. I understand that you might want a cool machine, but borrowing money is not the best. Look for something you can afford first (maybe a second-hand MacBook if you can trust the vendor). If you need this computer for coding and classes, there's no wrong choice really, anything will do. What I'd do is ask your classmates and teachers on Tuesday., see what they think / use. There is no hurry and this is a big money investment. Have a great first day of college !
@rodolfoamaya4528
@rodolfoamaya4528 7 жыл бұрын
Art Work c thanks for replying! What do you recommend?
@c1337
@c1337 7 жыл бұрын
You are the best
@lcpholman
@lcpholman 7 жыл бұрын
You can't easily pass functions in java? You can since lambdas were introduced in java 8, but that was only 3 and a bit years ago I guess.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Ah, this is a very important correction, apologies for the mistake!
@lcpholman
@lcpholman 7 жыл бұрын
No apologies required :). I should correct my own mistake, as in addition to lambdas, we also had method references and functional types added, which all contribute to easing the pain.
@N0D0hNuts
@N0D0hNuts 6 жыл бұрын
You mean that the code he wrote as map(func) would work in JAVA?
@lcpholman
@lcpholman 6 жыл бұрын
N0D0hNuts Conceptually yes. The syntax is different (-> in java as opposed to => in javascript), and in java you map a steam rather than the collection directly, and of course type checking changes the landscape somewhat),
@N0D0hNuts
@N0D0hNuts 6 жыл бұрын
Lindsay Holman wow thanks for that quick reply! :) good to know. I'll look into it
@emilie1977
@emilie1977 7 жыл бұрын
Superrr Daniel!
@NeverBeenToBrisbane
@NeverBeenToBrisbane 7 жыл бұрын
I have a question that idk how to ask Google: is there a way to add the +,-,*,/ operators as part of the functionality of different objects? Like if I want to add two matrices, is there a way I could make it so I could do something like "m3 = m1 + m2" I know C allows it but I can't find anything similar in JavaScript
@alexanderristinmaa
@alexanderristinmaa 7 жыл бұрын
Devon Farrier I know it’s possible, but I don’t know how.
@alexanderristinmaa
@alexanderristinmaa 7 жыл бұрын
Devon Farrier stackoverflow.com/questions/19620667/javascript-operator-overloading you should check this out.
@NeverBeenToBrisbane
@NeverBeenToBrisbane 7 жыл бұрын
MaTriX thanks at least we know it's possible then :D
@NeverBeenToBrisbane
@NeverBeenToBrisbane 7 жыл бұрын
Drat there is no operator overloading in JavaScript .-.
@AntiHeadshot
@AntiHeadshot 7 жыл бұрын
Arrow Functions! a.map( x => x*2 );
@NardiPaffon
@NardiPaffon 5 жыл бұрын
when he does the "replace this.matrix with this.data" I was like "noooooooooooooooo you forgot the others!!! Someone watching live please tell him!!! :( :( :( "
@Toopa88
@Toopa88 7 жыл бұрын
Trying matrix stuff in C right now xD
@MatthewBishop64
@MatthewBishop64 5 жыл бұрын
I already made a print() function 3 videos ago haha
@andrewmasek2170
@andrewmasek2170 5 жыл бұрын
Same
@JimTVmusic
@JimTVmusic 7 жыл бұрын
Hey guys, try to use my mixes while coding and maybe Coding Train will share it ^_^
@badsyntax173
@badsyntax173 6 жыл бұрын
Higher order functions
@badsyntax173
@badsyntax173 6 жыл бұрын
I know I'm late but you really should Abstract out add and multiply with map. There is so much repeated code you are gonna have hell if you ever want to make changes
@badsyntax173
@badsyntax173 6 жыл бұрын
add(n) { let f = function(x) { return x + n } map(f) }
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Thanks for this suggestion!
@badsyntax173
@badsyntax173 6 жыл бұрын
The Coding Train My bad I checked the git, it was already fixed.
@andruw5075
@andruw5075 5 жыл бұрын
Your static multiplication doesn't work...
@mlshkkz413
@mlshkkz413 7 жыл бұрын
come on man another matrix video? 😅
@witherking2537
@witherking2537 Жыл бұрын
But there are lambda functions in java lol
@slmtv7699
@slmtv7699 7 жыл бұрын
7th
@dominicforster706
@dominicforster706 7 жыл бұрын
Hi, your map() function could also be realised by using my favourite design pattern: The command pattern :)
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Say more!
@dominicforster706
@dominicforster706 7 жыл бұрын
gameprogrammingpatterns.com/command.html using this pattern you could specify an command to map and then call execute() to all of the data
@suprguy
@suprguy 7 жыл бұрын
Dominic Forster you wouldnt gain anything by using it though
10.12: Neural Networks: Feedforward Algorithm Part 1 - The Nature of Code
27:41
Coding Challenge #99: Neural Network Color Predictor
37:45
The Coding Train
Рет қаралды 97 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 40 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
2024's Biggest Breakthroughs in Math
15:13
Quanta Magazine
Рет қаралды 261 М.
Coding Challenge 183: Paper Marbling Algorithm
32:10
The Coding Train
Рет қаралды 80 М.
The Every UUID Website Explained
33:43
ThePrimeTime
Рет қаралды 216 М.
The Most Important Algorithm in Machine Learning
40:08
Artem Kirsanov
Рет қаралды 542 М.
Essential Matrix Algebra for Neural Networks, Clearly Explained!!!
30:01
StatQuest with Josh Starmer
Рет қаралды 57 М.
Why Does Diffusion Work Better than Auto-Regression?
20:18
Algorithmic Simplicity
Рет қаралды 397 М.
Coding Challenge 171: Wave Function Collapse
1:18:37
The Coding Train
Рет қаралды 558 М.
Coding Challenge #92: XOR Problem
25:01
The Coding Train
Рет қаралды 111 М.
Transformers (how LLMs work) explained visually | DL5
27:14
3Blue1Brown
Рет қаралды 4 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 40 МЛН