refact script train bot
This commit is contained in:
parent
a7aa087b18
commit
2499c3377f
|
|
@ -4,8 +4,8 @@ ROOT="$(cd "$(dirname "$0")" && pwd)/../.."
|
|||
LOGS_DIR="$ROOT/bot/models/logs"
|
||||
|
||||
CFG_SIZE=12
|
||||
# BINBOT=train_dqn_burn
|
||||
BINBOT=train_dqn_burn_big
|
||||
BINBOT=train_dqn_burn
|
||||
# BINBOT=train_dqn_burn_big
|
||||
# BINBOT=train_dqn_burn_before
|
||||
OPPONENT="random"
|
||||
|
||||
|
|
@ -13,15 +13,15 @@ PLOT_EXT="png"
|
|||
|
||||
train() {
|
||||
cargo build --release --bin=$BINBOT
|
||||
NAME=$BINBOT"_$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
LOGS="$LOGS_DIR/$NAME.out"
|
||||
mkdir -p "$LOGS_DIR"
|
||||
NAME="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
LOGS="$LOGS_DIR/$BINBOT/$NAME.out"
|
||||
mkdir -p "$LOGS_DIR/$BINBOT"
|
||||
LD_LIBRARY_PATH="$ROOT/target/release" "$ROOT/target/release/$BINBOT" | tee "$LOGS"
|
||||
}
|
||||
|
||||
plot() {
|
||||
NAME=$(ls -rt "$LOGS_DIR" | grep $BINBOT | tail -n 1)
|
||||
LOGS="$LOGS_DIR/$NAME"
|
||||
NAME=$(ls -rt "$LOGS_DIR/$BINBOT" | tail -n 1)
|
||||
LOGS="$LOGS_DIR/$BINBOT/$NAME"
|
||||
cfgs=$(head -n $CFG_SIZE "$LOGS")
|
||||
for cfg in $cfgs; do
|
||||
eval "$cfg"
|
||||
|
|
@ -31,7 +31,7 @@ plot() {
|
|||
tail -n +$((CFG_SIZE + 2)) "$LOGS" |
|
||||
grep -v "info:" |
|
||||
awk -F '[ ,]' '{print $5}' |
|
||||
feedgnuplot --lines --points --unset grid --title "adv = $OPPONENT ; density = $dense_size ; decay = $eps_decay ; max steps = $max_steps" --terminal $PLOT_EXT >"$LOGS_DIR/$OPPONENT-$dense_size-$eps_decay-$max_steps-$NAME.$PLOT_EXT"
|
||||
feedgnuplot --lines --points --unset grid --title "adv = $OPPONENT ; density = $dense_size ; decay = $eps_decay ; max steps = $max_steps" --terminal $PLOT_EXT >"$LOGS_DIR/$BINBOT/$NAME.$PLOT_EXT"
|
||||
}
|
||||
|
||||
if [ "$1" = "plot" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue