https://github.com/qua77i20/ai2
A simple single-layer neural network (perceptron) built in Python. Demonstrates backpropagation training from scratch for beginners.
https://github.com/qua77i20/ai2
ai backpropagation data-science deep-learning machine-learning neural-network numpy perceptron python
Last synced: about 1 month ago
JSON representation
A simple single-layer neural network (perceptron) built in Python. Demonstrates backpropagation training from scratch for beginners.
- Host: GitHub
- URL: https://github.com/qua77i20/ai2
- Owner: QUA77I20
- License: mit
- Created: 2025-01-14T17:43:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-14T18:07:05.000Z (over 1 year ago)
- Last Synced: 2025-03-20T07:47:18.437Z (over 1 year ago)
- Topics: ai, backpropagation, data-science, deep-learning, machine-learning, neural-network, numpy, perceptron, python
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Neural Network Training Project
This repository contains a basic implementation of a single-layer neural network (perceptron) using **Python** and **NumPy**. The project showcases how to train a neural network using the **backpropagation method**.
## ๐งฉ **Project Structure**
```
๐ AI2
โโโ src
โ โโโ AI2.py # Main code file with the neural network implementation
โโโ README.md # Documentation file (this file)
โโโ requirements.txt # Dependencies
โโโ .gitignore # Git ignore file
```
## ๐ **How to Run the Project**
1. Clone this repository:
```bash
git clone https://github.com/QUA77I20/AI2.git
```
2. Navigate to the project folder:
```bash
cd AI2
```
3. Run the Python script:
```bash
python src/AI2.py
```
## โ๏ธ **Functions and Methods**
### `sigmoid(x)`
The sigmoid function is used to map any real value to the range (0, 1).
### Training Process
- The network is trained using a simple dataset of binary inputs and outputs.
- The **backpropagation method** is used to adjust the synaptic weights based on the error between the expected and actual outputs.
## ๐ **Training Example**
Initial random weights:
```
[ 0.5, -0.3, 0.8 ]
```
After training:
```
[ 1.2, -0.6, 0.9 ]
```
## ๐งช **Testing**
The network is tested with new inputs to predict the output.
Example test input:
```
New input: [1, 1, 0]
Predicted output: 0.89
```
## ๐ **Future Improvements**
- Implement multi-layer perceptron (MLP).
- Add error visualization (e.g., matplotlib graphs).
- Optimize the backpropagation algorithm.
## ๐ **License**
This project is open-source and available under the MIT License.