From: Chris Bond Date: 2007-10-05T02:58:07+09:00 Subject: Re: adding array of numbers Robert Klemme wrote: > 2007/10/3, Chris Bond : >> 1 1 0 0 1 0 0 1 >> to be added together to get output for Perceptron_Bond object named >> >> answers = Array.new >> end >> >> stumped >> I need help in a bad way, please. >> >> Attachments: >> http://www.ruby-forum.com/attachment/524/somefile.rb > > I am not sure whether I understood properly which of the vectors you > want to multiply with which ones. Is this what you want? > > Kind regards > > robert The problem was to make a perceptron learning algorithm. you take the 1 1 0 0 1 0 0 string then initially multiply it by the weight vector of all 0s. The output is the dot product of the two vectors. Then you compare that output to the answers that are on the right. If the perceptron did not fire(0), when it should have, you add the dot product to the old weight vector, and the converse(1 when it should be 0) you subtract here is the speudocode w= random vector repeat Get input x Get neuron output y = (1 if w ⋅ x ≥ 0; otherwise 0) Find correct output y# Compute error e= y# − y If e ≠ 0 w= w + ex until w stops changing hope that helps -- Posted via http://www.ruby-forum.com/.