Sha256: 4b8ade7aa00b47acac7a8a4d9807ec932cdbcae615d21a250ccb53a32d04844b

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# 
# neural_network_test.rb
# 
# This is a unit test file for the backpropagation neural network implemented
# in ai4r 
# 
# Author::    Sergio Fierens
# License::   MPL 1.1
# Project::   ai4r
# Url::       http://ai4r.rubyforge.org/
#
# You can redistribute it and/or modify it under the terms of 
# the Mozilla Public License version 1.1  as published by the 
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
# 
 

require File.dirname(__FILE__) + '/../../lib/ai4r/neural_network/backpropagation'
require 'test/unit'

Ai4r::NeuralNetwork::Backpropagation.send(:public, *Ai4r::NeuralNetwork::Backpropagation.protected_instance_methods)  
Ai4r::NeuralNetwork::Backpropagation.send(:public, *Ai4r::NeuralNetwork::Backpropagation.private_instance_methods)

module Ai4r
  
  module NeuralNetwork


    class BackpropagationTest < Test::Unit::TestCase

      def test_eval
        #Test set 1
        net = Backpropagation.new([3, 2])
        y = net.eval([3, 2, 3])
        assert y.length == 2
        #Test set 2
        net = Backpropagation.new([2, 4, 8, 10, 7])
        y = net.eval([2, 3])
        assert y.length == 7
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ai4r-1.2 test/neural_network/backpropagation_test.rb
ai4r-1.3 test/neural_network/backpropagation_test.rb