Coder Social home page Coder Social logo

boingoing / panann Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 0.0 665 KB

A zero-dependency, portable, and efficient library for building, running, and training feed-forward artificial neural networks.

License: MIT License

CMake 0.71% C++ 99.29%
neural-network artificial-intelligence lstm-neural-network

panann's Introduction

main build status

panann

A zero-dependency, portable, and efficient library for building, running, and training feed-forward and recurrent artificial neural networks.

Why panann

Panann is adapted from the neural network component of a hobby project named PAN built way back in 2008. For the tenth anniversary of the project, panann was split out into its own library and re-implemented in c++17. Panann is the PAN artificial neural network (PanAnn) component.

Using panann

Panann has a simple interface for constructing and running artificial neural networks.

// Make XOR 2-bit training set.
TrainingData data;
data.resize(4);
data[0]._input = { 0, 0 };
data[0]._output = { 0 };
data[1]._input = { 1, 1 };
data[1]._output = { 0 };
data[2]._input = { 1, 0 };
data[2]._output = { 1 };
data[3]._input = { 0, 1 };
data[3]._output = { 1 };

// Build a simple, multi-layer feed-forward network.
NeuralNetwork nn;
nn.SetInputNeuronCount(2);
nn.SetOutputNeuronCount(1);
nn.AddHiddenLayer(5);
nn.AddHiddenLayer(5);
nn.Construct();
nn.SetTrainingAlgorithmType(NeuralNetwork::TrainingAlgorithmType::SimulatedAnnealingResilientBackpropagation);

nn.InitializeWeightsRandom();
std::cout << "Error before training: " << nn.GetError(data) << std::endl;

nn.Train(&data, 100000);
std::cout << "Error after training for 100000 epochs: " << nn.GetError(&data) << std::endl;

Building panann

You can build panann on any platform with a compiler which supports c++17 language standards mode. The library is designed to be portable and easy to add to your project. We do not release binaries here, but panga compiles into a static library which can be added as a dependency. Add the panann cmake file to your build system and you should be ready to use panann.

Tested build configurations

Windows 10

  • CMake 3.17.0
  • Visual Studio 2019 16.11.23

Ubuntu 18.04

  • CMake 3.16.3
  • Clang 10.0.0

Testing panann

The library ships with a simple test program in the panann/test folder.

> git clone https://github.com/boingoing/panann/panann.git
> mkdir panann/build
> cd panann/build
> cmake ..
> make
> ./panann_test

Documentation

https://boingoing.github.io/panann/html/annotated.html

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.