train_model function

makes a model object using the specified algorithm.