https://github.com/danishayman/low-level-tensorflow
A low-level TensorFlow implementation of a neural network model using gradient descent optimization.
https://github.com/danishayman/low-level-tensorflow
gradient-descent neural-network tensorflow
Last synced: 2 months ago
JSON representation
A low-level TensorFlow implementation of a neural network model using gradient descent optimization.
- Host: GitHub
- URL: https://github.com/danishayman/low-level-tensorflow
- Owner: danishayman
- License: mit
- Created: 2024-04-14T11:30:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-11T06:51:29.000Z (about 1 year ago)
- Last Synced: 2025-05-18T09:11:31.502Z (about 1 year ago)
- Topics: gradient-descent, neural-network, tensorflow
- Language: Jupyter Notebook
- Homepage:
- Size: 258 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Neural Network Implementation with TensorFlow 🧠
A low-level TensorFlow implementation of a neural network model using gradient descent optimization.
---
## 📋 Project Overview
This project implements a neural network model from scratch using TensorFlow's low-level API. The implementation includes:
- Custom forward propagation
- Gradient descent optimization
- Early stopping mechanism
- Model evaluation metrics
---
## 📊 Dataset
The dataset contains binary classification data with 5 input features. Distribution:
- Training set: 700 samples
- Validation set: 100 samples
- Test set: 200 samples
---
## 🏗️ Model Architecture
- Input layer: 5 neurons
- Hidden layer: 15 neurons with ReLU activation
- Output layer: 1 neuron with sigmoid activation
- Loss function: Mean Squared Error
---
## 🛠️ Implementation Details
### Key Components
1. Data Processing:
- 📈 Standard scaling normalization
- 🔄 70-10-20 train-validation-test split
2. Model Functions:
- 🔜 `forward()`: Implements forward propagation
- 📉 `loss_fn()`: Calculates MSE loss
- 🎯 `train()`: Single training step using gradient tape
- 🔄 `fit()`: Training loop with early stopping
3. Training Parameters:
- Learning rate: 0.01
- Batch size: 16
- Maximum epochs: 100
- Early stopping patience: 5
---
## 📈 Results
- Final test loss: 0.268303
- Classification metrics:
- Accuracy: 58%
- Precision: 59%
- Recall: 58%
- F1-score: 55%
---
## 🚀 Getting Started
### Prerequisites
- Python 3.x
- Git
### Clone the Repository
```bash
git clone https://github.com/danishayman/Low-Level-Tensorflow.git
cd low-level-tensorflow
```
### Install Dependencies
```bash
pip install -r requirements.txt
```
The required packages are:
- TensorFlow 2.x
- pandas
- numpy
- scikit-learn
- matplotlib
- jupyter
---
## 🚀 Usage
1. Start Jupyter Notebook:
```bash
jupyter notebook
```
2. Open the `Low_Level_TF.ipynb` notebook:
```python
# Load and preprocess data
dataset = pd.read_csv('classification_dataset.csv')
```
3. Train model:
```python
train_losses, valid_losses = fit(model, optimizer, train_data, valid_data,
weights, biases, epochs, batch_size, patience)
```
---
## 📦 Requirements
See `requirements.txt` for a complete list of dependencies.