Hi Reader,
Last week, I had an hour-long chat with my friend Ken Jee for his podcast. Starting tomorrow, you can watch the conversation on the Ken’s Nearest Neighbors YouTube channel!
When working on a Machine Learning problem, it’s always a good idea to try different types of models to see which one performs best.
However, you can also use a process called “ensembling” to combine multiple models. The goal is to produce a combined model, known as an ensemble, that performs better than any of the individual models.
The process for ensembling is simple:
The idea behind ensembling is that if you have a collection of individually imperfect models, the “one-off” errors made by each model are probably not going to be made by the rest of the models. Thus, the errors will be discarded (or at least reduced) when ensembling the models.
Here’s a simple example in which I ensembled Logistic Regression and Random Forests using scikit-learn’s VotingClassifier:
Notice that the accuracy of the ensemble (0.725) is significantly better than the accuracy of either individual model. (Check out the full code here.)
➡️ Ensembling is useful any time model accuracy (or another evaluation metric) is your highest priority. Keep in mind that the ensemble will be less interpretable than the individual models.
➡️ It’s ideal to include at least 3 models in the ensemble.
➡️ It’s important that all models you include are performing reasonably well on their own.
➡️ It’s best if the included models generate their predictions using different processes, since they will be likely to make different types of errors. (This is what makes Logistic Regression and Random Forests good candidates for ensembling!)
If you enjoyed this week’s tip, please forward it to a friend! Takes only a few seconds, and it really helps me out! 🙌
See you next Tuesday!
- Kevin
P.S. Gym rats vs data scientists
Did someone awesome forward you this email? Sign up here to receive data science tips every week!
Join 25,000+ intelligent readers and receive AI tips every Tuesday!
Hi Reader, Last week, I invited you to help me test Google's Data Science Agent in Colab, which promises to automate your data analysis. Does it live up to that promise? Let's find out! 👇 Sponsored by: Morning Brew Business news you’ll actually enjoy Join 4M+ professionals who start their day with Morning Brew—a free daily newsletter that makes business, tech, and finance news genuinely enjoyable to read and hard to forget. Each morning, it breaks down complex stories in plain English—cutting...
Hi Reader, Today I'm trying something brand new! I wrote short summaries of the 5 most important AI stories this week, and also turned it into a video: Watch the video I'd love to know what you think! 💬 AI-generated TV ad airs during NBA finals Prediction market Kalshi just aired this AI-generated ad on network TV during the NBA finals. It was created in just two days by one person using Google's new Veo 3 video model, plus scripting help from Google's Gemini chatbot. Expect to see many more...
Hi Reader, Thanks for sticking with me through last week’s course launch! 🙏 As you may have noticed, Tuesday Tips has been on pause for a few months. I was focused on launching the course, plus I’ve been working on a book 🤫 I can’t promise a new tip every Tuesday, but I’ll do my best to provide you with valuable content as time permits. As for today’s tip, I’m trying out something new… 👇 Sponsored by: Superhuman AI Find out why 1M+ professionals read Superhuman AI daily. AI won't take over...