diff options
| author | tslil <tslil@posteo.de> | 2021-01-05 21:39:41 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | 467128c57e23785abc3e80462c05c2f2abbc0679 (patch) | |
| tree | fb7df0b86879f61743656117f1c74ec8fc2e8544 /extract.sh | |
| parent | 8a231c52d56e011b42fa854542670c5b41801d47 (diff) | |
Experimenting with training nn
Diffstat (limited to 'extract.sh')
| -rwxr-xr-x | extract.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/extract.sh b/extract.sh new file mode 100755 index 0000000..4ded1c0 --- /dev/null +++ b/extract.sh @@ -0,0 +1,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 |
