All pastes #1180473 Raw Edit

Unnamed

public ruby v1 · immutable
#1180473 ·published 2008-08-21 08:00 UTC
rendered paste body
require 'backpropagation'examples = [    [[0, 0], [0]],    [[0, 1], [1]],    [[1, 0], [1]],    [[1, 1], [0]]]net = NeuralNetwork::Backpropagation.new([2, 4, 1])50.times {    examples.each do |ex|        net.train(ex[0], ex[1])    end}examples.each do |ex|    print ex[0], ' => ', net.eval(ex[0]), ', should be ', ex[1], "\n"end