Machine learning workshop given at the 2017 IGGI conference.
Download the data from
here. The files dataset_c4*.pkl
are Connect Four data files generated by players of different strengths. You only need one of them -- I recomment dataset_c4.pkl
.
The files are compressed to save space, but what they contain is essentially a list of dictionaries that looks something like this:
[
{
"own_pieces": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"opponent_pieces": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"move": 4,
"own_win": 0,
"opponent_win": 1
},
...
{
"own_pieces": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"opponent_pieces": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],
"move": 3,
"own_win": 1,
"opponent_win": 0
}
]
own_pieces
is a list representing the board (flattened) and has a 1 in spaces where the current player has a piece, and 0 in all other spaces.
opponent_pieces
is the same but for the opponent.
move
is the move that was made by the current player. This move is not reflected in own_pieces
and opponent_pieces
. In Connect Four, there are seven possible moves assuming that none of the columns are filled. move
is therefore an integer in the range [0,6]. The data provider changes this to a one-hot encoding, e.g. 3
becomes [0, 0, 0, 1, 0, 0, 0]
.
own_win
is 1 if the current player went on to win the game, and 0 if not.
opponent_win
is the same but for the opponent.
Installation instructions can be found in the tf_install/
directory, or on
tensorflow.org.
Python 3 installer included in tf_install/python/
. Then run the commands in
windows.bat
.
Install Python 3 if you don't have it already. The included script will set up a virtualenv virtual environment. Activate it by running
source ./tf/bin/activate
and then run the second script to install TensorFlow.
The included script will download and install Python 3 and set up a virtualenv virtual environment. Activate it by running
source ./tf/bin/activate
and then run the second script to install TensorFlow.