Machine Learning Tutorial for Beginners – USING JAVASCRIPT!

In a few lines of code, we can tackle real browser or server challenges with machine learning and neural networks! Here’s the source code:

Machine learning is a fun new(er) way to solve problems.
Rather than programming an algorithm for answering a question about our data, we instead can train a “neural network” with a set of training data. Once we have a trained network, we can use it to predict outcomes.

In this example, we will train a neural network to distinguish between dark and light colors and pick the appropriate color of text to go over the top. To do this without machine learning, there is no single solution that will always get it right (see this blog post

Learning Web Development? Watch the FREE COURSE:
“Web Development for Absolute Beginners”!



36 thoughts on “Machine Learning Tutorial for Beginners – USING JAVASCRIPT!”

  1. Kept getting require.js is not defined so bundled it after each change using browserify app.js -o bundle.js and then continually got network is not defined. this is frustrating.

  2. Great video! I am a bit confused. At 3:18 you say that brain.js expects inputs between 1 and 0, but at 3:45 you put heights and weights directly. Does this mean we could use 255, 0 or 120 for the RGB part as inputs, instead of 1, 0 or 0.47?

  3. Hey i m new here…can anyone tell me that i want to learn programming…so from which vedio i should start…because there are lots of vedios here

  4. not the best example, you should have picked a problem which cannot be easily described algorithmically.

  5. This is possibly the best example I have seen to get started with machine learning for noobs like me. Thanks!

  6. One thing that I've noticed is the lack of semicolons people use in JavaScript. I always thought it was just the way it works and that it's more lenient as opposed to other languages. As a C# developer it hurts my head and if there's a better understanding I would honestly like to know. Thanks.

  7. Really good video and it was the first video i found to understand brain.js. It was confusing though when you used numbers largers than 1 to with brain.js I did not hear your point that it only works well with input between 1 and 0. I thought it would deal with height, width and weight data accurately like in your example with more data. Even when i put in the exact input data to run with that was in the training it never reaches over 90%. This because it was dealing with numbers over 1. Took me a few hours to find out why. Just a bit of feedback.

  8. What if I train my program to do something, then I wish to train him a few more things? Do I need to train EVERYTHING again or is it possible to train a few extra things only?

  9. I normally don't comment videos, but this video really helped me grasp the concept of machine learning. I'll definitely stick around for more content!

  10. Great video thank you very much!!! One question, how are you serving your static file? I didnt see you run the server or give it a port yet in the browser you have a port. Interesting way of doing it

Leave a Reply