Learn about the basic ML metrics and find the situations about using a metric to evaluate your model’s performance.

Measuring — Photo by Diana Polekhina on Unsplash

Throughout the evolution, a number of metrics have been introduced to evaluate the performance of an ML algorithm or model. Sometimes it can be tricky to choose the correct metric for evaluating our model. In this article I have tried to discuss some basic matrics used in ML-related tasks and when to use which metric.

Before jumping into the metrics directly, let’s explore a core concept — Confusion Matrix. It is not a metric, but it is important to know the concept as it some metric directly use concepts from this.

Confusion Matrix

The confusion matrix is a performance measurement for a…


It is named bubble sort for the way that the smaller or larger elements bubble up to the top. Sometimes it is also known as sinking sort for the opposite reason. It is a comparison sort that repeatedly iterates through the list, compares the adjacent elements and swaps them if they are in the wrong order. This is repeated until the list is sorted.

How does bubble sort work?

Before diving into the working mechanism of bubble sort let’s assume we have an unordered list as [50, 12, 65, -5, 10, -8]. …


A binary heap is a complete binary tree which has the heap property. The binary heap was introduced by J. W. J. Williams in 1964 as a data structure for heap sort.

Complete Binary Tree

It is a kind of binary tree where all the levels, except possibly the last one are fully filled, and if the last level is not fully filled, it is filled from left to right.

A complete binary tree

Array Representation of Binary Heap

The complete binary tree or the binary heap has an interesting property. Let’s give an index to each node of the above binary tree. The indexes will be given as level wise.


A heap is a special tree-based data structure where the tree is a complete tree or an almost complete tree which satisfy the heap property. Now, what is heap property? The heap property states that in a heap all the keys of children nodes must be greater than or equal or less than or equal of the key of the parent node. Based on the heap property there are two kinds of heaps:

Max heap

In the max heap, the key of a node is greater than or equal of all the child nodes and the key of the root is the…


Checking for balanced parentheses or balanced brackets is a very old and classic problem in the field of computer science.

As we all know there are three kinds of parentheses or brackets. They are the round brackets, the curly brackets and the square brackets. Each of the brackets has an opening part and a closing part.

Now the question arises — what are balanced parentheses? Some parentheses are called balanced if each opening bracket has a corresponding closing bracket or each closing bracket has a corresponding opening bracket and the brackets are properly nested. …

Shahad Mahmud

I’m a computer science and engineering graduate. I’m passionate about learning and spread what I learn. Besides I like cooking and photography!

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