Coding Challenge #92: XOR Problem

In this coding challenge, I “solve” XOR with my simple JavaScript neural network library.

🔗 Toy-Neural-Network-JS:
🔗 Deeplearn.js:
🔗 ITP’s ML5.js library:

🎥 My Neural Networks series:
🎥 3Blue1Brown Neural Networks playlist:
🎥 My Perceptron video:

🚂 The Coding Train website:
💖 Support this channel on Patreon:
To buy Coding Train merchandise:
📚 Book recommendations:


🎥 For an Introduction to Programming:
🎥 For More Coding Challenges:







32 responses to “Coding Challenge #92: XOR Problem”

  1. Spyrodo Avatar

    can someone tell me whats wrong whit this code?

    void setup(){
    void draw(){

     x = 0; {
    while( x < width)
     x = x +1;

  2. Red Destroy Avatar

    Make a 2.5d video

  3. Daniel Astillero Avatar

    Hi Dan, let's use Iris dataset.

  4. Daniel Astillero Avatar

    Oh, Dan. You don't know how much you brighten up my day after seeing 16:15.

  5. Cristian Bernal Avatar

    I don't know anything about neural networks but this was amazing! Keep the videos coming!

  6. Mitchel Paulin Avatar

    "Imagine how you would build that with a circuit". Umm, do you mean using an XOR gate?

  7. Aaron Dinesh Avatar

    Is it just me or are some other people getting this error?
    Uncaught ReferenceError: i is not defined
    at draw (sketch.js:40)
    at p5.redraw (p5.js:51956)
    at p5.<anonymous> (p5.js:46250)
    at p5.<anonymous> (p5.js:46152)
    at new p5 (p5.js:46434)
    at _globalInit (p5.js:48404)

  8. Aristos Georgiou Avatar

    So glad I discovered your channel, I'm on the 2nd semester of computer science and I aspire to be as good as you one day 🙂

  9. Rahul Thakur Avatar

    Awesome explanation of topics

  10. Jesse Solomon Avatar

    16:55 "I'm going to use 'i'"
    I died a little inside

  11. TSTphil Avatar

    awesome video, i really love you're work and your way to teach! but i don't really understand why would i use a neural network to solve XOR … it's a classy for SVM …. but maybe i'm overfitted 😀 … of cause if you don't know that your data isn't linear separable you can't know that SVM would be the better strategy right?

  12. Alessandro Avatar

    Amazing Dan, thank you !!! 🙂

  13. Synaxis Avatar

    you give me motivation

  14. Florian  Ehrhardt Avatar

    Just realized that your matrix library is way more faster than numpy! Really!

  15. Siraj Raval Avatar

    Awesome work Dan!

  16. Ivan Gonzalez Avatar

    Nice and simple I like it

  17. giovanni scaramucci Avatar

    Hi! I see this video on about genetic alghoritm in processing how can I replicate that? How did they do?

  18. Rahul Gupta Avatar

    Can i use p5.js library with react-native to make fun games???? Please respond.

  19. veggiet2009 Avatar

    The other thing that may or may not have helped is training it on a fractional input… Especially if you want to control the shape, but I wonder if it would help Keep itfrom getting stuck

  20. Simon Bouchard Avatar

    M.L. is the Magic Land

  21. McLP Avatar

    Will you use relu?

  22. Ryan Kupka Avatar

    Why are there multiple correct solutions? Does it not really matter what's in the middle so long as the corners are the correct values?

  23. NatetheAceOfficial Avatar

    A 25min coding challenge on my Monday morning commute! Great way to brighten the start of the week.

  24. Matheus Lima Avatar

    Coloca legenda em português, por favor

  25. Alexander Zotov Avatar

    Excuse me but are you building a Skynet?

  26. Anmol Avatar

    a quick question, i am new to coding, background in accounting, have some high school experience in Java, and i have just started to learn the types of logic used in programming, how much time do you think it will take me to come at a level where i can understand and follow your projects, also any tips that'll help accelerate my learning, avoiding any common pitfalls will be appreciated. Right now i'm planning to put in 6hrs per week into learning this, will be focusing on Python and R.

Leave a Reply

Your email address will not be published. Required fields are marked *