Skip to main content

Implementation of a Feed Forward Neural Network

Project description

NeuralNet

Table of Contents

  1. Introduction
  2. Download
  3. Quick Start
  4. Features
  5. Project Report

Introduction

This repository contains an implementation of a Feed Forward Neural Network from scratch using numpy libraries. We have achieved a testing accuracy of 97.45% on MNIST Dataset and a 88.80.% testing accuracy on Fashion-MNIST Dataset.

You can also find a GPU version of the class NeuralNet in ctrain.py (Uses cupy instead of numpy(CuDa compatible)). We have found about 50~100 x speed boost in training time. We will release the cupy version module soon.

Download

You can view the source code for the NeuralNet class implementation from this page.

pip install NNeuralNet

Quick Start

Training

from NNeuralNet.NeuralNet import NeuralNet
from keras.datasets import mnist

# Import and Preprocess Data
( X_train, Y_train), ( X_test, Y_test) = mnist.load_data()
X_train = X_train.reshape(X_train.shape[0],-1).T
X_test = X_test.reshape(X_test.shape[0],-1).T

nn = NeuralNet( input_size = 784, output_size = 10)
nn.addlayer(128)
nn.addlayer(64)
nn.train( X_train, Y_train, numepochs = 10, learning_rate = 0.001)

Prediction

nn.predict( X_test, returnclass = 1)
# Set returnclass = 0 for class probabilities

Saving a Model

nn.save_model( "my_model.bin")

Loading a Saved Model

nn = NeuralNet.load_model( "my_model.bin")

Features

The NeuralNet class has support for the following features/parameters support:

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

NNeuralNet-1.0.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

NNeuralNet-1.0-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page