The power of ensemble methods.

Have you ever participated in a Kaggle’s playground competition? I recently took part in one that aimed to predict the chance of a stroke based on various factors like age, gender, glucose levels, BMI, and more. The data provided for these competitions can be a bit messy, with added noise and outliers, so it’s important to start with some good old-fashioned data preparation and cleaning. First thing I look for is null-values....

January 16, 2023 · 3 min · 540 words · Me

Guard Clauses | Simplify Your Code

📷 Photo: Stable Diffusion As a programmer, you want your code to be efficient, readable, cool, and easy to maintain. One way to achieve this is by using guard clauses and early return statements. These techniques can help you simplify your code and make it easier to follow. In this post, I’ll explore what guard clauses and early return statements are, and how they can help you write better code....

December 19, 2022 · 2 min · 249 words · Me

List Comprehensions | Get Your Lists Together

📷 Photo: Stable Diffusion List comprehensions are a powerful and concise way to create lists in Python. They are a neat way to generate lists by applying operations to each element of a collection in a single line of code. With list comprehensions, you can create lists in a fraction of the time it would take with traditional loops, and your code will be much easier to read. Let’s say you want to create a list of the squares of the first 10 numbers....

December 15, 2022 · 3 min · 446 words · Me

Decorators | Decorate Functions and Classes

Python decorators are a powerful feature of the language that allows you to modify or extend the behavior of a function or a class without modifying its source code. A decorator is basically a function that takes another function or class as an argument and returns a new function or class that can be used instead of the original one. 📷 Photo: Stable Diffusion In this tutorial, I will cover the following topics:...

November 9, 2022 · 6 min · 1167 words · Me

RandDist | Bend the rules for randoms

Random generator with custom distribution function One day, I was tasked with creating a synthetic dataset of electricity consumption for a large number of houses over a long period of time to complement a real dataset. I realized that a normal distribution wouldn’t work, so I couldn’t use numpy.random.normal. We eventually didn’t use the synthetic dataset in our final work, but I had a neat class that was ready to be packaged as a pip package at the end of the day....

May 25, 2022 · 1 min · 205 words · Me