Before we move on to training the classifier, we can customize the MLP classifier via a number of optional settings:
- mlp.setActivationFunction: This defines the activation function to be used for every neuron in the network.
- mlp.setTrainMethod: This defines a suitable training method.
- mlp.setTermCriteria: This sets the termination criteria of the training phase.
Whereas our home-brewed perceptron classifier used a linear activation function, OpenCV provides two additional options:
- cv2.ml.ANN_MLP_IDENTITY: This is the linear activation function, f(x) = x.
- cv2.ml.ANN_MLP_SIGMOID_SYM: This is the symmetrical sigmoid function (also known as hyperbolic tangent), f(x) = β (1 - exp(-α x)) / (1 + exp(-α x)). Whereas ...