It is all explained here:
http://www.financial-hacker.com/build-better-strategies-part-5-developing-a-machine-learning-system/

However, I recommend to also read part 1-4 first.