Writing a machine learning algorithm from scratch is an extremely rewarding learning experience. We highlight 6 steps in this process.