An overview of clustering algorithms, their use cases, and their advantages and disadvantages

Various clustering algorithms.

“if you want to go quickly, go alone; if you want to go far, go together.” — African Proverb.

Quick note: If you are reading this article through a chromium-based browser (e.g., Google Chrome, Chromium, Brave), the following TOC would work fine. However, it is not the case for other browsers like Firefox, in which you need to click each link twice to get to the intended section. Enjoy!

As always, everything written and visualized were created by the author unless it was specified.

Table of Contents(TOC)
Machine learning
Cluster analysis

The following article explains various methods for computing distances and showing their instances in our daily lives. Additionally, it will introduce you to the pydist2 package.

Various ML metrics. Inspired by Maarten Grootendorst.

“There is no Royal Road to Geometry.” — Euclid

Quick note: Everything written and visualized has been created by the author unless it was specified. Illustrations and equations were generated using tools like Matplotlib, Tex, Scipy, Numpy and edited using GIMP.

🄰 . Introduction:

Similarity and dissimilarity:

In data science, the similarity measure is a way of measuring how data samples are related or closed to each other. On the other hand, the dissimilarity measure is to tell how much the data objects are distinct. Moreover, these terms are often used in clustering when similar data samples are grouped into one cluster…

⏳ In the following material, we are going to illustrate the mechanism of network sockets (TCP in particular) and build on top of that a face recognition app with a multithreaded server.

Photo by Neven Krcmarek on Unsplash

👉 Socket Communication

Sockets are a way of communication between processes. The main difference between it and other processes is that it can achieve inter-process communication between two or multiple different hosts, machines, nodes…(Different IP addresses). Sockets are always persisted in our network in order to complete the communication, For example, we surf the web every day, streaming, send and receive emails, etc.

The most important thing about process communication is that each process must be uniquely identified. For instance, in the TCP/IP network protocol, the process is identified by the (IP address, protocol(TCP or UDP), port number) triplet.

👉 TCP Protocol

TCP is a connection-oriented…

⛳️ The goal of this post is to build a face recognition app as well as introduce you to a very interesting and useful OpenCV library. I am pretty sure that this material will be useful for beginners.

Video by cottonbro from Pexels


In this article, we are gonna play around with some builtin methods used in computer vision and machine learning. To detect individuals, the Haar-like feature algorithm was chosen, and for face recognition, a method based on building histograms of local binary patterns already described in my previous work.


1-Digital Images

In this article, you will learn how haar cascade classifiers really work through python visualization functions.

👉 Viola-Jones Algorithm

Normally, every algorithm has a set of instructions, something without which this algorithm couldn’t exist on a basic level, and its remainder is as of now based on its instructions. In the Viola-Jones algorithm, these instructions are made up of Haar signs, which are a set of rectangular kernels:

This post goes in-depth analysis and application of LBP (Local Binary Patterns) for image feature extraction.


👉 Introduction

The main idea behind LBP is to describe the neighborhood of image elements using binary codes. This method is usually used to study their local properties and identify the characteristics of individual parts of the image.

This algorithm is a combination of statistical and structural methods. It was first proposed by T. Ojala, M. Pietikanen, T. Mehpaa from Oulu University in Finland in 1994. It is considered a theoretically time-effective and straightforward method, showing excellent results in many studies.

👉 How it works❓

As the name suggests, Local Binary Pattern (LBP for short) is a feature of the local representation of an image. …

The goal of this post is to understand how camera devices work and take advantage of that to compute the distance of a given face in an image using the face detection algorithm described in my previous post.

Pinhole camera

“Light was God’s first creation and one of nature’s most important gifts to mankind…“


First, you may ask the question: “What is light?” As a beginning, you should give an operational definition of light: Light is the substance that the normal human eye senses.

Perhaps this is not a profound definition, but it starts us on an exploration of light by giving us a test for the presence of light. When we see an object, it is because the light comes to the eye. If an object emits light, then we say that it is a source of light. Objects…

This post explains how can we take advantage of the skin segmentation algorithm, described in my first article, and how can we use it in face detection.


What Is Face Detection?

Face Detection is the act of finding and extracting a face from any given image, video, webcam… based on some specific features (skin color, nose, eyes, mouth…). This method is used in a program for recognizing a face(see if is it familiar or not familiar face) and performed by using the color segmentation of the image. To do so, python provides us a useful function: cv2.findContours.

findContours function.

Using the OpenCV library, you can extract the contour of an image. The function, which accomplishes this purpose, is, as the title suggests, find contours, which has the following syntax:

contours, hierarchy=cv2.findContours(image, mode, method[,contours[…

⚠️Disclaimer: This post is for educational purposes only, and it is NOT a valid source of information for COVID-19, which is a potential threat, and you should consult the legit sources for accurate information, such as WHO…

SEIRD model(source)


Coronavirus infection COVID-19(abbreviation for COrona VIrus Disease 2019), previously coronavirus infection 2019-nCoV, is a potentially severe acute respiratory infection caused by the SARS-CoV-2 virus.

It is a dangerous disease that can occur both: in the form of an acute respiratory viral infection of a mild course and severe form specific complications, which can include viral pneumonia and entails acute respiratory distress syndrome or respiratory failure with the risk of death.

At the time of writing this article, the death rate has reached 6.2%(simply divide the total number of deaths globally by the total number of confirmed cases, this is not…

The goal of this article is to explain an algorithm for human skin recognition.

Skin Segmentation

1 — Abstract

Human skin color detection, for the most part, is used for human face detection. It is one of the best approaches for finding and extracting a person’s face in a given picture. Often it is understood that, for individuals of different races, the fragments skin tones change for some degree. To feature the color of human skin, use different color spaces are accessible.

The three primary spaces for recognizing a skin are RGB (Red, Green, Blue), YCbCr (Luminance, Chrominance) and HSV (Hue, Saturation, Value) color models.

A color model is a term that denotes an abstract model for describing the…

Mahmoud Harmouch

Computer programmer/engineer, writing lover, interested in Programming, Data Science, Computer Vision…

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