Implement an averaged perceptron for binary classification with online mistake updates and mean weights across training steps.