A perceptron training apparatus and test example in Scala