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


Program With Erik says:

Really like this topic, please keep going!

Martin Naughton says:

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.

Alex Lovo says:

Very good explanation for the beginner. I was scared to tackled ML, but when its explained in a simple context like this, I feel better about taking it on and learning more!

GeeksPort says:

That was awesome…

Hacking tutorials says:

I subscribed immediately. Thank you so much

Tang Li Qun says:

hey just wondering if you could tell us what colour theme you’re using there? love the bracket colour separations! also, amazing video!

Mohammed suliman says:

لا يشوفه مشهور الدبيان

Talha Balaj says:

<3 <3 <3 <3

Musical world says:

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

trouble says:

Thx you, bro. Thats nice, please more lessons about brain.js
From Russia with love <3

Jagjot Singh says:

Can we use advanced regression algorithm using JS ?

Mark Wade says:

Cool and inspiring, thanks! Would be keen to see more.

rasheeq ishmam says:

What is your VS code theme name?

Bracer Jack says:

Wow I fucking love your voice !

AlexGuerrero007 says:

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

Ville-Matti Hakanpää says:

That was awesome! Thanks!

BRGameSoft says:

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?

R M says:

Brilliant vid man!

ณัฐพงศ์ พันธุศิลป์ says:

Can’t wait next vdo.

Melroy van den Berg says:

The best video ever on machine learning, since it’s too easy to start and use.

SJ Kim says:

Thank you for the wonderful tutorial!
Question: Is brain.js a good start with Machine Learning for a web developer with no/very minimal backgrounds in statistics and machine learning? I want to learn and build good fundamentals before diving into machine learning and feel a bit hesitant to rely on a library right off the bat.

Jai Lopez says:

This is click bait! You said no library raw coding and the complete opposite is what we got, using the brain library that’s the first thing you said we wouldn’t be using, in fact a
L this functions are premade and none were coded on the video so me watching I did not learn anything but copy and paste and that I already knew how to do.

mercantilistic says:

This has been a fantastic intro to machine learning, thank you for this excellent content. Please keep making more!

Naima Shaikh says:

why you add dataset.js file in it? elaborate this plz

Daniel Adigun says:

This is simply awesome. Please more about brain.js. Way more clearer than tensor.js

elfpimp1 says:

Hehehe, now I want to know the Brain story…

LostInAutism says:

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.

Анонимуси says:

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?

Jason Codes says:

Luv it but could u please upload to github.Pls?

Jasiu Hanc says:

Damn, making machine learning perks & features available to everyone. Well done brain.js, well done.

Bracer Jack says:

I downloaded “”, inside the folder there are many js files but no brain.js, please explain to me how to include it, I don’t like to use npm.

Izumi Koushiro says:

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.

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!