Unit 5 Machine Learning Aktu
Unit 5 Machine Learning Aktu
Genetic Algorithms: An illustrative example, Hypothesis space search, Genetic Programming, Models
of Evolution and Learning; Learning first order rules- sequential covering algorithms-General to
specific beam search-FOIL; REINFORCEMENT LEARNING - The Learning Task, Q learning.
Genetic Algorithms
A genetic algorithm is an adaptive heuristic search algorithm inspired by "Darwin's theory of
evolution in Nature." It is used to solve optimization problems in machine learning. It is one of the
important algorithms as it helps solve complex problems that would take a long time to solve. Genetic
Algorithms are being widely used in different real-world applications, for example, Designing
electronic circuits, code-breaking, image processing, and artificial creativity.
Before understanding the Genetic algorithm, let's first understand basic terminologies to better
understand this algorithm:
o Population: Population is the subset of all possible or probable solutions, which can solve the
given problem.
o Chromosomes: A chromosome is one of the solutions in the population for the given problem,
and the collection of gene generate a chromosome.
o Gene: A chromosome is divided into a different gene, or it is an element of the chromosome.
o Allele: Allele is the value provided to the gene within a particular chromosome.
o Fitness Function: The fitness function is used to determine the individual's fitness level in the
population. It means the ability of an individual to compete with other individuals. In every
iteration, individuals are evaluated based on their fitness function.
o Genetic Operators: In a genetic algorithm, the best individual mate to regenerate offspring
better than parents. Here genetic operators play a role in changing the genetic composition of
the next generation.
o Selection
After calculating the fitness of every existent in the population, a selection process is used to determine
which of the individualities in the population will get to reproduce and produce the seed that will form
the coming generation.
2. Fitness Assignment
Fitness function is used to determine how fit an individual is? It means the ability of an individual to
compete with other individuals. In every iteration, individuals are evaluated based on their fitness
function. The fitness function provides a fitness score to each individual. This score further determines
the probability of being selected for reproduction. The high the fitness score, the more chances of
getting selected for reproduction.
3. Selection
The selection phase involves the selection of individuals for the reproduction of offspring. All the
selected individuals are then arranged in a pair of two to increase reproduction. Then these individuals
transfer their genes to the next generation.
There are three types of Selection methods available, which are:
o Roulette wheel selection
o Tournament selection
o Rank-based selection
4. Reproduction
After the selection process, the creation of a child occurs in the reproduction step. In this step, the
genetic algorithm uses two variation operators that are applied to the parent population. The two
operators involved in the reproduction phase are given below:
o Crossover: The crossover plays a most significant role in the reproduction phase of the genetic
algorithm. In this process, a crossover point is selected at random within the genes. Then the
crossover operator swaps genetic information of two parents from the current generation to
produce a new individual representing the offspring.
The genes of parents are exchanged among themselves until the crossover point is met. These
newly generated offspring are added to the population. This process is also called or crossover.
5. Termination
After the reproduction phase, a stopping criterion is applied as a base for termination. The algorithm
terminates after the threshold fitness solution is reached. It will identify the final solution as the best
solution in the population.
Genetic Programming:
Genetic programming is a form of artificial intelligence that mimics natural selection in order to find
an optimal result. Genetic programming is iterative, and at each new stage of the algorithm, it chooses
only the fittest of the “offspring” to cross and reproduce in the next generation, which is sometimes
referred to as a fitness function. Just like in biological evolution, evolutionary algorithms can
sometimes have randomly mutating offspring, but since only the offspring that have the highest fitness
measure are reproduced, the fitness will almost always improve over generations. Genetic
programming will generally terminate once it reaches a predefined fitness measure. Additionally,
architecture-altering operations can be introduced to an already running program in order to allow for
new sources of information to be analyzed for a given fitness function.
Genetic programming systems utilize a type of machine learning technique that can include automatic
programming without the need for manual interaction. This means that genetic algorithms can utilize
automatic program inductions to run as new information is ingested, so that the programs can be
optimized automatically. Genetic or evolutionary algorithms have a variety of uses, particularly
around domains where an exact solution is not known in advance, or when finding an approximate
solution is deemed appropriate. Genetic programming is often used in conjunction with other forms
of machine learning, as it is useful for performing symbolic regressions and feature classifications.
Genetic programming can help organizations and businesses by:
• Saving time: Genetic algorithms are able to process large amounts of data much more quickly
than humans can. Additionally, these algorithms run free of human biases, and are thereby able
to come up with ideas that might otherwise not have been considered.
• Data and text classification: Genetic programming can quickly identify and classify various
forms of data without the need for human oversight. Genetic programming can use data tree
construction in order to optimize these classifications, especially when dealing with big data.
• Ensuring network security: Rule evolution approaches have been successfully applied to
identify new attacks on networks. By quickly identifying intrusions, businesses and
organizations can ensure that they can respond to such attacks before they are able to access
confidential information.
For a better understanding, here is a table that summarizes the main differences between Machine
Learning and Genetic Programming:
Evaluation It can be evaluated using metrics like Evaluated based on the fitness of each
accuracy, precision, and recall. program's ability to solve the problem at hand.
Interpretability Some models may be difficult to Programmatic representation makes it easier to
interpret, making it challenging to understand how solutions evolved.
understand how decisions are being
made.
Limitations It can be prone to overfitting, bias, and Limited by the expressiveness of the
ethical concerns. programmatic representation and the
complexity of the problem at hand.
LAMARCKIAN MODEL:
The Lamarckian model defines that the traits of an individual get his or her lifetime can also be passed
to its further offspring. It was then named after the French biologist – Jean Baptiste Lamarck. Though
natural biology has excluded or disregarded the Lamarckism theory we know that only the information
in a particular genotype can be transmitted.
But from a computation point of view, it has also been stated that the Lamarckian model also gives
better results for some kinds of problems.
In the Lamarckian model, there is a local search operator which examines the neighbors getting new
traits, and if a good chromosome is found then it itself becomes the offspring.
BALDWINIAN MODEL:
As per the Baldwininan model, a chromosome can have the superficiality of encoding learning
beneficial behavior types. Unlike the Lamarckian model, here it does not transmit the traits acquired
to the next generation, and neither it completely ignores the traits acquired by the Darwinian model.
The Baldwinian model out of these extremes of two has the tendency of such kind of an individual
for acquiring traits that are encoded except the traits of themselves.
In the Baldwinian model, there is a local search operator that exists that examines the neighbor on
acquiring new traits, and if a good chromosome is found at the step, it then assigns only the improved
fitness factor to the particular chromosomes and it does not modify the chromosome itself. The ability
on acquiring the trait though it does not get passed directly on to the future generations.
Q-Learning
Q-learning is a model-free reinforcement learning algorithm that helps an agent learn the optimal
action-selection policy by iteratively updating Q-values, which represent the expected rewards of
actions in specific states.
Reinforcement Learning is a paradigm of the Learning Process in which a learning agent learns, over
time, to behave optimally in a certain environment by interacting continuously in the environment.
The agent during its course of learning experiences various situations in the environment it is in. These
are called states. The agent while being in that state may choose from a set of allowable actions which
may fetch different rewards (or penalties). Over time, The learning agent learns to maximize these
rewards to behave optimally at any given state it is in. Q-learning is a basic form of Reinforcement
Learning that uses Q-values (also called action values) to iteratively improve the behavior of the
learning agent.
This example helps us to better understand reinforcement learning.
Q-Learning
Q-learning in Reinforcement Learning
Q-learning is a popular model-free reinforcement learning algorithm used in machine learning and
artificial intelligence applications. It falls under the category of temporal difference learning
techniques, in which an agent picks up new information by observing results, interacting with the
environment, and getting feedback in the form of rewards.