This project demonstrates a basic single-layer neural network (perceptron) implemented in C, trained to learn the behavior of logic gates: AND and OR.
It's designed as a learning tool for beginners who want to understand the fundamentals of neural networks without using any external libraries.
- Learn AND or OR gate using the same code
- Implements:
- Forward propagation
- Sigmoid activation function
- Backpropagation with gradient descent
- Clean, commented C code for easy understanding
| Input A | Input B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
| Input A | Input B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
- The more you train, the more accurate the output becomes.
π‘ To train the model more to get accurate output,- For OR Gate Change the test number in line 28
- For AND Gate Change the epochs number in line 28
- Code editor (vscode , codeblock)
- C Compiler (e.g.
gcc)