aboutsummaryrefslogtreecommitdiff
path: root/include/cnn1986.c
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-31 23:33:39 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit328c8d1e3094a942d6a2edd933c9cc4ab09daab1 (patch)
tree21332661fb48c548b04d03d9a4131abe2070699a /include/cnn1986.c
parent399d90f1b94717aa0ca5abb1dc43bdb6f4160d13 (diff)
Just some #weightgoals ;)
It turns out that while i was training on a 0/1 classification problem, i was using 2*eval - 1. Training using this function instead, and on bot-dominated game choices (chosen_player in extract.sh) seems to have given a better evaluation function. At the least, Morten's swindle doesn't work anymore.
Diffstat (limited to 'include/cnn1986.c')
-rw-r--r--include/cnn1986.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/cnn1986.c b/include/cnn1986.c
index d4f6ad6..b95fca1 100644
--- a/include/cnn1986.c
+++ b/include/cnn1986.c
@@ -100,13 +100,13 @@ float cnn1986_evaluate_black_win(void) {
for (uint8_t d2 = 0; d2 < DENSE2_NUM; d2++) {
output += dense2[d2]*output_weights[d2];
}
- // Truncated Pade approximant of logistic function
- output = (12.0+output+50.0*output/(output*output+10.0))/24.0;
+ // 2*(clamped Pade approximant of logistic function) - 1
+ output = (12.0+output+50.0*output/(output*output+10.0))/12.0 - 1.0;
if (output > 1.0) {
return 1.0;
}
- else if (output < 0.0) {
+ else if (output < -1.0) {
return -1.0;
}
- return 2*output-1.0;
+ return output;
}