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"
|
LOGS_DIR="$ROOT/bot/models/logs"
|
||||||
|
|
||||||
CFG_SIZE=12
|
CFG_SIZE=12
|
||||||
# BINBOT=train_dqn_burn
|
BINBOT=train_dqn_burn
|
||||||
BINBOT=train_dqn_burn_big
|
# BINBOT=train_dqn_burn_big
|
||||||
# BINBOT=train_dqn_burn_before
|
# BINBOT=train_dqn_burn_before
|
||||||
OPPONENT="random"
|
OPPONENT="random"
|
||||||
|
|
||||||
|
|
@ -13,15 +13,15 @@ PLOT_EXT="png"
|
||||||
|
|
||||||
train() {
|
train() {
|
||||||
cargo build --release --bin=$BINBOT
|
cargo build --release --bin=$BINBOT
|
||||||
NAME=$BINBOT"_$(date +%Y-%m-%d_%H:%M:%S)"
|
NAME="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
LOGS="$LOGS_DIR/$NAME.out"
|
LOGS="$LOGS_DIR/$BINBOT/$NAME.out"
|
||||||
mkdir -p "$LOGS_DIR"
|
mkdir -p "$LOGS_DIR/$BINBOT"
|
||||||
LD_LIBRARY_PATH="$ROOT/target/release" "$ROOT/target/release/$BINBOT" | tee "$LOGS"
|
LD_LIBRARY_PATH="$ROOT/target/release" "$ROOT/target/release/$BINBOT" | tee "$LOGS"
|
||||||
}
|
}
|
||||||
|
|
||||||
plot() {
|
plot() {
|
||||||
NAME=$(ls -rt "$LOGS_DIR" | grep $BINBOT | tail -n 1)
|
NAME=$(ls -rt "$LOGS_DIR/$BINBOT" | tail -n 1)
|
||||||
LOGS="$LOGS_DIR/$NAME"
|
LOGS="$LOGS_DIR/$BINBOT/$NAME"
|
||||||
cfgs=$(head -n $CFG_SIZE "$LOGS")
|
cfgs=$(head -n $CFG_SIZE "$LOGS")
|
||||||
for cfg in $cfgs; do
|
for cfg in $cfgs; do
|
||||||
eval "$cfg"
|
eval "$cfg"
|
||||||
|
|
@ -31,7 +31,7 @@ plot() {
|
||||||
tail -n +$((CFG_SIZE + 2)) "$LOGS" |
|
tail -n +$((CFG_SIZE + 2)) "$LOGS" |
|
||||||
grep -v "info:" |
|
grep -v "info:" |
|
||||||
awk -F '[ ,]' '{print $5}' |
|
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
|
if [ "$1" = "plot" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue