DEV Community 👩‍💻👨‍💻

Cover image for Creating of neural network using JavaScript in 7 minutes!

Creating of neural network using JavaScript in 7 minutes!

Petro Liashchynskyi on January 12, 2019

Hey, what's up 😁 Today, i'm gonna tell you how to build a simple neural network with JavaScript by your own with no AI frameworks. Let's go! For g...
Collapse
 
alin_air profile image
Alin Andrei

I haven't understood most of it. I'll be back as soon as I get it folks

Collapse
 
liashchynskyi profile image
Petro Liashchynskyi

In the next article I would try to thoroughly explain how neural network works (with math examples), if you want 😉 And you will figure it out 😁

Collapse
 
jenc profile image
Jen Chan

Same boat but still fascinating

Collapse
 
liashchynskyi profile image
Petro Liashchynskyi

Hey, check out my new article about math principles of neural networks 😀dev.to/liashchynskyi/how-neural-ne...

Collapse
 
alin_air profile image
Alin Andrei

Hey, your post widened my perception. JavaScript or not, neural networks are pretty cool. I am willing to research the subject

Thanks!

Collapse
 
jenc profile image
Jen Chan

Post almost unrelated, but I was reading a tut about tensorflow.js and this video about tensors is veyr mathy but also very good youtube.com/watch?v=f5liqUk0ZTw

Collapse
 
edo9k profile image
Eduardo França • Edited on

Hi, I put the code on a RunKit notebook, for anyone who wants to see it running without having to install anything on their computer: runkit.com/edo9k/tiny-rnn

For some reason I kept getting an error in the train function, the error was output_layer is not a function, so I just wrapped the output_layer variable in an arrow function. Now it's running.

Great article, thank you.

Collapse
 
nuwannnz profile image
Nuwan Karunarathna

Wow, nice article and awesome explanation!

Collapse
 
liashchynskyi profile image
Petro Liashchynskyi

Your derivative is wrong. First, check this math.stackexchange.com/questions/7...

And this simple network can solve AND, OR, XOR, whatever. It depends on the data and the labels. Bias is simple, why don't you just google for it? 😅

Luck!

Collapse
 
thegeoffstevens profile image
Geoff Stevens

This is awesome! Very easy to follow. It's always fun to try to do things without frameworks.

Collapse
 
ondrejs profile image
Ondrej

You got deserved star on GitHub. Very good article, nice demonstration, thank you!

Collapse
 
liashchynskyi profile image
Petro Liashchynskyi

ohh, thank you so much!

Collapse
 
jenc profile image
Jen Chan • Edited on

Understood everything til backprop but if this is the simplest I’m glad for the explanation! Thanks bro 🤪

Collapse
 
metcoder profile image
Charlie Fuentes

Amazing article and really well explained. Congratulations 🎊

And thanks for this!

Collapse
 
liashchynskyi profile image
Petro Liashchynskyi

thank you! 😉

 
liashchynskyi profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Petro Liashchynskyi
  1. Your derivative is WRONG, man! Can't you see it? You wrote this: if (derivative) return x * (1 - x); But the correct way is this math.stackexchange.com/questions/7.... If you can't see the difference, then you're probably a noob in math and in programming, I think.

2, 3. Once you created a net, it can solve whatever (depends on the objective function, of course). Just pass through it data and labels (Supervised learning, have you heard of it? I think, no)

Did you write your network? OMG, good for you. Then why are you searching this kind of article for?

Good luck. There's no reason in continuing this discussion.

Some comments have been hidden by the post's author - find out more