Coder Social home page Coder Social logo

simple_cpp_fcnn_class's Introduction

Simple_CPP_FCNN_Class

This a simple C++ fully connected neural network class for Course COMP3046.

Codes

  • ANN.h : header file for ANN class
  • ANN.cpp : implementation of ANN class
  • ANN_Run.cpp : sample driving program for ANN class

Main Functions Supported

  • Defining any configuration of FCNN
  • Parrellel computation on CPU
  • Save and Load trained model
  • Output Loss and Testing accuracy
  • Output Epoch time spent

Explanation on ANN_Run.cpp

Set Configuration of the Neural Network

vector<int> cfg = { 28 * 28,100,10 };

The numbers in the vector indicates the numbers of neurons on each layer. In the sample file, there are (28 * 28 =) 784 neurons on input layer, 100 neurons on first (the only) hidden layers, and 10 neurons on output layers.

Construct an ANN instance:

ANN net(cfg);

Set Testing data

net.setTestData(test_X, test_Y);

test_X and test_Y are vector<vector<float>> that store the testing X data and testing Y data.

Train

net.train(X_train, y_train, 0.01, 100, 64);
Parameter Explanation
X_train vector< vector<float> > containing training X data
y_train vector< vector<float> > containing training y data
0.01 learning rate
100 Epochs to train
64 Batch size

Write Model to File

net.writeTo("Final_Model");

Load Model from File

ANN net("Final_Model");

Test Accuracy

net.testAccuracy()

Returns accuracy

Acknowledgement

This is a course project for COMP3046 in HKBU. Thanks to course instructor and teaching assistant.

Author

NI Ronghao ( RogerNi - GitHub )

simple_cpp_fcnn_class's People

Contributors

rogerni avatar

Stargazers

 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.