Git Product home page Git Product logo

erlang-ann's Introduction

erlang-ann

Simple artificial neural network written in erlang.

Usage

Create

To create neural network you need to write:

NN = ann:create_neural_network(LIST_OF_NUMBERS_OF_NEURONS_IN_EACH_LAYER).

Training

Training set used for training needs to have a form of:

TS = [{ INPUT1, OUTPUT1 },
      { INPUT2, OUTPUT2 },
      ...
     ].
% both INPUTx and OUTPUTx should be lists

To train network we write following lines:

NN ! {learn_nb_epochs, NUMBER_OF_EPOCHS, LEARNING_RATE, TRAINING_SET}.
% or
NN ! {learn_until, MAX_ERROR, LEARNING_RATE, TRAINING_SET}.

Prediction

For a single input prediction use:

NN ! {predict, INPUT}.

For multiple predictions at once use:

ann:predict(NN, [INPUT1, INPUT2, ...]).

Example

% create network
NN = ann:create_neural_network([2, 3, 1]).

The above line of code will create neural network that looks like this: Example

% create training set
TS = [{ [0, 0], [0] },
      { [0, 1], [1] },
      { [1, 0], [1] },
      { [1, 1], [0] }].
% train network on that set
NN ! {learn_until, 0.00001, 0.1, TS}.
% predict output using network
NN ! {predict, [0, 0]}.
% or
ann:predict(NN, [[0, 0], [0, 1], [1, 0], [1, 1]]).

Example output for multiple predictions in above sample:

[[0.0011777173182934142],
 [0.9985160111565027],
 [0.9981415398654492],
 [0.0016010497083807085]]

erlang-ann's People

Contributors

grzego avatar

Watchers

 avatar  avatar  avatar

Forkers

nopmop angle600

erlang-ann's Issues

Negative results

Hello and thank you for sharing this interesting piece of code.
If I test with a large number of perceptrons & neurons I often get negative results for predictions.
What does it mean? Is that normal?

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.