# Programming

## Roulette Wheel Selection in Python 🐍

Posted on March 22, 2021

The roulette wheel selection (also known as fitness proportionate selection) is a function used by genetic algorithms for selecting potentially useful solutions for recombination. The crossover individual probability is computed based on the individual’s fitness divided by the sum of all population fitness. The following is the formula for it: where pi is the probability of each chromosome equals the chromosome frequency divided by the sum of all fitness. Let’s imagine that the roulette wheel selection algorithm is like aRead More

## Genetic Algorithm Python Example

Posted on January 31, 2021

Genetic Algorithms (GA) are a subclass of evolutionary algorithms that emulate natural evolution. Darwin’s theory on natural selection states that the fittest individuals are the ones which reproduce. Following this theory, genetic algorithms are composed of three main phases: selection, reproduction, and mutation that attempt to copy the working mechanisms of nature. Genetic algorithms are principally used to find the global optimal solution heuristically. Genetic Algorithm Applications Genetic algorithms have been applied to many different problems in a wide spectrumRead More

## Convert a mask into a Polygon for images using shapely and rasterio

Posted on August 7, 2020

Sometimes it is necessary to transform masks into polygons to use polygon operations. The way to transform a raster or a binary mask into a polygon is pretty easy. Most of the solutions I found online were the other way (from polygon to a mask). But for my project I needed to convert the mask to a polygon.