In our problem of finding optimal weights to rectangles, the
genome is an array, representing the weights to be assigned to the
rectangles. A valid genome for a Haar-like feature with k rectangles
would be an array of length k, whose elements can take real values.
For a given genome and a Haar-like feature, our fitness function
builds a weak classifier and returns the error made by the weak
classifier on training examples. The lower the error returned by the
fitness function, the better the genome represents the desired solution.
The genetic optimization, as explained in Algorithm 2, is done
over a series of N generations. In each generation, the population
of genomes are improved through the application of crossover and
mutation operators. The genome, along with the threshold and polarity
values, that produce the least training error are chosen as the
parameters to be assigned to the weak classifier h