Code Monkey home page Code Monkey logo

digit-recognition's Introduction

Simple MNIST Neural Network from Scratch ๐Ÿง 

This repository contains the implementation of a simple two-layer neural network for digit recognition using the MNIST dataset. It's designed as an instructional example to help you understand the underlying math of neural networks.

Prerequisites ๐Ÿ˜Ž

To run this code, you'll need the following:

  • Python 3.x
  • NumPy
  • Pandas
  • Matplotlib

Installation ๐Ÿ“ฆ

You can install the required dependencies using the following commands:

pip install numpy pandas matplotlib

Running the Code ๐Ÿƒโ€โ™‚๏ธ

To run the code, simply clone the repository and execute the following command:

python3 mnist_nn.py

This will train the neural network on the MNIST dataset and print the accuracy of the predictions.

Understanding the Code ๐Ÿค“

The code is divided into several functions, each responsible for a specific step in the neural network training process:

  • init_params(): Initializes the neural network parameters.
  • ReLU(): Implements the ReLU activation function.
  • softmax(): Implements the softmax activation function.
  • forward_prop(): Performs forward propagation through the neural network.
  • one_hot(): Converts labels to one-hot vectors.
  • deriv_ReLu(): Computes the derivative of the ReLU activation function.
  • back_prop(): Performs backpropagation to compute the gradients.
  • update_params(): Updates the neural network parameters based on the gradients.
  • get_predictions(): Converts network outputs to predicted labels.
  • get_accuracy(): Calculates the accuracy of the predictions.
  • gradient_descent(): Trains the neural network using gradient descent.

Contributing ๐Ÿค

If you have any questions or suggestions, feel free to open an issue or pull request. Your contributions are welcome!

I hope this README file is helpful and informative. Please let me know if you have any other questions.

digit-recognition's People

Contributors

pawaspy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.