Neural Networks and Machine Learning Applications CSC 563 Prof. Mohamed Batouche Computer Science Department CCIS – King Saud University Riyadh, Saudi Arabia mbatouche@ccis.ksu.edu.sa
Complex Systems Emergent Behaviors and Patterns from Local Interactions
What is a complex system? A complex system displays some or all of the following characteristics: Agent-based Basic building blocks are the characteristics and activities of individual agents Heterogeneous The agents differ in important characteristics Dynamic Characteristics change over time, usually in a nonlinear way; adaptation Feedback Changes are often the result of feedback from the environment Organization Agents are organized into groups or hierarchies Emergence Macro-level behaviors that emerge from agent actions and interactions
Complex systems The fundamental characteristic of a complex system is that it exhibits emergent properties: Local interaction rules between simple agents give rise to complex pattern and global behavior
Complex vs. Simple Systems Have many parts • Parts are interdependent in behaviour • Difficult to understand because: – behaviour of whole understood from behaviour of parts – behaviour of parts depends on behaviour of whole
Complex Systems perspectives Complex Systems as a Science to Understand Nature Complex Systems as a New Form of Engineering
Complex Systems A new form of Engineering Engineering which faces complex problems using simple dynamic systems. « The whole is too much greater than the sum of the parts »
Examples of Complex Systems Brain Government Family Wold Ecosystem Local Ecosystem (desert, ocean, rainforest) Weather University Ant colony …
Anything to be Learnt from Ant Colonies? Fairly simple units generate complicated global behaviour. An ant colony expresses a complex collective behavior providing intelligent solutions to problems such as: carrying large items forming bridges finding the shortest routes from the nest to a food source, prioritizing food sources based on their distance and ease of access. “If we knew how an ant colony works, we might understand more about how all such systems work, from brains to ecosystems.” (Gordon, 1999)
Shortest path discovery
Adaptation to Environmental Changes
Interactions among Social Insects • Direct Interactions • Food or liquid exchange • Visual or tactile contact • Indirect Interactions: Stigmergy • Pheromones • Individual behaviour modifies the environment (e.g., by putting up signs = stigma), which in turn modifies the behaviour of other individuals.
Demo NetLogo Massively Parallel MicroWolds
Universal properties shared by complex systems Emergence: The appearance of macroscopic patterns, properties, or behaviors that are not simply the “sum” of the microscopic properties or behaviors of the components Self-organization: In biological systems, the emergent order often has some adaptive purpose – e.g., efficient operation of ant colony
Emergence: Attempt of a Definition • From the book: Steven Johnson, Emergence—The Connected Lives of Ants, Brains, Cities, and Software – Emergence is what happens when an interconnected system of relatively simple elements self-organizes to form more intelligent, more adaptive higher-level behaviour. – It’s a bottom-up model; rather than being engineered by a general or a master planner, emergence begins at the ground level. – Systems that at first glance seem vastly different […] all turn out to follow the rules of emergence.
Emergence in complex systems • How do neurons respond to each other in a way that produces thoughts (minds)? • How do cells respond to each other in a way that produces the distinct tissues of a growing embryo? • How do species interact to produce predictable changes, over time, in ecological communities? • ...
Emergence in complex systems Boids of Craig Reynolds
Boids of Reynolds Bird Flocking “Boids” model was proposed by Reynolds Boids = Bird-oids (bird like) Only three simple rules
Boids of Reynolds simple rules give rise to complex behavior
Collision Avoidance Rule 1: Avoid Collision with neighboring birds
Velocity Matching: Alignment Rule 2: Match the velocity of neighboring birds
Flock Centering: Cohesion Rule 3: Stay near neighboring birds
Characteristics Simple rules for each individual No central control Decentralized and hence robust Emergent Performs complex functions
Boids of Reynolds Boids of Craig Reynolds
Emergence in complex systems Boids of Craig Reynolds
Emergence in complex systems Boids of Craig Reynolds
Demo NetLogo Bird Flocking
Why Are Complex Systems Important for CS? • Fundamental to theory & implementation of massively parallel, distributed computation systems • How can millions of independent computational (or robotic) agents cooperate to process information & achieve goals, in a way that is: – efficient – self-optimizing – adaptive – robust in the face of damage or attack
Some of Natural Systems adaptive path minimization by ants fish schooling and bird flocking evolution by natural selection information processing in the brain wasp and termite nest building pattern formation in animal coats game theory and the evolution of cooperation computation at the edge of chaos
Some of Artificial Complex Systems artificial neural networks simulated annealing cellular automata ant colony optimization artificial immune systems particle swarm optimization genetic algorithms other evolutionary computation systems
Reverse Emergence • simple rules give complex behaviour –but which simple rules give the desired complex behaviour? Reverse emergence
Reverse Emergence Searching simple rules by hand (trials). Taking inspiration from nature (bees, ants…) Optimization and Learning (GA, RL …) Reverse emergence
Reverse Emergence Molecular NanoTechnology • assembled artefact is emergent property – of actions of vast number of nanites • design requires “reverse emergence” – from desired emergent artefact – to behaviour of naniteassemblers • extreme example of “non-classical refinement” • simple rules give complex behaviour – but whichsimple rules give the desiredcomplex behaviour? Reverse emergence Adapted from Susan Stepney Slides (April 2006) University of York – Journeys in non-classical computation
Artificial Complex Systems Genetic Algorithms Genetic programming Particle Swarm optimization
Genetic Algorithms
Stochastic Search: Genetic Algorithms Formally introduced in the US in the 70s by John Holland. GAs emulate ideas from genetics and natural selection and can search potentially large spaces. Before we can apply Genetic Algorithm to a problem, we need to answer: - How is an individual represented? - What is the fitness function? - How are individuals selected? - How do individuals reproduce?
Stochastic Search: Genetic Algorithms Representation of states (solutions) Each state or individual is represented as a string over a finite alphabet. It is also called chromosome which Contains genes. genes 1001011111 Solution: 607 Encoding Chromosome: Binary String
Stochastic Search: Genetic Algorithms Fitness Function Each state is rated by the evaluation function called fitness function. Fitness function should return higher values for better states: Fitness(X) should be greater than Fitness(Y) !! [Fitness(x) = 1/Cost(x)] Cost States X Y
Stochastic Search: Genetic Algorithms Selection How are individuals selected ? Roulette Wheel Selection 1 2 3 5 18 4 6 7 8 Rnd[0..18] = 7 Chromosome4 Rnd[0..18] = 12 Chromosome6
Stochastic Search: Genetic Algorithms Cross-Over and Mutation How do individuals reproduce ?
Stochastic Search: Genetic Algorithms Crossover - Recombination 1010000000 1001011111 Crossover single point - random 1011011111 Parent1 Parent2 Offspring1 Offspring2 With some high probability (crossover rate) apply crossover to the parents. (typical values are 0.8 to 0.95)
Stochastic Search: Genetic Algorithms Mutation mutate 1011001111 Offspring1 1011011111 Offspring1 1010000000 1000000000 Offspring2 Offspring2 Original offspring Mutated offspring With some small probability (the mutation rate) flip each bit in the offspring (typical values between 0.1 and 0.001)
Genetic Algorithms GA is an iterative process and can be described as follows: Iterative process Start with an initial population of “solutions” (think: chromosomes) Evaluate fitness of solutions Allow for evolution of new (and potentially better) solution populations E.g., via “crossover,” “mutation” Stop when “optimality” criteria are satisfied
Genetic Algorithms Algorithm: 1. Initialize population with p Individuals at random 2. For each Individual h compute its fitness 3. While max fitness < threshold do Create a new generation Ps 4. Return the Individual with highest fitness
Genetic Algorithms Create a new generation Ps: Select (1-r)p members of P and add them to Ps. The probability of selecting a member is as follows: P(hi) = Fitness (hi) / Σj Fitness (hj) Crossover: select rp/2 pairs of hypotheses from P according to P(hi). For each pair (h1,h2) produce two offspring by applying the Crossover operator. Add all offspring to Ps. Mutate: Choose mp members of Ps with uniform probability. Invert one bit in the representation randomly. Update P with Ps Evaluate: for each h compute its fitness.
Genetic Algorithms Cost States
Genetic Algorithms Mutation Cross-Over
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Programming
Genetic Programming Genetic programming (GP) Programming of Computers by Means of Simulated Evolution How to Program a Computer Without Explicitly Telling It What to Do? Genetic Programming is Genetic Algorithms where solutions are programs …
Genetic programming When the chromosome encodes an entire program or function itself this is called genetic programming (GP) In order to make this work, encoding is often done in the form of a tree representation Crossover entails swapping subtrees between parents
Genetic programming It is possible to evolve whole programs like this but only small ones. Large programs with complex functions present big problems
Genetic programming Inter-twined Spirals: Classification Problem Red Spiral Blue Spiral
Genetic programming Inter-twined Spirals: Classification Problem
Ant Colony Optimization
Shortest path discovery Ants get to find the shortest path after few minutes …
Ant Colony Optimization Each artificial ant is a probabilistic mechanism that constructs a solution to the problem, using: Artificial pheromone deposition Heuristic information: pheromone trails, already visited cities memory …
TSP Solved using ACO
Particle Swarm Optimization
Particle Swarm Optimization Particle Swarm Optimization (PSO) mimics the collective intelligent behavior of “ unintelligent ” creatures. It was developed in 1995 by James Kennedy and Russell Eberhart Individuals interact with one another while learning from their own experience, and gradually move towards the goal. It is easily implemented and has proven both very effective and quick when applied to a diverse set of optimization problems.
Bird flocking is one of the best example of PSO in nature. One motive of the development of PSO was to model human social behavior.
Algorithm of PSO Each particle (or agent) evaluates the function to maximize at each point it visits in spaces. Each agent remembers the best value of the function found so far by it (pbest) and its co-ordinates. Secondly, each agent know the globally best position that one member of the flock had found, and its value (gbest).
Algorithm of PSO Using the co-ordinates of pbest and gbest, each agent calculates its new velocity as: vi = vi + c1 x rand() x (pbestxi – presentxi) + c2 x rand() x (gbestx – presentxi) where 0 < rand() <1 presentxi = presentxi + (vi x Δt)
Algorithm of PSO
Conclusions We can learn from nature and take advantage of the problems that she has already solved. Many simple individuals interacting with each other can make a global behavior emerge. Techniques based on natural collective behavior (Swarm Intelligence) are interesting as they are cheap, robust, and simple. They have lots of different applications. Swarm intelligence is an active field in Artificial Intelligence, many studies are going on.