Implement a Neural Network learning XOR gate in your favourite languages !
To avoid problems, follow this architecture :
<root>
|_ python
|_ <username>
|_ my file.py
|_ network.py
|_ java
|_ <username>
|_ Main.java
|_ Test.java
To increase lisibility, I recommend to create only ONE FILE.
For instance, main.py
should contains all the code needed to run the project.
An XOR gate (sometimes referred to by its extended name, Exclusive OR gate) is a digital logic gate with two or more inputs and one output that performs exclusive disjunction. The output of an XOR gate is true only when exactly one of its inputs is true. If both of an XOR gate's inputs are false, or if both of its inputs are true, then the output of the XOR gate is false.
If an XOR gate has more than two inputs, then its behavior depends on its implementation. In the vast majority of cases, an XOR gate will output true if an odd number of its inputs is true.
Input | Output | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
A | B | A + B | A' | B' | A' + B' | A ⊕ B = (A+B).(A'+B') |
---|---|---|---|---|---|---|
0 | 0 | 0 | 1 | 1 | 1 | 0 |
0 | 1 | 1 | 1 | 0 | 1 | 1 |
1 | 0 | 1 | 0 | 1 | 1 | 1 |
1 | 1 | 1 | 0 | 0 | 0 | 0 |
In this table,
Gates are the building blocks of Perceptron. XOR is a classification problem and one for which the expected outputs are known in advance. It is therefore appropriate to use a supervised learning approach. The XOR gate consists of an OR gate, NAND gate and an AND gate. This means we need to combine two perceptrons.