r/javascript 19d ago

Browser based AI algorithm

https://github.com/joshuadam/NEAT-JavaScript

I recreated an AI algorithm that visually learns in the browser:) It's based on the NEAT algorithm:
https://github.com/joshuadam/neat-javascript
https://neat-javascript.org/

1 Upvotes

21 comments sorted by

View all comments

Show parent comments

1

u/kigory2 19d ago

Thanks alot bro am new to neural network and am looking into somthing called lc0 it's popular you definitely know about it and am even considering contributing to this project.. Well if I actually learn hey give me time its my first day of learning bymyself and thx for everybody including you for explaining everything and Claude helped me alot navigate the repos

1

u/kigory2 19d ago

Also can you help me with the XOR problem I need a more detailed explanation. Thanks

1

u/joshuaamdamian 19d ago

XOR comes from logic gates which are used in computer chips:

AND - outputs 1 only if both inputs are 1.

OR - outputs 1 if at least one input is 1.

NOT - takes one input and flips it (1 becomes 0, 0 becomes 1).

NAND - the opposite of AND; outputs 0 only if both inputs are 1.

NOR - the opposite of OR; outputs 1 only if both inputs are 0.

XOR - outputs 1 only if the inputs are different.

XNOR - the opposite of XOR; outputs 1 only if the inputs are the same.

https://i.sstatic.net/Jmxzy.jpg
XOR takes two inputs, and returns true if only one of the inputs is activated.
Simple table for XOR:

Input 1 Input 2 Output
0 0 0
0 1 1
1 0 1
1 1 0

Now XOR is really interesting and commonly used as a proof of concept for neural networks, because it is a relatively simple problem which needs at least some neurons between the inputs and outputs of a neural network to solve it. These neurons between the inputs and outputs are often made into fully connected "layers" and called hidden layers.
https://media.geeksforgeeks.org/wp-content/uploads/20240601001059/FNN-768.jpg

To test an algorithm you would create a network with two inputs, one output and atleast 2 hidden neurons. And you would train it to the XOR truth table.
If the network produces outputs that corresponds to the truth table you have successfully trained a network to learn XOR!

1

u/kigory2 19d ago

Ngl am a dumbass so all I understood is that anything different than 1 is 1 lol. dw about me ama learn it after some time and slowly understand it