The DRY principle, which stands for Don’t Repeat Yourself, is a principle in software engineering that emphasizes avoiding code duplication. It basically states that every piece of knowledge within a system should have a single, unambiguous, authoritative representation. Imagine you’re writing a recipe for chocolate chip cookies. If you need to measure 1 cup of […]

### A Crash Course in SOLID Principles

The SOLID principles are a set of five design principles in object-oriented programming intended to make software designs more understandable, flexible, and maintainable. These principles were introduced by Robert C. Martin (also known as Uncle Bob) and are considered fundamental guidelines for creating high-quality, robust, and scalable software systems. SOLID stands for: S – Single-Responsiblity […]

### Beam search

Beam search is a heuristic search algorithm, a variant of breadth first search designed in such a way that it only explores a limited set of promising paths or solutions in a search space instead of all possible paths, which is often computationally expensive. It is used in the field of artificial intelligence, particularly in […]

### Ant Colony Optimization (ACO)

Ant Colony Optimization (ACO) is a metaheuristic optimization algorithm inspired by the foraging behavior of ants. Ants are social insects that communicate with each other using pheromones, which are chemicals that they leave on trails. When an ant finds a good source of food, it will lay down a trail of pheromones on the way […]

### Demystifying Determinant of a Matrix

I was first introduced to the idea of Matrices and determinants in my high school linear algebra class. Back then my only goal was to remember how to compute them using the given formulas. When I visited the determinants again after many years for one of my computer vision projects, It became clear I had […]

### Birthday Problem and Monte Carlo Simulation

If you get on a plane that can carry 100 or more passengers at a time, there is a 99% chance that one of the passengers shares the same birthday as yours. If you get into a bus with a capacity of 50 passengers, you have a 97% chance of finding someone who shares your […]

### Understanding Correlations and Correlation Matrix

Correlation is the measure of how two or more variables are related to one another, also referred to as linear dependence. An increase in demand for a product increases its price, also called the demand curve, traffic on roads at certain intervals of time of the day, the amount of rain correlates with grass fires, […]

### Computing the discrete Fréchet distance using dynamic programming

Definition The Fréchet distance is usually explained using the analogy of a man walking his dog. A man is walking a dog on a leash: the man can move on one curve, the dog on the other; both may vary their speed, but backtracking is not allowed. What is the length of the shortest leash […]

### Understanding Interquartile Range (IQR) and Outliers

When dealing with a large number of data, It’s a good practice to remove any outliers before further processing unless there is a good reason to keep them. Outliers in simple words are datapoint which are unusually far away from the rest of the dataset. For the lazy, here is the code to find outliers […]

### Stroke width identification algorithm for text like regions

In character recognition, the distance between two edges of a stroke, measured perpendicular to the stroke centerline is called the stroke width. Take a look at the below image. The length of lines marked in Red gives the stroke width of the character. There are quite a few ways to identify the stroke width, In […]