Machine Learning
A Quick look
Sources:
• Artificial Intelligence – Russell & Norvig
• Artifical Intelligence - Luger
By: Héctor Muñoz-Avila
What Is Machine Learning?
“Logic is not the end of wisdom, it is just the beginning” --- Spock
same time
Environment Environment
System System
Action1 Action2
Knowledge Knowledge
changed
Classification
(According to the language representation)
• Symbolic
Version Space
Decision Trees
Explanation-Based Learning
…
• Sub-symbolic
Connectionist
Evolutionary
Version Space
Idea: Learn a concept from a group of instances, some
positive and some negative
Example: Two extremes (temptative) solutions:
•target: obj(Size,Color,Shape) too general
Size = {large, small} obj(X,Y,Z)
Color = {red, white, blue}
…
Shape = {ball, brick, cube}
concept space obj(X,Y,ball)
•Instances:
+:
obj(large,white,ball)
obj(small,blue,ball) obj(large,Y,ball) obj(small,Y,ball)
−:
obj(small,red,brick) obj(large,white,ball) obj(small,blue,ball) …
obj(large,blue,cube)
too specific
How Version Space Works
If we consider only positives If we consider positive and negatives
+ + +
+ +
+ +
+
+ + + +
− + − − + −
+ +
What is the role of the negative instances?
to help prevent over-generalizations
Explanation-Based learning
A C
C B
B A
C B
A B A C
?
B ? C ? B A
C A B C B
A B A C
A C
A A
B C B C
C B
A A
B C
Can we avoid making this error again?
Explanation-Based learning (2)
C
A B
?
B ? C ?
A
C A B C B
A B
A C
Possible rule: If the initial state is this and the final state is this,
don’t do that
More sensible rule: don’t stack anything above a block, if the block has
to be free in the final state
Evolutionary Approaches
Idea: Biological analogy on how populations of species evolve over
generations
Step 1: start with a population (each member is a candidate solution)
…
Step 2: Create the next generation by considering evolutionary
operations on the population from the previous generation (e.g.,
mutation) and a fitness function (only the more fit get to contribute to
the next generation)
…
Continue the process until a certain condition is reached
The Genetic Algorithm
t0
Initialize the population P(t)
Crossover
While the termination condition is not met do Mutation
{ Inversion
evaluate fitness of each member of P(t) exchange
select members of P(t) based on fitness
produce the offspring of pairs of selected members using genetic
operators
replace, based on fitness, candidates of P(t) based on this offspring
tt+1
}
Non-selected members are not necessarily eliminated
Example: CNF-satisfaction
A conjunctive normal form (CNF) is a Boolean expression
consisting of one or more disjunctive formulas connected by an
AND symbol (). A disjunctive formula is a collection of one or
more (positive and negative) literals connected by an OR
symbol ().
Example:
(a) (¬ a ¬b c d) (¬c ¬d) (¬d)
Problem (CNF-satisfaction): Give an algorithm that
receives as input a CNF form and returns Boolean
assignments for each literal in form such that form is true
Example (above):
a true, b false, c true, d false
CNF as a Genetic Algorithm
• A potential solution is a true/false assignment to the 4 variables a,
b, c, and d in the formula: 1010 means that a and c are true and b
and d are false
• In particular, a solution for (a) (¬ a ¬b c d) (¬c ¬d) (¬d) is
1001
• Nice: all 4 genetic operations applied on any potential solutions
will result in a potential solutions (in other problems or other
representations of this problem this may not be the case)
•Fitness: for 0101 and 1001: which is a more suitable solution? 1001
1 2
•Fitness value? # of disjunctions in the formula that are made true
The Genetic Algorithm for CNF
t0 N randomly generated strings of 4 integers
Initialize the population P(t) Solution has not been found
While the termination condition is not met do
{ # of disjunctions in the formula
evaluate fitness of each member of P(t) that are made true
select members of P(t) based on fitness Select top 30%
produce the offspring of pairs of selected members using genetic
operators Select among the 4 operations randomly
replace, based on fitness, candidates of P(t) based on this offspring
tt+1
Top N candidates
}