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.
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,
- A + B represent OR operation between A and B
- A' and B'represent A & B compliment respectively
- dot(.) represent AND operation
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.