training MLP in detail