In this recipe, we demonstrated usage of a multilayer perceptron classifier. We began by loading the classic Iris dataset in libsvm format. Next, we split the dataset with a ratio of 80% for training set data and 20% for test set data. In our definition phase, we configured the multilayer perceptron classifier with an input layer of four nodes, a hidden layer of five nodes, and a four-node layer for output. We generated a trained model by invoking the fit() method, and then produced predictions utilizing the trained model.
Finally, we retrieved predictions and labels, passing them to the multi-class classification evaluator that computes an accuracy value.
A simple visual inspection of predicted versus actual without much ...