How to select the best model from multiple machine learning algorithms


There are many ways to figure out which machine learning algorithm is the best for your dataset. One, you can just pick one and tweak the hyperparameters until you can’t tweak them anymore. And maybe you get lucky and choose wisely, or maybe you could have chosen something better. A better way is to let the machine determine what is best for the machine. You can select the best model for machine learning by testing classifiers against each other. It’s sort of a machine learning battle of the best.

Once you have found the right algorithm you can then fine tune and sort through the best hyperparameters.

For this example, I’m going to test logistic regression against random forests. We will use the sklearn breast cancer dataset and test to see which classifier is the best. Hint: logistic regression.

See the code in Google Colaboratory.

Feel free to test your own classifiers to see which algorithm works best. Here is a list of sklearn algorithms you can try out.