Download An Introduction to the WEKA Data Mining System Zdravko Markov

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Pedagogical Possibilities for the
N-Puzzle Problem
Zdravko Markov
Central Connecticut State University, markovz@ccsu.edu
Ingrid Russell
University of Hartford, irussell@hartford.edu
Todd Neller
Gettysburg College, tneller@gettysburg.edu
Neli Zlatareva
Central Connecticut State University, zlatareva@ccsu.edu
This work was partially supported by NSF CCLI-A&I Award Number 0409497
Project MLExAI
http://uhaweb.hartford.edu/compsci/ccli/
Enhance the student learning experience in the
introductory Artificial Intelligence (AI) course by:
• Introducing Machine Learning (ML) elements into
the AI course.
• Implementing a set of unifying ML laboratory
projects to tie together the core AI topics.
• Developing, applying, and testing an adaptable
framework for the presentation of core AI topics.
Solving the N-Puzzle Problem
Project
• Good framework for illustrating the classical AI
search in an interesting and motivating way.
• Suitable for introducing students to Analytical
(Explanation-Based) Learning (EBL) using search.
• Hands-on experiments with search algorithms
combined with an EBL component give students a
deep, experiential understanding of both search and
EBL.
The N-Puzzle Game
Initial Configuration
1
6
2
4
5
3
7
8
Moves
5 → Down
6 → Down
2 → Left
3 → Up
6 → Right
5 → Up
8 → Left
Goal Configuration
1
2
3
4
5
6
7
8
• Large state space (3x3)!/2 = 181440
• Not all states are reachable from a given state
State Space Representation (Prolog)
A B C
D E F
0 B C
D E F
s(A,B,C,D,E,F)
Variables A,B,V,D,E,F  [1,5]
0 – empty tile
% Empty tile (0) in position A
% Slide B left
arc(s(0,B,C,D,E,F),s(B,0,C,D,E,F)).
% Slide D up
arc(s(0,B,C,D,E,F),s(D,B,C,0,E,F)).
B 0 C
D B C
D E F
0 E F
Why Prolog?
• Prolog code is concise and easily understood.
• Can be used at query level only. Access the database and run
algorithms without actual programming.
• Suits well other important AI topics such as FOL, KR and
Reasoning.
• Meta-programming features allow straightforward
implementation of EBL techniques.
• Free implementations available, e.g. SWI-Prolog
(http://www.swi-prolog.org/)
Sample Queries
% Access database (one-move transitions)
?- arc(s(0,1,2,3,4,5),X).
X = s(1,0,2,3,4,5) ;
X = s(3,1,2,0,4,5)
% A three-move solution does not exist
?- arc(s(0,4,5,1,2,3),X),arc(X,Y),arc(Y,s(4,2,5,1,0,3)).
No
% Find a two-move solution
?- arc(s(0,4,5,1,2,3),X),arc(X,s(4,2,5,1,0,3)).
X = s(0,4,5,1,2,3)
% Use the path predicate to find multiple move solutions
?- path(s(0,4,5,1,2,3),s(4,2,5,1,0,3),P).
P = [s(4,0,5,1,2,3)];
P = [s(4,0,5,1,2,3),s(0,4,5,1,2,3),s(4,0,5,1,2,3)]
Sample Student Assignments
• Implement the state space representation of the 8puzzle problem.
• Investigate the state space by experimenting with
state space transitions at query level. What is the
branching factor? Are there repeated states and how
many?
• Use the path predicate to find paths between states.
• Investigate when and why infinite loops occur.
• What kind of search does the path predicate
implement – depth-first or breadth-first?
Search
breadth_first(+[[Start]],+Goal,-Path,-ExploredNodes)
(+ Input, - Output)
?- breadth_first([[s(4,5,3,0,1,2)]],s(1,2,3,4,5,0),P,N),
length(P,L).
P = [s(1,2,3,4,5,0),s(1,2,3,4,0,5),s(1,0,3,4,2,5),
s(0,1,3,4,2,5),s(4,1,3,0,2,5),s(4,1,3,2,0,5),
s(4,1,3,2,5,0), s(4,1,0,2,5,3),...]
N = 1197
L = 19
Sample Student Assignments
• Run uninformed and informed search algorithms (depthfirst, breadth-first, iterative deepening, best-first, A-star,
beam search) to solve s(4,5,3,0,1,2) => s(1,2,3,4,5,0).
• Represent the 8-puzzle problem s(2,3,5,0,1,4,6,7,8) =>
s(0,1,2,3,4,5,6,7,8). Try breadth-first, iterative deepening
and depth-first. Explain why depth-first fails.
• Use heuristic search for s(2,3,5,0,1,4,6,7,8) =>
s(0,1,2,3,4,5,6,7,8). Try best-first, A-star and beam
search. For beam search use n = 100, 10, 1. Explain why
beam search fails with n=1?
• Collect statistics and analyze the time and space
complexity of the above problems.
Explanation-Based Learning
• Target concept - state space search
heuristic.
• Training example - good (efficient) solution
of a state space search.
• Domain theory - state space
representation.
• Operationality criteria - constraints
associated with the state space search.
EBL in the N-Puzzle domain
1. Training example
s(4,5,3,0,1,2) s(5,1,3,4,2,0)
2. Verify if this is an instance of the target concept
?- breadth_first([[s(4,5,3,0,1,2)]],s(5,1,3,4,2,0),P,N).
P = [s(5,1,3,4,2,0),s(5,1,3,4,0,2),s(5,0,3,4,1,2),
s(0,5,3,4,1,2),s(4,5,3,0,1,2)]
N = 13
3. Explanation-Based Generalization (EBG)
A4, B5, C3, E1, F2, 0 remains
4. Add a new transition (new fact in the beginning of the database)
arc(s(A,B,C,0,E,F), s(B,E,C,A,F,0)).
Speed-up Learning
• Before EBL (without arc(s(A,B,C,0,E,F),s(B,E,C,A,F,0)))
?- breadth_first([[s(4,5,3,0,1,2)]],s(1,2,3,4,5,0),P,N),
length(P,L).
P = [s(1,2,3,4,5,0),s(1,2,3,4,0,5),s(1,0,3,4,2,5),
s(0,1,3,4,2,5),s(4,1,3,0,2,5),s(4,1,3,2,0,5),
s(4,1,3,2,5,0), s(4,1,0,2,5,3),...]
N = 1197
L = 19
• After EBL (with arc(s(A,B,C,0,E,F),s(B,E,C,A,F,0)))
?- breadth_first([[s(4,5,3,0,1,2)]],s(1,2,3,4,5,0),P,N),
length(P,L).
P = [s(1,2,3,4,5,0),s(1,2,3,4,0,5),s(1,0,3,4,2,5),
s(0,1,3,4,2,5),s(4,1,3,0,2,5),s(4,1,3,2,0,5),
s(4,1,3,2,5,0), s(4,1,0,2,5,3),...]
N = 647
L = 13
Sample Student Assignments
• Identify useful search heuristics and generate
and verify the corresponding EBL training
examples.
• Perform experiments with training examples and
update the state transition database.
• Measure the improvement after the EBL step in
terms of time and space complexity.
• Evaluate the effect of learning if too many or bad
examples are supplied.
Conclusion
• N-puzzle project is used in an AI class in Spring-2005
www.cs.ccsu.edu/~markov/ccsu_courses/ArtificialIntelligence.html
• Other projects developed in the framework of MLExAI
are also tested
• Student surveys show positive results
• More tests and evaluations are ongoing
• All projects and other material are available at MLExAI
web page at http://uhaweb.hartford.edu/compsci/ccli/
Related documents