blob: 4ded1c0c869483a67a006677fc2afccaf2d6ef84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/bin/bash
db_file=games_anon.db
query() {
echo "SELECT $1 FROM games WHERE (size == $2) \
and (result != '1-0') and (result != '0-1') and (result != '0-0')\
and (result != '1/2-1/2');"
}
extract() {
cd data
for size in 5 6; do
echo Extracing games of size "$size"...
sqlite3 "$db_file" "$(query $1 $size)" | shuf > "playtak-$size"
done
}
if [ ! -f "$db_file" ]; then
wget "https://www.playtak.com/games_anon.db"
fi
extract notation,result
echo Preparing pptdb
if [ ! -f "pptdb" ]; then
make pptdb
fi
echo -e "Beginning to process data\n"
for i in 5 6; do
echo "Size $i..."
./pptdb "$i" "data/playtak-$i" > "data/check-$i"
tail -n21 "data/check-$i"
echo Stripping overflows and illegal games...
grep -Fvxf "data/check-$i" "data/playtak-$i" > "data/good-playtak-$i"
echo -n "Generating training data... "
./pptdb "$i" "data/good-playtak-$i" generate
echo "Shuffling data..."
shuf "data/training-$i.csv" > "data/shuf-$i.csv"
mv "data/shuf-$i.csv" "data/training-$i.csv"
echo
done
shuf -n50000 data/good-playtak-5 > data/smalltak-5 && ./pptdb 5 data/smalltak-5 generate && \
head -n1 data/training-5.csv > t && tail -n+2 data/training-5.csv > test.csv && shuf test.csv >> t && mv t test.csv
|