Add averaged perceptron learning

Hope I'm doing this right in order to handle Ctrl+C!  Since you noticed that inference is the bottleneck, I hope this is fine.