Sha256: 45258102dfdf0552aa69321ddd8f7127deca4f8c4f4b5c5690e9667078330544

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe "Integration" do
  
  it "should learn OR in 4 runs" do
    LEARNRATE = 1

    @perceptron = Perceptron.new( :activation_function => :binary,
                                  :synapses => 2,
                                  :bias => 0)

    # first run
    def run times=1
      times.times do
        @perceptron.train [0, 0], 0
        @perceptron.train [0, 1], 1
        @perceptron.train [1, 0], 1
        @perceptron.train [1, 1], 1
      end
    end

    run 4
    @perceptron.recall( [0, 0]).should eql(0)
    @perceptron.recall( [0, 1]).should eql(1)
    @perceptron.recall( [1, 0]).should eql(1)
    @perceptron.recall( [1, 1]).should eql(1)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Santino-neurotic-0.0.0 spec/neurotic/neurotic_spec.rb
Santino-neurotic-0.0.1 spec/neurotic/neurotic_spec.rb