Giter Site home page Giter Site logo

sunpengfei1122 / tensorflow-mnist-mlp-batch_normalization-weight_initializers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hwalsuklee/tensorflow-mnist-mlp-batch_normalization-weight_initializers

0.0 0.0 0.0 1.66 MB

MNIST classification using Multi-Layer Perceptron (MLP) with 2 hidden layers. Some weight-initializers and batch-normalization are implemented.

Python 100.00%

tensorflow-mnist-mlp-batch_normalization-weight_initializers's Introduction

Various initializers and batch normalization

An implementation of weight/bias initializers and batch normalization in Tensorflow.

MNIST database is used to show performance-comparison

Network architecture

In order to examine the effect of initializers and batch normalization, a simple network architecture called multilayer perceptrons (MLP) is employed.

MLP has following architecture.

  • input layer : 784 nodes (MNIST images size)
  • first hidden layer : 256 nodes
  • second hidden layer : 256 nodes
  • output layer : 10 nodes (number of class for MNIST)

Various initializers

The following initializers for weights/biases of network are considered.

Simulation results

  • Weight Initializer : he > trauncated normal = xaiver > normal
  • Bias Initilaizer : zero > normal

Sample results are following.

weight_init

Index Weight Initializer Bias Initializer Accuracy
normal_w_normal_b_0.9451 normal normal 0.9451
normal_w_zero_b_0.9485 normal zero 0.9485
truncated_normal_w_normal_b_0.9788 truncated_normal normal 0.9788
truncated_normal_w_zero_b_0.9790 truncated_normal zero 0.9790
xavier_w_normal_b_0.9800 xavier normal 0.9800
xavier_w_zero_b_0.9806 xavier zero 0.9806
he_w_normal_b_0.9798 he normal 0.9798
he_w_zero_b_0.9811 he zero 0.9811

Batch normalization

Batch normalization improves performance of network in terms of final accuracy and convergence rate.
In this simulation, bias initalizer was zero-constant initializer and weight initializers were xavier / he.

Sample results are following.

batch_norm

Index Weight Initializer Batch Normalization Accuracy
xavier_woBN_0.9806 xavier Unused 0.9806
xavier_withBN_0.9812 xavier Used 0.9812
he_woBN_0.9811 he Unused 0.9811
he_withBN_0.9837 he Used 0.9837

Usage

python run_main.py --weight-init <weight initializer> --bias-init <bias initializer> --batch-norm <True or False>

<weight initializer> must be selected in [normal, truncated_normal, xavier, he].
<bias initializer> must be selected in [normal, zero].

You may command like python run_main.py --weight-init xavier --bias-init zero --batch-norm True.

Acknowledgement

This implementation has been tested on Tensorflow r0.12.

tensorflow-mnist-mlp-batch_normalization-weight_initializers's People

Contributors

hwalsuklee 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.