diff options
| author | tslil <tslil@posteo.de> | 2021-01-07 16:34:07 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | 7ee86fd0ee5c6894fe8aa15b89f626220deafc63 (patch) | |
| tree | fdefced438a7e35d3825a6c8c3b3011fd30eec2f /extract.sh | |
| parent | 71106f2a643b8cdc55eb52d6159894fef3cd3aec (diff) | |
Searching for a good representation
Diffstat (limited to 'extract.sh')
| -rwxr-xr-x | extract.sh | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -21,19 +21,24 @@ extract() { } process() { + num_games=$1 echo -e "Beginning to process data\n" - for i in 5 6; do + for i in 5; do echo "Size $i..." ./pptdb "$i" "data/playtak-$i" > "data/check-$i" tail -n21 "data/check-$i" - echo Stripping overflows and illegal games... + echo -e "\tStripping 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 + echo -e "\tChoosing $num_games from what remains ..." + shuf -n $num_games "data/good-playtak-$i" > "data/smalltak-$i" + echo -en "\tGenerating training data... " + ./pptdb "$i" "data/smalltak-$i" generate + echo -e "\tWrote $(wc -l data/training-$i.csv | cut -d\ -f1) samples. Shuffling these..." + tail -n+2 "data/training-$i.csv" | shuf > "data/shuf-$i.csv" + head -n 1 "data/training-$i.csv" | cat "data/shuf-$i.csv" > "data/smalltrain-$i.csv" + rm "data/shuf-$i.csv" + mv "data/smalltrain-5.csv" "data/training-5.csv " + echo -e "\n\tDone! Sample training data in data/training-$i.csv" done } @@ -41,12 +46,6 @@ if [ ! -f "data/playtak-5" ]; then extract notation,result fi -if [ ! -f "pptdb" ]; then - echo Preparing pptdb - make pptdb -fi - -# process +make pptdb -shuf -n10000 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 > data/train5.csv && shuf data/train5.csv >> t && mv t data/train5.csv +process 5000 |
