An open API service indexing awesome lists of open source software.

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.

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.