What exactly is this script training? I don't understand what the input and output arrays are supposed to represent. It looks almost like an XOR search but the last output target isn't correct for that.
print where(outputs > .5, 1, 0)
The example is for OR. In general, inputs is mxn matrix. m - training instances and n features. targets is training output matrix. In this case its 4x1 for 4. I see sometimes, it doesn't converge after those iterations perhaps because of initial weights. There are other techniques I have to use like momentum.