Added new training method

With a for for the rows and a while in the rows