8 ms·
Neural networks in JavaScript – free 19-part course
- stared 8y agoTotally add to the collaborative list of interactive Machine Learning, Deep Learning and Statistics websites https://github.com/stared/interactive-machine-learning-list https://github.com/stared/interactive-machine-learning-list (waiting for a PR! :))
- gkiely 8y agoThank you for doing this! Can't wait to check it out.
- deleted 8y ago[deleted]
- decafbad 8y agoWhy the heck Javascript?
- ilrwbwrkhv 8y agocoz its the best language for prototyping and learning
- supakeen 8y agoThere are many languages that are very popular for prototyping and learning what makes JavaScript the best?
- ilrwbwrkhv 8y agofor one its available in any browser console... there is no setup per se.
- ilrwbwrkhv 8y agoalso for better or for worse... the javascript ecosystem is amazingly wide... from brain as in this example to p5js for creative programming etc... i think we can agree that no other language and ecosystem has that much breadth and reach...
- king_magic 8y agoIt really, really super isn’t. It’s a Frankenstein mashup of programming insanity that never should have come into being in the first place, much less become the de facto language of the web.
- colordrops 8y agoAny particular reasons or is this just based on what you heard 10 years ago?
- aaaaaaaaaab 8y agoFrom the top of my head: - `this` - the whole prototypal inheritance thing - class inheritance bolted on top of prototypal inheritance - arrow functions vs `function` functions
- cwackerfuss 8y agoBut none of that is going to affect our ability to do machine learning work with JavaScript
- kkarakk 8y agodoesn't it affect complexity on an exponential scale though? codebases aren't paragons of perfection when even 2 devs are working on them
- deleted 8y ago[deleted]
- ilrwbwrkhv 8y agoit actually isnt a mashup... if u look at the data types... they are some of the simplest... the apis might be a bit weird... i agree
- kukabynd 8y agoSo, what language is not an insanity?
- mathgeek 8y agoWhy not? It's one of the most widely known languages among developers in many disciplines, which removes a barrier to learning the concepts. Someone who just wants to familiarize themselves with basic implementations could do so in any language if their goal doesn't include shipping production-quality code. There's also the added bonus that the concepts taught here are already covered by courses in other languages, so anyone is free to use those as well.
- SquareWheel 8y agoWhy not? It's extremely popular, fast and portable.
- hombre_fatal 8y agoAlso, it's hard to beat the browser for creating a quick visualization/UI for your code. Especially for an online course like this. I think we're at a point where you'd have to justify why you didn't use Javascript for a learning course.
- zawerf 8y agoOne very practical reason is to save on computation costs. GPU servers are not cheap and if you're going to run on CPU anyway, you might as well run it locally on the user's browser. Some demos such as real time object detection isn't possible at all if you had to pay roundtrip server latency (not to mention the complexity of streaming video to and from your server): https://github.com/ModelDepot/tfjs-yolo-tiny https://github.com/ModelDepot/tfjs-yolo-tiny And a lot of web demos such https://affinelayer.com/pixsrv/ https://affinelayer.com/pixsrv/ I don't believe will be up for such a long time if the author had to pay ongoing server costs.
- dahfizz 8y agoAre you under the impression that js is the only language that can run locally?
- itslennysfault 8y agoin a client's web browser... yeah.
- dahfizz 8y agoWell there is web assembly, but why is running in a web browser a requirement for creating a neural network anyway?
- kkarakk 8y agoso you can offset server costs to the client which usually means bloated laggy apps until someone comes along and figures out an optimised way of doing things, for eg react.js vs phonegap's comparative shitshow
- karmasimida 8y agoThere is NO save on computation cost. CPU is slow for NN whatever language you are using. OP has a point, if I want to learn PRACTICAL front end programming, I will choose javascript, not Python. Same for Neural networks, just switch the place.
- axel180 8y agoUsage: Javascript is everywhere and can be learned quickly. Speed: GPU can easily be tapped into inside Javascript with projects like GPU.js, which brain.js uses.
- reiinakano 8y agoCause you can do things like this https://magenta.tensorflow.org/blog/2018/12/20/style-transfer-js/ https://magenta.tensorflow.org/blog/2018/12/20/style-transfe...
- mattlondon 8y agoPersonally I've found that Python - or perhaps more Numpy et al - are impenetrable for a learner. I am sure the data structures that are used in Python + Numpy et al are powerful and well-suited for the task, but as a learner coming to this with minimal knowledge trying to ALSO learn the idiosyncrasies and weirdness (IMHO) of how Numpy does things and the weirdness (IMHO) of how Numpy even names things (e.g. in decades of programming, the term "shape" for an array was new on me) was an extra burden. Doing the same thing in Javascript with good old-fashioned arrays using good old-fashioned terminology clears the fog and makes things simpler for people who are not already fluent in numpy's data structures and terminology Javascript is - in my view - the equivalent of a "business english" of programming, i.e. even if you aren't fluent, its syntax and terminology is familiar to C/C++/Java/C#/Golang/ObjectiveC/Perl/etc that most people will at least be able to understand what is going on in the same way that business people who might not be fluent in English will at least be able to understand and basically communicate with each other even if they perhaps will not be writing Sonnets. Python feels like a niche language that developed in isolation and is only readable to people who have actually gone out of their way to learn it.
- kkarakk 8y agoshape makes sense if you think of arrays in terms of linear algebra concepts(which you should if you're working with ML concepts imo)
- sebringj 8y agoThis is fantastic! The tutorials are very simple to understand and can be actually used in your very familiar JavaScript env and the Scrimba editor is great coupled with the author editing things in real time that you can play with, brilliant. Thanks Robert!
- axel180 8y agoHey guys! I'm the creator of the course and lead developer of brain.js and would love to answer any questions you may have.
- nacs 8y agoIt took me a while to realize I wasn't just watching a static video and that I could actually interact with the code! Very well done and nice pacing/voiceover.
- makewavesnotwar 8y agoHey Axel! Just started watching but the interactive guide is incredible. It's like having Screenhero with a private tutor. Only thing is, I kind of wish there were something like the time-coded comments SoundCloud has. At the end of the second guide, we're asked to play around with the tests. I added: console.log(net.run([0, 4])); console.log(net.run([3, 3])); console.log(net.run([8, 4])); Based on the training data, I would expect this to resolve to ~4(or 1), ~0, ~8(or 1) by standard logic expectancies (if same return 0, else return the higher number or 1). But instead I received ~0, ~0, ~0. It's not immediately obvious what is causing this. But it seems like the model created is inherently ignorant of basic logic (at least by my narrow definition), and there isn't any immediate discussion of caveats as to error margin. I'll admit this might be a n00bish concern based on never programing neural nets before, but as this guide seems focused on introducing NN's to n00bs like me: a way to discuss concerns with other viewers/the author would be amazing. Aside from that, incredible work! I'll keep watching to see if I can figure out my misunderstandings. Update: Just discovered the Q&A tab, this should likely be adequate for my concerns. Well done. This may be the best online demo/tutorial I've ever seen.
- axel180 8y agoTy! This means a lot! Can you point me to the tutorial you added new tests with?
- makewavesnotwar 8y agoHey sorry for the delay, it was at the end of the second tutorial "Our First Neural Net!" I think you were instructing us to try testing the outputs for the other sets in the training data which all work as expected, but I took the "play around with the outputs" instruction to mean, see how the NN responds to novel inputs like the ones I mentioned.
- andyidsinga 8y agointeresting - it seems to me, anecdotally, that more and more ML/AI emerging in JS (vs python as the default goto). Anyone know if anyone is tracking this (similar to github language usage stats)?
- ultrasounder 8y agoThanks Robert for putting this together. Coming from PyTorch ecosystem. What is the actual requirement for this course? Would a smattering knowledge of ES6 do? Been leching at browser based implementations since Karpathy demoed his CNNs a few years ago but just havent had enough motivation and courage to pickup JS. Perhaps my main reson for anxiety is the confusing JS ecosystem.Also what are some real world use cases for training and deploying NNs on the browser rather than training and deploying it on a tradional cloud backend environment?
- parmesan 8y agoReal world use cases might be; Classifying the users mood from mouse movement, classifying the microphone audio. I.e. process real time data that might be too large to upload. I personally haven't seen any NNs being used in browser apps, but there are plenty of existing mobile apps that has NNs to classify audio/video/etc directly on the device.
- make3 8y agoafaik it's mostly for cool demos and educational purposes, or extremely latency intensive applications that funny require large models. for most deep learning models, training on the client is completely unreasonable, as they require weeks of training even on multi thousand $ pro equipement. For training, tiny metalearning models are the only reasonable thing to train on the clients in most useful scenarios, as they are pretrained to take as few examples as possible to train on a specific task (see MAML). For inference, aside from educational applications, the only potential advantage of in browser over in server is the lower latency. the main disadvantages are that you need to send the model to the client (multiple MB), with the longer loading time and potential problems with intellectual property this entails. maybe for some extremely small models in very latency driven applications, it can be worth it. So, overall, either educational purposes, training and use of latency hungry tiny metalearning models or inference with tiny pretrained latency hungry models, like computer vision on webcam sort of deal
- axel180 8y agoKeep in mind that while the tutorial is in javascript, in the web browser, the neural network easily apply for node based solutions as well. We're adding GPU support that use either client side OR server side GPU, so that any case you mention can be handled.
- amelius 8y agoIs there a Numpy equivalent for JS yet? How easy is it to use (considering that JS doesn't have operator overloading)?
- jimmy-dean 8y agoNot effectively. From what I've read, JS lacks SIMD support which makes Numpy-like vectorizations unachievable. Would be nice though...
- amelius 8y agoI think Numpy is written in C, so in principle they could use the same approach for JS (and invoke SIMD functions from C). The problem, however, is that there is no operator overloading in JS. So you can't write things like a[:,:,3] *= 2.
- fractalf 8y agoAwesome! Bonus point for doing a js course
- treypitt 8y agowhy would you do ML in JS?
- itslennysfault 8y agoWhy would you do web dev in python?
- ausjke 8y agoexactly, JS for ML sounds like a stretch indeed.
- Rotten194 8y agoI just watched the reinforcement learning video and was very confused -- where did the reinforcement learning happen? I thought reinforcement learning was giving an agent positive / negative signals to learn without example output data, but in the video the network was just retrained with more data? Is it an overloaded term maybe?
- axel180 8y agoTy for asking this question! "Reinforcement learning" has a wide definition, but in this case because we are using a simple feed forward neural network, "reinforce" is more principled by dynamic programming with supervised learning. We are not actually using a "Deep reinforcement learning" algorithm. The idea here is that the net can continue to train, reinforcing its previous understanding with new understandings, if new training data is provided. It may be that we need to clarify the tutorial, as your point is based around unsupervised learning, not having training data. Is it an overloaded term? YES!
- Rotten194 8y agoThanks for the clarification!
- itslennysfault 8y agoThis seems to exactly follow the examples from the readme. Guessing this is by someone that worked on the project. Either way great tutorial. One complaint... `#` THIS IS NOT AN ASTERISK! (he said it like 5 times in one video) Otherwise great tutorial
- axel180 8y agoDoh! You found a mistake. I'll try and take care of that asap. Ty for pointing this out.
- deleted 8y ago[deleted]