How to Create and Train a Machine Learning Model from Scratch