Training and testing the MLP classifier