aboutsummaryrefslogtreecommitdiff
path: root/resources/extract.sh
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-08-30 19:46:07 +0100
committertslil <tslil@posteo.de>2026-09-02 12:13:01 +0100
commit241156da6f35cb888253e6b8814e7b61a76b4fc7 (patch)
treee562029445b1473cc89590793f32c561540d621c /resources/extract.sh
parent696c3808220ea9d8c604939894a2d509f05cc4c6 (diff)
TD(lambda), and a big rework
NOTE: 6x6 weights are as-yet untrained On the performance side: * switch from linked-list chaining hash table to direct mapping * cache check_win by hash * persist transposition tables across plies (this was a big deal and difficult to puzzle out) * add align directives to the network floats * prepare_nn_input gained a small LUT to avoid branching (i suppose you might call this 1D embedding) * apply mtune=native for the native builds On the correctness side: * Zobrist has now includes the ply parity * the network now predicts something in [-1, 1] using tanh (approximated by polynomials) * the training object is now MSE because we're learning a value estimate * use .clangd instead of compile_commands.json On the training side: * completely forgo human-derived data set * implement td(lambda), self-play, tournaments
Diffstat (limited to 'resources/extract.sh')
-rwxr-xr-xresources/extract.sh68
1 files changed, 0 insertions, 68 deletions
diff --git a/resources/extract.sh b/resources/extract.sh
deleted file mode 100755
index 346547e..0000000
--- a/resources/extract.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-
-db_file=games_anon.db
-
-#chosen_players="AaaarghBot Tiltak_Bot TakticianBot"
-chosen_players=""
-
-query() {
- query="(size == $1) and (result != '1-0') and (result != '0-1') and (result != '0-0') and (result != '1/2-1/2')"
- selct=""
- for player in $chosen_players; do
- selct="$selct(player_black = '$player') or (player_white = '$player') or "
- done;
- if [ -n "$selct" ]; then
- query="$query and (${selct:0:-4})"
- fi
- echo "SELECT $2 FROM games WHERE $query;"
-}
-
-extract() {
- size="$1"
- things="$2"
- if [ ! -f "data/$db_file" ]; then
- wget "https://www.playtak.com/games_anon.db" -O "data/$db_file"
- fi
- echo Extracing games of size "$size" with query: "$(query $size $things)"
- sqlite3 "data/$db_file" "$(query $size $things)" | shuf > "data/playtak-$size"
-}
-
-prepare() {
- size=$1
- ./pptdb "$size" "data/playtak-$size" > "data/check-$size"
- tail -n22 "data/check-$size"
- echo -ne "\tStripping overflows and illegal games... "
- grep -Fvxf "data/check-$size" "data/playtak-$size" > "data/good-playtak-$size-all"
- shuf "data/good-playtak-$size-all" > "data/good-playtak-$size"
- rm "data/good-playtak-$size-all"
-
- echo -en "Done.\n\tGenerating training data... "
- ./pptdb "$size" "data/good-playtak-$size" generate
-}
-
-process() {
- size=$1
- num_t=$2
- num_v=$3
- total=$(( num_t + num_v ))
-
- echo -en "\tChoosing $num_t + $num_v = $total of $(wc -l data/parsed-$size.csv | cut -d\ -f1) samples... "
- shuf -n $total "data/parsed-$size.csv" > "data/shuf-$size.csv"
- head -n $num_t "data/shuf-$size.csv" > "data/training-$size.csv"
- tail -n $num_v "data/shuf-$size.csv" > "data/validation-$size.csv"
-
- echo "Done. "
-}
-
-if [ ! -d data ]; then
- mkdir data
-fi
-
-make pptdb
-
-for size in 5 6; do
- echo
- extract $size notation,result
- prepare $size
- process $size 1000000 20000
-done