Skip to content

Decuayer/neural-network-basics

Repository files navigation

Neural Network Basics: Built From Scratch

This repository contains a foundational implementation of basic Artificial Neural Networks (ANN) built entirely from scratch using Python and NumPy, without relying on high-level deep learning frameworks like TensorFlow or PyTorch.

The primary goal of this project is to gain a deep, fundamental understanding of how neural networks work, including the core mathematical concepts and algorithms behind them.


🎯 Project Overview

This project focuses on object classification tasks, specifically for image recognition, by implementing Multi-Layer Perceptrons (MLP) from the ground up.

Key Features and Implemented Concepts:

  • Custom Neural Network Class: A flexible structure allowing definition of layer counts, node sizes, and activation functions.
  • Forward Propagation: Implemented matrix multiplications (np.dot) to calculate weighted sums.
  • Activation Functions: Implementation of non-linear activation functions, including:
    • Sigmoid
    • (Likely) ReLU (Rectified Linear Unit)
    • (Likely) Softmax (for the output layer in classification).
  • Backpropagation: The core algorithm for calculating gradients and updating weights.
  • Loss Function: Implementation of a suitable loss function for classification (e.g., Cross-Entropy or Mean Squared Error).
  • Optimization: Basic implementation of Gradient Descent for training the model.

📁 Datasets

The project uses popular benchmark datasets to train and test the scratch-built models:

  1. MNIST (Modified National Institute of Standards and Technology): Used for handwritten digit recognition. (Input: 28x28 grayscale images).
  2. CIFAR-10: Used for training on more complex object classification tasks across 10 classes (e.g., animals, vehicles).

🛠️ Technologies and Requirements

The project deliberately limits dependencies to ensure the focus remains on the core mathematical implementation.

  • Python 3.x
  • NumPy: Essential for efficient matrix and vector operations.
  • Jupyter Notebook: Used for the interactive development and analysis of the models (.ipynb files).

Installation

Clone the repository and install the necessary dependencies:

git clone [https://github.com/Decuayer/neural-network-basics.git](https://github.com/Decuayer/neural-network-basics.git)
cd neural-network-basics
pip install -r requirements.txt 
# Note: If requirements.txt is not available, you likely only need:
# pip install numpy jupyter

🚀 How to Run

The core logic and training examples are contained within the Jupyter Notebooks:

  1. Start a Jupyter server in the project directory:
    jupyter notebook
  2. Open and run the following notebooks sequentially:
    • neural_network.ipynb: Contains the simple, generic neural network implementation.
    • neural_network_cifar10.ipynb: Demonstrates the application of the model to the CIFAR-10 dataset.
    • neural_network.py: (If present) The standalone Python script version of the model.

Follow the instructions and comments within the notebooks to understand the step-by-step process of model creation, training, and evaluation.

About

A foundational implementation of Artificial Neural Networks (ANN) built entirely from scratch using Python and NumPy to understand core machine learning concepts.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors