Tuesday Tip #26: Get your ML project started quickly ๐Ÿ“ˆ


Hi Reader,

In case you havenโ€™t checked out the Data School blog in a while, Iโ€™ve published a few new posts:

These are expanded versions of past Tuesday Tips!


๐Ÿ”— Link of the week

โ€‹SQL Tutorial for Data Scientists & Data Analysts (free)

Although Python dominated the โ€œTop Programming Languages of 2023โ€, SQL took first place when ranked by job postings ๐Ÿฅ‡ (source).

If youโ€™re looking to learn SQL, the tutorial above includes 30+ lessons and 40+ practice problems you can try directly in the browser, some of which were sourced from real Data Science interviews!


๐Ÿ‘‰ Tip #26: Start with a logistic regression model

When faced with a new classification problem, Machine Learning practitioners have a dizzying array of algorithms from which to choose: Naive Bayes, decision trees, Random Forests, XGBoost, neural networks, and many others.

Where should you start? For many practitioners (including myself), the first algorithm to reach for is one of the oldest in the field: Logistic regression.

Here are a few attributes of logistic regression that make it incredibly popular:

  • Runs fast
  • Highly interpretable
  • Doesnโ€™t necessarily require input features to be scaled
  • Can generate a meaningful baseline without any tuning
  • Easy to regularize
  • Outputs well-calibrated predicted probabilities

In other words, it helps you to get going quickly with your Machine Learning project! You can focus your energy on building your initial ML pipeline (from data ingestion to prediction) without spending much computational time or code on model training and tuning.


Understanding logistic regression

Although you can use a ML algorithm without truly understanding it, learning how it works will ultimately help you to develop an intuition for when to use it and how to tune it.

To gain that deeper understanding, I recommend reading this lesson from my Data Science course:

๐Ÿ”— Logistic regression lesson (Jupyter notebook)

During this lesson, youโ€™ll learn:

  • Why is it called โ€œlogistic regressionโ€ if itโ€™s used for classification?
  • Why is it considered a linear model?
  • How do you interpret the model coefficients?
  • How does it generate class predictions?
  • What are its advantages and disadvantages?

If you get stuck on any of the concepts in the lesson, the resources listed in my logistic regression guide will help you to get un-stuck!


Tuning logistic regression

If youโ€™ve decided to use logistic regression, youโ€™ll need to tune it in order to maximize its performance. Iโ€™ve got a short video that will teach you how to tune logistic regression in scikit-learn:

๐Ÿ”— Important tuning parameters for LogisticRegression (video)

For more details, check out the scikit-learn documentation.


If you enjoyed this weekโ€™s tip, please forward it to a friend! Takes only a few seconds, and it really helps me grow the newsletter! ๐Ÿš€

See you next Tuesday!

- Kevin

P.S. I thought you said this was a linear systemโ€‹

Did someone awesome forward you this email? Sign up here to receive Data Science tips every week!

Learn Data Science from Data School ๐Ÿ“Š

Join 25,000+ aspiring Data Scientists and receive Python & Data Science tips every Tuesday!

Read more from Learn Data Science from Data School ๐Ÿ“Š

Hi Reader, Next week, Iโ€™ll be offering a Black Friday sale on ALL of my courses. Iโ€™ll send you the details this Thursday! ๐Ÿšจ ๐Ÿ‘‰ Tip #50: What is a "method" in Python? In Python, a method is a function that can be used on an object because of the object's type. For example, if you create a Python list, the "append" method can be used on that list. All lists have an "append" method simply because they are lists: If you create a Python string, the "upper" method can be used on that string simply...

Hi Reader, I appreciate everyone who has emailed to check on me and my family post-Helene! It has been more than 6 weeks since the hurricane, and most homes in Asheville (mine included) still don't have clean, running water. We're hopeful that water service will return within the next month. In the meantime, we're grateful for all of the aid agencies providing free bottled water, free meals, places to shower, and so much more. โค๏ธ Thanks for allowing me to share a bit of my personal life with...

Hi Reader, Regardless of whether you enrolled, thanks for sticking with me through the launch of my new course! ๐Ÿš€ I've already started exploring topics for the next course... ๐Ÿ˜„ ๐Ÿ”— Link of the week git cheat sheet (PDF) A well-organized and highly readable cheat sheet from Julia Evans, the brilliant mind behind Wizard Zines! ๐Ÿ‘‰ Tip #48: Three ways to set your environment variables in Python I was playing around with Mistral LLM this weekend (via LangChain in Python), and I needed to set an...