Sign in

Reporting live from planet earth on all things related to data science and the human condition.


Demystifying classes, objects, inheritance, and more


What is OOP?

Object-oriented programming is a method of organizing a program by grouping related properties and behaviors into individual objects. The basic building blocks of OOP are objects and classes.

A class is a code template for creating objects, we can think of it as a blueprint. It describes the possible states and behaviors that every object of a certain type could have. For instance, if we say that “every employee will have a name and salary, and can be given a raise ”, then we just defined a class!

An object is a data structure storing information about the state and…


Become a master of dates and times in no time



Throughout your career as a data scientist, it’s inevitable that you’ll come across data containing date and time. For this reason, this extensive guide is here to help make manipulating date and time data using Python’s datetime module a breeze. We’ll cover a range of topics such as handling date and time strings, measuring time span, and working with datetime objects in pandas.

Python’s DateTime Classes

To introduce you to the datetime module, there are five main object classes that come in handy for different purposes. They are as follows:

  • datetime — allows us to manipulate dates and times together (month, day, year…


Breaking the vicious cycle is no longer a far-fetched dream



Maladaptive daydreaming has been a significant part of my life for as long as I can remember. Looking back at the time I’ve spent daydreaming, it’s safe to say that I’ve daydreamed of enough plots and scenarios to make up a few good novels.

During my early teenage years, I was well aware that pacing around a room dreaming of a more exciting life with headphones on for hours on end every day was somewhat abnormal.

However, I couldn’t help it. When I was daydreaming, everything was alright. I felt a sense of euphoria that I couldn’t let go of…


Why we should remind ourselves of the fleeting nature of our existence time and time again


As a species, we are well aware of the fact that the world around us is constantly changing. You could go up to anybody and ask them if things change and chances are they would say yes. And although we seem to know this on an intellectual level, we often fail to extend this knowledge to the level of our immediate experience of things.

In other words, most of the time we fail to recognize and embrace change as it’s happening.

And why is this important you might ask?

Well, impermanence implies that anything can happen at any time, and…


A beginner-friendly guide to scraping web data



Web data is one of the most readily accessible sources of data out there. For this reason, being able to extract and utilize the plethora of data that exists on the web is a necessary skill for every data scientist. And if this skill is not in your skillset just yet, needless to worry because this tutorial has got you covered. By the end of this tutorial, you’ll have learned the fundamentals of web scraping using Scrapy and will have a fully functional Python web scraper that extracts Covid-19 data from

The Web Scraping Process


Find bottlenecks in your functions using line profiler



As a data scientist, the majority of your time should be spent on tasks such as data wrangling and/or training your machine learning models. However, you can find that this quickly ceases to be the case when your code takes seemingly forever to execute. For this reason, code profiling comes to the rescue when you need to assess bottlenecks in your application and save your precious time. The protagonist of our article for today will be the line_profiler package and we’ll be using it to profile a function’s runtime line-by-line so that we can bring you a step closer to…


Build an identity authentication system that yields a face match percentage for two images


The rate at which biometrics are used today for identity authentication is unprecedented in human history. With the demand for such systems skyrocketing, it is no surprise that the supply of resources needed to build such systems is in no shortage either. With plenty of learning resources and great Computer Vision (CV) libraries at your disposal, building a state-of-the-art face verification system has become accessible only a few clicks away. In this article, you’ll learn how to verify the identity of an individual by comparing two images against each other, looking for a face match between both. How can this…



In this article, we’ll be leveraging the power of deep learning to solve a key issue that credit card companies often have to address, namely detecting fraudulent transactions. For this task, a Deep Neural Network (DNN) will be trained in order to do exactly that. We’ll walk through the following steps:

  1. Data Overview
  2. Data Preprocessing
  3. DNN model building
  4. DNN model evaluation
  5. Conclusion

Without further ado, let’s get started!

1. Data Overview

We got the dataset we’re using today from Kaggle and it contains two days’ worth of transactions by European cardholders. It’s important to note that due to the confidential nature of the…


Predicting loan defaults and their probability


1. Introduction

Credit default risk is simply known as the possibility of a loss for a lender due to a borrower’s failure to repay a loan. Credit analysts are typically responsible for assessing this risk by thoroughly analyzing a borrower’s capability to repay a loan — but long gone are the days of credit analysts, it’s the machine learning age! Machine learning algorithms have a lot to offer to the world of credit risk assessment due to their unparalleled predictive power and speed. In this article, we will be utilizing machine learning’s power to predict whether a borrower will default on a…

Sarah Beshr

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store