45
1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia [email protected] ACAI 05 ADVANCED COURSE ON KNOWLEDGE DISCOVERY

1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia [email protected] ACAI 05 ADVANCED COURSE

Embed Size (px)

Citation preview

Page 1: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

1

Stochastic Search MethodsBogdan Filipič

Jožef Stefan InstituteJamova 39, SI-1000 Ljubljana, Slovenia

[email protected]

ACAI 05 ADVANCED COURSE ON KNOWLEDGE

DISCOVERY

Page 2: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

2

Overview

• Introduction to stochastic search

• Simulated annealing

• Evolutionary algorithms

Page 3: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

3

Motivation

• Knowledge discovery involves exploration of high-dimensional and multi-modal search spaces

• Finding the global optimum of an objective function with many degrees of freedom and numerous local optima is computationally demanding

• Knowledge discovery systems therefore fundamentally rely on effective and efficient search techniques

Page 4: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

4

Search techniques

• Calculus-based, e.g. gradient methods

• Enumerative, e.g. exhaustive search, dynamic programming

• Stochastic, e.g. Monte Carlo search, tabu search, evolutionary algorithms

Page 5: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

5

Properties of search techniques • Degree of specialization

• Representation of solutions

• Search operators used to move from one configuration of solutions to the next

• Exploration and exploitation of the search space

• Incorporation of problem-specific knowledge

Page 6: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

6

Stochastic search

• Desired properties of search methods:– high probability of finding near-optimal

solutions (effectiveness)– short processing time (efficiency)

• They are usually conflicting; a compromise

is offered by stochastic techniques where certain steps are based on random choice

• Many stochastic search techniques are inspired by processes found in nature

Page 7: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

7

Inspiration by natural phenomena• Physical and biological processes in nature

solve complex search and optimization problems

• Examples:– arranging molecules as regular, crystal

structures at appropriate temperature reduction

– creating adaptive, learning organisms through biological evolution

Page 8: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

8

Nature-inspired methods covered in this presentation• Simulated annealing

• Evolutionary algorithms:– evolution strategies– genetic algorithms– genetic programming

Page 9: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

9

Simulated annealing: physical background• Annealing: the process of cooling a molten

substance; major effect: condensing of matter into a crystalline solid

• Example: hardening of steel by first raising the temperature to the transition to liquid phase and then cooling the steel carefully to allow the molecules to arrange in an ordered lattice pattern

Page 10: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

10

Simulated annealing: physical background (2)• Annealing can be viewed as an adaptation

process optimizing the stability of the final crystalline solid

• The speed of temperature decreasing determines whether or not a state of minimum free energy is reached

Page 11: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

11

E(s) … free energy … normalization

S … set of all possible system states

k … Boltzmann constant

• Probability for the particle system to be in state s at certain temperature T

Boltzmann distribution

1 ( )( ) expT

E sp s

n k T

( )exp

s S

E sn

k T

Page 12: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

12

Metropolis algorithm

• Stochastic algorithm proposed by Metropolis et al. to simulate the structural evolution of a molten substance for a given temperature

• Assumptions: – current system state s– temperature T– number of equilibration steps m

Page 13: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

13

Metropolis algorithm (2)

• Key step: generate new system state snew, evaluate energy difference ΔE = E(snew) – E(s), and accept the new state with probability depending on ΔE

• Probability of accepting the new state:

accept

1; 0

exp ; otherwise

E

p E

T

Page 14: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

14

Metropolis algorithm (3)

Metropolis(s, T, m); i := 0; while i < m do snew := Perturb(s); ΔE := E(snew) – E(s); if (ΔE < 0) or (Random(0,1) < exp(–ΔE/T)) then s := snew; i := i + 1; end_while; Return s;

Page 15: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

15

Algorithm Simulated annealing• Starting from a configuration s, simulate an

equilibration process for a fixed temperature T over m time steps using Metropolis(s, T, m)

• Repeat the simulation procedure for decreasing temperatures Tinit= T0 > T1 > … > Tfinal

• Result: a sequence of annealing configurations with gradually decreasing free energiesE(s0) ≥ … ≥ E(s1) ≥ … ≥ E(sfinal)

Page 16: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

16

Algorithm Simulated annealing (2)Simulated_annealing(Tinit, Tfinal, sinit, m, α); T := Tinit; s := sinit; while T > Tfinal do s := Metropolis(s, T, m); T := α·T; end_while; Return s;

Page 17: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

17

Simulated annealing as an optimization process• Solutions to the optimization problem

correspond to system states

• System energy corresponds to the objective function

• Searching for a good solution is like finding a system configuration with minimum free energy

• Temperature and equilibration time steps are parameters for controlling the optimization process

Page 18: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

18

Annealing schedule

• A major factor for the optimization process to avoid premature convergence

• Describes how temperature will be decreased and how many iterations will be used during each equilibration phase

• Simple cooling plan: T = α·T, with 0 < α < 1, and fixed number of equilibration steps m

Page 19: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

19

Algorithm characteristics

• At high temperatures almost any new solution is accepted, thus premature convergence towards a specific region can be avoided

• Careful cooling with α = 0.8 … 0.99 will lead to asymptotic drift towards Tfinal

• On its search for optimal solution, the algorithm is capable of escaping from local optima

Page 20: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

20

Applications and extensions

• Initial success in combinatorial optimization, e.g. wire routing and component placement in VLSI design, TSP

• Afterwards adopted as a general-purpose optimization technique and applied in a wide variety of domains

• Variants of the basic algorithm: threshold accepting, parallel simulated annealing, etc., and hybrids, e.g. thermodynamical genetic algorithm

Page 21: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

21

Evolutionary algorithms (EAs)• Simplified models of biological evolution,

implementing the principles of Darwinian theory of natural selection (“survival of the fittest”) and genetics

• Stochastic search and optimization algorithms, successful in practice

• Key idea: computer simulated evolution as a problem-solving technique

Page 22: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

22

Analogy used

Biological evolution Computer problem solving

Individual Solution to a problem

Chromosome Encoding of a solution

Population Set of solutions

Crossover, mutation Search operators

Natural selection Reuse of good solutions

Fitness Quality of a solution

Environment Problem to be solved

Page 23: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

23

Evolutionary algorithms and soft computing

N e u ra lN e tw o rks

E vo lu tio n a ryP ro g ram m ing

E vo lu tionS tra te g ies

G e ne ticA lg o rith m s

G e ne ticP ro g ram m ing

E vo lu tio n a ryA lg o rith m s

F u zzyS ys te m s

C O M P U T A T IO N A LIN T E L L IG E N CE

o rS O F T C O M P U T IN G

Source: EvoNet Flying Circus

Page 24: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

24

Evolutionary cycle

Genetic variation(mutation, recombination)Population

Offspring

ParentsSelection

Replacement

Source: EvoNet Flying Circus

Page 25: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

25

Generic Evolutionary algorithmEvolutionary_algorithm(tmax); t := 0; Create initial population of individuals; Evaluate individuals; result := best_individual; while t < tmax do t := t + 1; Select better solutions to form new population; Create their offspring by means of genetic variation; Evaluate new individuals; if better solution found then result := best_individual; end_while; Return result;

Page 26: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

26

Differences among variants of EAs• Original field of application

• Data structures used to represent solutions

• Realization of selection and variation operators

• Termination criterion

Page 27: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

27

Evolution strategies (ES)

• Developed in 1960s and 70s by Ingo Rechenberg and Hans-Paul Schwefel at the Technical University of Berlin

• Originally used as a technique for solving complex optimization problems in engineering design

• Preferred data structures: vectors of real numbers

• Specialty: self-adaptation

Page 28: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

28

Evolutionary experimentation

Pipe-bending experiments (Rechenberg, 1965)

Page 29: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

29

Algorithm details

• Encoding object and strategy parameters:g = (p, s) = (p1, p2, …, pn), (s1, s2, …, sn)) where pi represent problem variables and si

mutation variances to be applied to pi

• Mutation is the major operator for chromosome variation:gmut = (pmut, smut) = (p + N0(s), α(s))pmut = (p1 + N0(s1), …, pn + N0(sn))smut = (α(s1), …, α(sn))

Page 30: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

30

Algorithm details (2)

• 1/5th success rule: Increase mutation strength, if more than 1/5 of offspring are successful, otherwise decrease

• Recombination operators range from swapping respective components between two vectors to component-wise calculation of means

Page 31: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

31

Algorithm details (3)

• Selection schemes– (μ + λ)-ES: μ parents produce λ offspring,

μ best out of μ + λ individuals survive– (μ, λ)-ES: μ parents produce λ offspring, μ

best offspring survive

• Originally: (1+1)-ES

• Advanced techniques: meta-evolution strategies, covariance matrix adaptation ES (CMA-ES)

Page 32: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

32

Genetic algorithms (GAs)

• Developed in 1970s by John Holland at the University of Michigan and popularized as a universal optimization algorithm

• Most remarkable difference between GAs and ES: GAs use string-based, usually binary parameter encoding, resembling discrete nucleotide coding on cellular chromosomes

• Mutation: flipping bits with certain probability

• Recombination performed by crossover

Page 33: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

33

• Models the breaking of two chromosomes and subsequent crosswise restituation observed on natural genomes during sexual reproduction

• Exchanges information among individuals

• Example: simple (single-point) crossover

Parents Offspring1 0 0 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 1 0 1 1

Crossover operator

Page 34: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

34

Selection

• Models the principle of “survival of the fittest”

• Traditional approach: fitness proportionate selection performing probabilistic multiplication of individuals with respect to their fitness values

• Implementation: roulette wheel

Page 35: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

35

Selection (2)

• In the population of n individuals, with the sum of their fitness values Σf and average fitness favg, the expected number of copies of i-th individual with fitness fi equals to

• Alternative selection schemes: rank-based selection, elitist selection, tournament selection, etc.

avg

i in f f

f f

Page 36: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

36

Algorithm extensions

• Encoding of solutions: real vectors, permutations, arrays, …

• Crossover variants: multiple-point crossover, uniform crossover, arithmetic crossover, tailored crossover operators for permutation problems, etc.

• Advanced approaches: meta-GA, parallel GAs, GAs with subjective evaluation of solutions, multi-objective GAs

Page 37: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

37

Genetic programming (GP)

• An extension of genetic algorithms aimed at evolving computer programs using the simulated evolution

• Proposed by John Koza from MIT in 1990s

• Computer programs represented by tree-like symbolic expressions, consisting of functions and terminals

• Crossover: exchange of subtrees between two parent trees

Page 38: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

38

Genetic programming (2)

• Mutation: replacement of a randomly selected subtree with a new, randomly created tree

• Fitness evaluation: program performance in solving the given problem

• GP is a major step towards automatic computer programming, nowadays capable of producing human-competitive solutions in variety of application domains

Page 39: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

39

Genetic programming (3)

• Applications: symbolic regression, process and robotics control, electronic circuit design, signal processing, game playing, evolution of art images and music, etc.

• Main drawback: computational complexity

Page 40: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

40

Advantages of EAs

• Robust and universally applicable

• Besides the solution evaluation, no additional information on solutions and search space properties is required

• As population methods they produce alternative solutions

• Enable incorporation of other techniques (hybridization) and can be parallelized

Page 41: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

41

Disadvantages of EAs

• Suboptimal methodology

• Require tuning of several algorithm parameters

• Computationally expensive

Page 42: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

42

Conclusion

• Stochastic algorithms are becoming increasingly popular in solving complex search and optimization problems in various application domains, including machine learning and data analysis

• A certain degree of randomness, as involved in stochastic algorithms, may help tremendously in improving the ability of a search procedure to discover near-optimal solutions

Page 43: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

43

Conclusion (2)

• Many stochastic methods are inspired by natural phenomena, either by physical or biological processes

• Simulated annealing and evolutionary algorithms discussed in this presentation are two such examples

Page 44: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

44

Further reading

• Corne, D., Dorigo, M. and Glover F. (eds.) (1999): New Ideas in Optimization, McGraw Hill, London

• Eiben, A. E. and Smith, J. E. (2003): Introduction to Evolutionary Computing, Springer, Berlin

• Freitas, A. A. (2002): Data Mining and Knowledge Discovery with Evolutionary Algorithms, Springer, Berlin

Page 45: 1 Stochastic Search Methods Bogdan Filipič Jožef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia bogdan.filipic@ijs.si ACAI 05 ADVANCED COURSE

45

Further reading (2)

• Jacob, C. (2003): Stochastic Search Methods. In: Berthold, M. and Hand, D. J. (eds.) Intelligent Data Analysis, Springer, Berlin

• Reeves, C. R. (ed.) (1995): Modern Heuristic Techniques for Combinatorial Problems, McGraw Hill, London