Title: Learning the probability of mate in shogi using SVM
1Learning the probability of mate in shogi using
SVM
- M2 Makoto Miwa
- Chikayama Taura Lab
2Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
3Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
4Introduction
- Checking mates is a critical problem in shogi.
- Many successful AND/OR tree search algorithms
- PN, PDS, df-pn
- Almost all computer shogi players have their own
check-mate-routine. - In Gekisashi, the check-mate-routine uses about
30 of the entire search time.
5Motivation (1)
- Success of machine learning in game playing
- Samuels checkers, TD-GAMMON, Neuro-Go,
- SVM succeeds in many classification problems.
- Just a little computation is required in
classification.
6Motivation (2)
- Can SVM learn mated or not classification from
examples?
- Using this classifier, we can
- Control mate-search.
- Control the ratio between mate-search and
true-search. - etc.
7Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
8What is mate?
- Mate in the narrow sense
- Opponent king will be captured in the next turn.
- Mate in the wide sense
- Opponent can be forced to take the mate position
in the narrower sense.
9Mate Search Algorithms
- Purpose
- Predict whether a position is mated or not (with
continuation check). - If mated, find a way to mate.
- Method
- Many successful AND/OR tree search algorithms.
- PN, PDS, df-pn
10PDS A. Nagai et al., 1998
- Proof-number and Disproof-number Search
- Purpose
- PDS tries to prove the node mated or not with the
smallest node extention. - Method
- PDS searches a certain node with smallest
(dis)proof number at (AND)OR node. - Proof-number (pn)
- The number of leaf nodes that must be true to
prove the node is true. - Disproof-number (dn)
- The number of leaf nodes that must be false to
prove the node is false.
11Mate search in shogi (1)
- Mate search at almost all nodes in the tree.
- To find mate without continuation check like
brinkmate. - To find threatmate, a move that the attacker can
mate the defenders king at his next move if the
defender does nothing.
12Mate search in shogi (2)
Search start
Decide the upper bound of the number of nodes in
mate search from the depth.
Mate Search
No or unknown
Mated?
Yes
Search child nodes
Search end
Game-tree
13Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
14Support Vector Machine (1)
- Proposed by Vapnik et al. in 1992
- Two-class classifier
- Important Features
- Maximize margin
- Support vectors
- represent hyperplane with a small set of input
data - Outputs
- By fitting a sigmoid function, we can map the
outputs into probabilities. (J. Plaat, 2000) - Kernel Trick
15Support Vector Machine (2)
Constructs the hyperplane (h) that maximize the
margin.
Problem
Margin
h
dual problem
Support Vector
16Support Vector Machine (3)
Classifier
- w and b can be pre-computed.
- Only one dot product per test data has to be
computed.
Fast classification can be performed.
17Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
18Classifier (1)
- How to construct the classifier.
- Based on the criterion of mate, label the train
position mated or not mated. - Extract mate features from the train position.
- Input these labels and mate features to the SVM
and train the SVM.
19Classifier (2)
- Define mate as
- PDS can find the position mated in the wide
sense in searching 1,000,000 nodes. - 1,000,000 nodes
- One mate can be found in 30 sec.
20Classifier (3)
- Mate Features (for each sides) - 135 features
- Features about the king
- Position, distance between two kings
- Features for 14, 27 squares in front of the king,
10, 21 squares behind the king, and 8 squares
around the king . - Board edge, occupied or not, square control
- Number of squares the king can escape
- Number of defense pieces, attack pieces and
pinned pieces - Pieces in hand
- Which pieces and how many pieces in hand
- Potential attack
- Pieces can put or move the square which they can
attack the king.
21Classifier (4)
22Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
23Experimental environment
- SVM
- LIBSVM
- SVM Library developed by Chih-Chung Chang and
Chih-Jen Lin - http//www.csie.ntu.edu.tw/cjlin/libsvm/
24Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
25Experiments - Classification -
- Purpose
- Study the behavior of the classifier.
- Datasets Usage
- 40000 positions
- 1 train set (30000 positions) and 1 test
set(10000 positions).
26Result - Classification - (1)
- Accuracy 0.865
- mate
- Precision 0.744
- Recall 0.605
- not mate
- Precision 0.940
- Recall 0.892
- Computation time
- About half a day in train using 30000 positions.
- 1.0msec per one classification.
27Result - Classification - (2)
- Accuracy 0.865
- Almost same accuracy in searching 500 nodes
(about 8th step from the leaf in Gekisashi) with
PDS. - ?This classifier might be useful in the deep
portion of a game tree.
8 step
28Result - Classification - (3)
- 1.0msec per one classification
- In Gekisashi, PDS expends 5.8 msec in searching
500 nodes. - ?Fast enough for practical use.
29Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
30Experiments control mate search (1)
- Control the amount of search nodes in mate search
depending on the classifiers output. - The classifiers output mated
- ?Increase the amount to ascertain the result of
the classifier. - The classifiers output not mated
- ?Decrease the amount to eliminate the search
which brings the result of unknown.
31Experiments control mate search (2)
Search start
Decide the upper bound of the number of nodes in
mate search from the depth.
Control the upper bound.
Mate Search
No or unknown
Mated?
Yes
Search child nodes
Game-tree
Search end
32Experiments control mate search (2)
Search start
Sub
Decide the upper bound of the number of nodes in
mate search from the depth.
Input to the SVM.
Control the upper bound.
No
Yes
Mated?
Mate Search
No or unknown
Mated?
Decrease the upper bound.
Increase the upper bound.
Yes
Search child nodes
Search end
Return
33Result control mate search - (1)
No search when being classified "not mated"
34Result control mate search - (2)
The classifier is efficient as not mated
classifier.
1/3 time the number of search nodes when being
classified "not mated"
35Result control mate search - (3)
- VS Original (Winning Percentage)
36Outline
- Introduction Motivation
- Mate problem
- Support Vector Machine
- Classifier
- Experiments Results
- Classification
- Control mate search
- Conclusion Future Work
37Conclusion
- Classification
- The classifier shows so good accuracy.
- With linear kernel, a classification is fast
enough for practical use. - Control mate search
- To decrease the search nodes which are classified
not mated improves the runtime performance.
38Future Work
- Measure the performance and decide where to use
this classifier. - Optimize SVM parameters and input features.
39Result - Classification - (4)
High precision in searching a small number of
nodes as a not-mated-classifier.