Giter VIP home page Giter VIP logo

minimal-mnist's Introduction

Minimal MNIST

A very small fully connected neural network able to classify images from the MNIST database. The purpose is to better understand how to use the hpoptim package and experimenting with creating an architecture using bayesian optimization techniques.

The network is optimized using Bayesian Optimization and HyperBand (BOHB) to find the best hyperparameters.

Goals

The goal is to create a very small network that can classify images from MNIST. The number of output dimensions and activations for the first two layers, as well as the optimizer type, learning rate, and momentum are chosen using BOHB.

Best configuration

The following configuration yields a validation accuracy of 94.5% after just 10 epochs.

Item Parameter Value
1st Fully Connected Layer Input Flattened 28 x 28
Output dimensions 11
Activation ReLU
2nd Fully Connected Layer Output dimensions 11
Activation ReLU
Optimizer Type SGD
Learning Rate 0.0038795787201773
Momentum 0.9409782496856666

Physical Model

Owing to the simplicity of the model, I have chosen to create a physical version of this neural network. The hardware for this can be found in the physical-nn repo.

For the physical neural network representation, I chose to use a 10-15-10 layer architecture (i.e. output dim of 10, 15, 10 on the first, second and final layers respectively) as it looked more aesthetically appealing.

Numpy and Torch

As the plan for running the model physically will use a Raspberry Pi Zero W, a numpy version of the model has also been included.

Visualization

Model prediction visualization can be done using visualizer.py. This script visualizes the input from MNIST, the network prediction, and the network activations in the model.

Dependencies

  • numpy>=1.18
  • pillow~=7.1
  • pytorch>=1.5

minimal-mnist's People

Contributors

yvan674 avatar modjular 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.