Jump to content

Population-based incremental learning

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Edaeda2 (talk | contribs) at 15:38, 13 June 2009 (Source code). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer science and machine learning, population-based incremental learning (PBIL) is one of the optimization algorithm, and one of the estimation of distribution algorithm. This is a type of genetic algorithm where the genotype of an entire population is evolved rather than individual members[1]. The algorithm is proposed by Shumeet Baluja in 1994[2][3].

Algorithm

In PBIL, genes are represented as real values in the range [0,1], indicating the probability that any particular allele appears in that gene.

The PBIL algorithm is as follows:

  1. A population is generated.
  2. The fitness of each member is evaluated and ranked.
  3. Update population genotype based on fittest individual.
  4. Repeat steps 2-3

Source code

This is a part of source code implemented in Java. In the paper, learnRate = 0.1, negLearnRate = 0.075, mutProb = 0.02, and mutShift = 0.05 is used. N = 100 and ITER_COUNT = 1000 is enough for a small problem.

public void optimize() {
    final int totalBits = getTotalBits(domains);
    final double[] probVec = new double[totalBits];
    Arrays.fill(probVec, 0.5);
    bestCost = POSITIVE_INFINITY;
 
    for (int i = 0; i < ITER_COUNT; i++) {
        // Creates N genotypes
        final boolean[][] genoTypes = new boolean[N][totalBits];
        for (boolean[] genoType : genoTypes) {
            for (int k = 0; k < genoType.length; k++) {
                if (rand.nextDouble() < probVec[k])
                    genoType[k] = true;
            }
        }

        // Calculate costs
        final double[] costs = new double[N];
        for (int j = 0; j < N; j++) {
            costs[j] = costFunc.cost(toRealVec(genoTypes[j], domains));
        }

        // Find min and max cost genotypes
        boolean[] minGenoType = null, maxGenoType = null;
        double minCost = POSITIVE_INFINITY, maxCost = NEGATIVE_INFINITY;
        for (int j = 0; j < N; j++) {
            double cost = costs[j];
            if (minCost > cost) {
                minCost = cost;
                minGenoType = genoTypes[j];
            }
            if (maxCost < cost) {
                maxCost = cost;
                maxGenoType = genoTypes[j];
            }
        }

        // Compare with the best cost genotypes
        if (bestCost > minCost) {
            bestCost = minCost;
            bestGenoType = minGenoType;
        }

        // Update the probability vector with max and min cost genotypes
        for (int j = 0; j < totalBits; j++) {
            if (minGenoType[j] == maxGenoType[j]) {
                probVec[j] = probVec[j] * (1d - learnRate) +
                        (minGenoType[j] ? 1d : 0d) * learnRate;
            } else {
                final double learnRate2 = learnRate + negLearnRate;
                probVec[j] = probVec[j] * (1d - learnRate2) +
                        (minGenoType[j] ? 1d : 0d) * learnRate2;
            }
        }

        // Mutation
        for (int j = 0; j < totalBits; j++) {
            if (rand.nextDouble() < mutProb) {
                probVec[j] = probVec[j] * (1d - mutShift) +
                        (rand.nextBoolean() ? 1d : 0d) * mutShift;
            }
        }
    }
}

See also

References

  1. ^ Karray, Fakhreddine O.; de Silva, Clarence (2004), Soft computing and intelligent systems design, Addison Wesley, ISBN 0-321-11617-8
  2. ^ Baluja, Shumeet (1994), "Population-Based Incremental Learning: A Method for Integrating Genetic Search Based Function Optimization and Competitive Learning", Technical Report, no. CMU-CS-94-163, Pittsburgh, PA: Carnegie Mellon University
  3. ^ Baluja, Shumeet; Caruana, Rich (1995), Removing the Genetics from the Standard Genetic Algorithm, Morgan Kaufmann Publishers, pp. 38–46