Project

brainy

0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Brainy is an Artificial Neural Network (ANN) using the Backpropagation algorithm.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 10.4.2
~> 3.2.0
 Project Readme

Brainy - An Artificial Neural Network Build Status

Brainy is an Artificial Neural Network (ANN) using the Backpropagation algorithm. It was originally created as part of the Neural NFL project here, but was broken out into a gem to be more reusable.

NOTE: As of v2.0 Brainy is JRuby only. This decision was made for performance reasons, as it can now leverage the fast linear algebra functionality found in the JBLAS Java library.

Installation

Brainy is hosted on RubyGems.org making installation easy.

$ gem install brainy

Usage

From examples/sin.rb:

# Example using sin wave function
require 'brainy'
net = Brainy::Network.new(1, 3, 1, learning_rate: 1.0)

# training
4000.times do
  i = rand(0..(Math::PI/2))
  o = Math.sin(i)
  net.train!([i], [o])
end

# testing
mse = 1000.times.map do
  i = rand(0..(Math::PI/2))
  o = Math.sin(i)
  (o - net.evaluate([i]).first) ** 2
end.reduce(:+) / 1000

puts "your MSE: #{ mse.round(6) }" # smaller is better