Sha256: 39f202a09453c0f5063576ff696083457a02890054ed36c3bad22f3785592ca2

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

= Multi-Layer Perceptron Neural Network

I built this to not only learn about the MLP but to also make a very simple, well laid out MLP so other can easily see what's happening.

I also suggest checking out http://bit.ly/XEWOc for a great tutorial.

== Install

  gem install mlp

== How To Use
  require 'mlp'
  
  a = MLP::Network.new(hidden_layers: [2], output_nodes: 1, inputs: 2)

  3001.times do |i|
    a.train([0,0], [0])
    a.train([0,1], [1])
    a.train([1,0], [1])
    error = a.train([1,1], [0])
    puts "Error after iteration #{i}:\t#{error}" if i%200 == 0
  end

  puts "Test data"
  puts "[0,0] = > #{a.feed_forward([0,0]).inspect}"
  puts "[0,1] = > #{a.feed_forward([0,1]).inspect}"
  puts "[1,0] = > #{a.feed_forward([1,0]).inspect}"
  puts "[1,1] = > #{a.feed_forward([1,1]).inspect}"
  
== Benchmarks

  The above example produces these times
  
           user     system      total        real
  MLP    0.820000   0.000000   0.820000 (  0.837693)
  Ai4R   1.180000   0.010000   1.190000 (  1.232388)

== Thanks

* David Richards - For his code reviews and all round helpfulness. - http://github.com/davidrichards

== Copyright

Copyright (c) 2009 Red Davis, 2017 Igor Pavlov See LICENSE for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mlpnn-0.0.1 README.rdoc