GithubHelp home page GithubHelp logo

guofengw / deeplearning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bowdar/deeplearning

0.0 0.0 0.0 48 KB

Neural network base on c++14, support any number of layers 基于C++14元编程的深度学习神经网络模板类,支持任意层数

C++ 100.00%

deeplearning's Introduction

Meta-programming neural network 是一个基于C++14实现的元编程神经网络库 Compile-time matrix constructions, headonly, no dependency, limitless layers, limitless nodes

Feature

  • 支持任意深度和超大结点数
  • 矩阵运算(CNN采用张量运算)
  • 循环类网络输入输出支持多对单、单对多、多对多
  • 源码Head-only并且无依赖
  • 使用方法极其简单,适合程序局部应用ANN以及用来学习研究
  • GPU支持还在计划中

Sample

1) BPNN

#include "BPNN.hpp"
int main()
{
    /// 1. Create a 4 layers NN each layer nodes are 20, 30, 20 and 2
    ///    The first 20 is input layer and the last 2 is output
    typedef mtl::BPNN<20, 30, 20, 2> MyNN;
    MyNN bpnn;
    
    /// 2. Initialize, setup parameters and activate functions
    bpnn.init()
        .set_aberration(0.0001)
        .set_learnrate(0.8)
        .set_sigfunc(mtl::logsig)
        .set_dsigfunc(mtl::dlogsig);

    /// 3. Create input output matrixs, and then enter matrix datas your self
    MyNN::InMatrix inMx;
    MyNN::OutMatrix outMx;
    MyNN::OutMatrix expectMx;
    ///    enter matrix datas ...
    
    /// 4. Training, call train in your own way
    bpnn.train(inMx, outMx, 100);
    
    /// 5. Simulate
    bpnn.simulate(inMx, outMx, expectMx);
}

2) RNN

#include "RNN.hpp"
int main()
{
    /// 1. Create a 4 layers NN each layer nodes are 20, 30, 20 and 2
    ///    The first 20 is input layer and the last 2 is output
    typedef mtl::RNN<20, 30, 20, 2> MyRnn;
    MyRnn rnn;
    
    /// 2. Initialize, setup parameters and activate functions
    rnn.init()
       .set_aberration(0.0001)
       .set_learnrate(0.8)
       .set_sigfunc(mtl::logsig)
       .set_dsigfunc(mtl::dlogsig);

    /// 3. Create input output matrixs, and then enter matrix datas your self
    ///    RNN suport multi-in-out like M:1, 1:M and M:M also 1:1 which is meaningless
    MyRnn::InMatrix<10> inMx; /// 10 input a group, you can change it each training
    MyRnn::OutMatrix<2> outMx; /// 2 ouput a group
    MyRnn::OutMatrix<2> expectMx;
    ///    enter matrix datas ...
    
    /// 4. Training, call train in your own way
    rnn.train(inMx, outMx, 100);
    
    /// 5. Simulate
    rnn.simulate(inMx, outMx,expectMx);
}

3) LSTM

#include "LSTM.hpp"
int main()
{
    /// 1. Create a 4 layers NN each layer nodes are 20, 30, 20 and 2
    ///    The first 20 is input layer and the last 2 is output
    typedef mtl::LSTM<20, 30, 20, 2> MyLSTM;
    MyLSTM lstm;
    
    /// 2. Initialize, setup parameters, LSTM wouldn't setup activate functions
    lstm.init()
        .set_aberration(0.0001)
        .set_learnrate(0.8);

    /// 3. Create input output matrixs, and then enter matrix datas your self
    ///    RNN suport multi-in-out like M:1, 1:M and M:M also 1:1 which is meaningless
    MyLSTM::InMatrix<10> inMx;
    MyLSTM::OutMatrix<2> outMx;
    MyLSTM::OutMatrix<2> expectMx;
    ///    enter matrix datas ...
    
    /// 4. Training, call train in your own way
    lstm.train(inMx, outMx, 100);
    
    /// 5. Simulate
    lstm.simulate(inMx, outMx,expectMx);
}

4) CNN

coding ...

5) instance of MNIST

coming soon ...

6) GPU support

planning ...

7) Future

RCNN, GAN and custom cnn structure like VGG, ResNet, DenseNet ...

deeplearning's People

Contributors

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