├── .gitignore ├── README.md ├── __init__.py ├── board_evaluation ├── evaluate_trained_model.ipynb ├── go_datafile_reader.py ├── graphs │ ├── bad_data_mixing.png │ ├── good_data_mixing5layer_64filters.png │ ├── move_250_histogram.png │ └── move_accuracies_5layer_64filter.png ├── model.py ├── model_eval.py ├── model_util.py ├── train.ipynb └── train_bad_mixing.ipynb ├── data ├── input │ └── move_to_test.sh └── working │ └── board_eval_cnn_5layer.ckpt ├── munge ├── __init__.py ├── bit_writer.py ├── finish_games.py └── go_dataset_preprocessor.py ├── thirdparty ├── Bag2d.py ├── GoBoard.py ├── GoString.py └── __init__.py └── visualization ├── BoardEvaluator.py ├── GoDriver.py ├── README.md ├── images ├── case for chain pooling.png ├── corner differences.png └── interesting game.png ├── main.py └── output.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.dat 2 | *.pyc 3 | .gitignore~ 4 | .ipynb_checkpoints 5 | *.log 6 | *.sgf 7 | *.sgfc 8 | 9 | future/ 10 | checkpoint 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Using CNN for Go (Weiqi/Baduk) board evaluation with tensorflow 3 | 4 | 5 | This is code for training and evaluating a Convolutional Neural Network for board evaluation in Go. This is an ongoing project and I will be adding to it in the coming weeks. The basic idea is motivated from two recent papers which did move prediction by training a network from professional game records ([Clark et. al](http://arxiv.org/abs/1412.3409) and [Maddison et. al](http://arxiv.org/pdf/1412.6564v2.pdf)). In this project instead of predicting the next move given the current board, we instead predict the final state of the board. This is possible due to the nature of the game Go, because pieces do not move during the game, early and midgame board positions are highly predictive of the final ownership. One hope is that a well trained position evaluator can be used in a strong Go playing engine, in particular remove the need for Monte Carlo Tree Search (MTCS) and instead allow for a traditional alpha-beta pruning approach like in the best Chess programs. The model exhibited here would likely perform poorly for such a task (for a number of reasons), but it is still interesting to see what it learned and I hope this work will inspire future projects. 6 | 7 | ##Current Model 8 | 9 | The inputs to the model are 8 feature planes containing information about the current state of the board. The target is a 19x19 binary matrix, where 1 indicates the player to move owns the location as either territory or has a stone on the location at the end of the game, 0 indicates the other player. In seki situations we consider both groups alive, and randomly assign spaces in between stones. Because we need to know the final state of the board, we only train on professional games which were played until the end, games ending in resignation are ignored. We train on ~15000 games from the Go4Go data set. We used GNU-Go to remove dead stones from the board and determine final ownership. Training on only games not ending in resignation has likely introduced unwanted biases to the model (e.g. large groups are more likely to live and all games are close), future work should address this issue. 10 | 11 | So far I have only tried a single architecture; namely a 5 layer CNN. It achieves 80% accuracy on a test set (test set consists of 150 games not used in training, resulting in roughly 150*250 = 37500 samples). The convolution sizes are all 5x5 and the number of filters in each layer are 64, 64, 64, 48, and 48, this gives roughly 350,000 parameters. The final output layer is a single 5x5 convolution. I use rectified linear units for activations in between each layer. The output of the model is a vector of 361 probabilities, one for each space in the board, and is the probability that the player to move will occupy that space at the end of the game. We use a sigmoid activation for the output layer and minimize the sum of squares loss between the predicted probabilities and the actual binary target. 12 | 13 | The input to the model consist of 8 feature planes. 3 planes indicate player to move stones which have 1, 2, or >=3 liberies, 3 places indicate the other player's stones, 1 plane indicates a ko location, the final plane is all 1's so the convolutions can detect the edge of the board. We use an ADAM optimizer with learning rate 10^-4. 14 | 15 | ## Results 16 | 17 | The model achieves 80% test set accuracy after ~4 hours of training on a GTX 970 card. After 12 hours of training accuracy is about 80.5%. Accuracy on the training set is around 81% suggesting we are currently under-fitting. Accuracy greatly varies based on far into the game it is. 18 | 19 | ![alt-text](http://i.imgur.com/za5fKov.png?1) 20 | 21 | For most games the model achieves > 96% accuracy at the end of the game. Note that accuracy is measured the average over all 361 spaces, which include neutral spaces that may exist between two live groups, these spaces were randomly assigned when gnugo finished the games and so it would be unreasonable to expect 100% accuracy even at the last move. 22 | 23 | The model is incredibly fun to visualize with gogui. Because the model has to make a prediction for all 361 board spaces, 24 | we get a more detailed picture of what the model's understanding of the game is than if the model was just predicting the next move. 25 | 26 | ![alt-text](http://i.imgur.com/pJnsdty.png) 27 | 28 | Above is the model's prediction halfway through a game, w has just played G13. The color of each square indicates which player the model believes will occupy that square at the end of the game. The size of the square indicates how confident the model is about that square. It has correctly determined the status of the black stones at B11 and the white stones at D4. It is unsure (as am I) as to who will occupy the top side of the board as well as the area around N3. 29 | 30 | It is interesting to see what sort of game knowledge the model as learned. As a small easy example consider an early game below and note the how the model treats a 4-4 (Q16) stone differently than a 3-4 (R4). One of the first things one learns about Go is the 3-4 stone has a much firmer grasp on the corner and the 4-4 is more about influence. The model also seems more sure about black's hold on the bottom left than whites on the top left (I could be wrong but I think the 2 space jump can be invaded?) 31 | 32 | ![alt-text](http://i.imgur.com/iNLLBNH.png) 33 | 34 | ## Future Improvements to the Model 35 | There are a lot of potential ways to improve the model. Current features are very minimal, only containing liberty information and ko information. The following additional features should make the model much more predictive, in particular with life and death situations: 36 | 37 | 1. Locations of recent moves 38 | 2. Age of stones 39 | 40 | It is unclear though whether or not previous move locations is a good idea if the model is to be used in a go engine, but it should certainly help improve accuracy. 41 | 42 | **Chain Pooling** 43 | One interesting tweak I would like to try is what I call "chain pooling". To motivation chain pooling, consider the game below (black has just played a sacrificial stone at T11): 44 | ![alt-text](http://i.imgur.com/K06c91S.png) 45 | Note the connected black stones at G16. The model is confident (and correct) that the upper part of the group will live at G18 and G17, yet it is unsure what will happen to G16, H16, and G15. However, even beginner Go players will agree that all stones in a connected group should share the same fate. As another example look at the white stones around S9. It would make sense to encourage the model to make the same predictions about connected stones, it would also make sense for the model to have the same internal representation for connected stones in the intermediate layers. 46 | 47 | To fix these issues I propose internal pooling layers where one takes a max pool along connected groups of stones. This is a little more complicated than traditional max pooling because the **shape of the max pools depends on the input**. I believe the resulting model space should be differentiable, it's more of a question of how to implement this computationally. 48 | 49 | ##Usage 50 | 51 | **Training** 52 | Current API for the code isn't great, you need to set data_dir variables and other flags within several .py files. Basic pipeline is the following: 53 | 1. Create a directory of .sgf files you want to train on (I used the [Go4Go dataset](http://www.go4go.net/go/)). 54 | 2. Run go_dataset_preprocessor.py, (first set the source and output dirs in main). This step requires [gnugo](https://www.gnu.org/software/gnugo/), which we need in order to remove dead stones and determine the final board position. **Note maybe 1 in 10000 games gnugo gets stuck in an infinite loop**. If so kill the process, remove the bad sgf file and restart the .py file, the .py file will skip over files already processed. This phase takes a while as gnugo is slow, maybe 5hours to process 10000 files. The output of each .sgf file is a binary .dat file containing board features and targets. 55 | 3. If desired, split .dat files into train and test folders. 56 | 4. Run train.ipynb (requires tensorflow). 57 | 58 | **Visualization** 59 | For visualization see the README under code/visualiation. You can use a saved checkpoint of the model which is located in data/working, also a single sgf file which is located in data/sgf_files. 60 | ##Third party libraries/software used 61 | * Modified some code from [kgsgo-dataset-preprocessor](https://github.com/hughperkins/kgsgo-dataset-preprocessor) to do data munging. 62 | * [gomill](https://github.com/mattheww/gomill) 63 | * [gnugo](https://www.gnu.org/software/gnugo/) 64 | * [tensorflow](https://www.tensorflow.org/) 65 | * [gogui](http://gogui.sourceforge.net/) 66 | 67 | 68 | ##Todo 69 | 70 | 71 | 1. Streamline the install and munging phase so it is easier to replicate on new machines. Currently you will have to fight a lot of dependencies from a fresh clone. 72 | 2. Find work around for the issue where GNU-go sometimes gets stuck in infinite loop when removing dead stones (currently I have to delete the bad sgf file and restart go_dataset_preprocessor.py). 73 | 3. Try additional features such as previous moves, turns since move was played. 74 | 4. Try different size model architectures. 75 | 5. Compare model with existing score evaluation programs. 76 | 77 | 78 | > Written with [StackEdit](https://stackedit.io/). 79 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/__init__.py -------------------------------------------------------------------------------- /board_evaluation/evaluate_trained_model.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 28, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [ 10 | { 11 | "data": { 12 | "text/plain": [ 13 | "" 14 | ] 15 | }, 16 | "execution_count": 28, 17 | "metadata": {}, 18 | "output_type": "execute_result" 19 | } 20 | ], 21 | "source": [ 22 | "import tensorflow as tf\n", 23 | "import os\n", 24 | "import sys\n", 25 | "import go_datafile_reader\n", 26 | "import model\n", 27 | "import numpy as np\n", 28 | "import model_eval\n", 29 | "reload(model)\n", 30 | "reload(go_datafile_reader)\n", 31 | "reload(model_eval)" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 2, 37 | "metadata": { 38 | "collapsed": true 39 | }, 40 | "outputs": [], 41 | "source": [ 42 | "train_dir = \"/home/justin/Programming/GoAI/MovePredictionCNN/data/input/train\"\n", 43 | "test_dir = \"/home/justin/Programming/GoAI/MovePredictionCNN/data/input/test\"\n", 44 | "ckpt_path = \"/home/justin/Programming/GoAI/MovePredictionCNN/data/working/board_eval_cnn_5layer.ckpt\"" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 3, 50 | "metadata": { 51 | "collapsed": false 52 | }, 53 | "outputs": [ 54 | { 55 | "name": "stdout", 56 | "output_type": "stream", 57 | "text": [ 58 | "num train: 14724, num test: 149\n" 59 | ] 60 | } 61 | ], 62 | "source": [ 63 | "train_files = []\n", 64 | "for subdir, dirs, files in os.walk(train_dir):\n", 65 | " for file in files:\n", 66 | " filepath = subdir + os.sep + file\n", 67 | " if filepath.endswith(\".dat\"):\n", 68 | " train_files.append(filepath)\n", 69 | "\n", 70 | "test_files = []\n", 71 | "for subdir, dirs, files in os.walk(test_dir):\n", 72 | " for file in files:\n", 73 | " filepath = subdir + os.sep + file\n", 74 | " if filepath.endswith(\".dat\"):\n", 75 | " test_files.append(filepath)\n", 76 | "\n", 77 | "print \"num train: %d, num test: %d\" %(len(train_files), len(test_files))" 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": 4, 83 | "metadata": { 84 | "collapsed": false 85 | }, 86 | "outputs": [], 87 | "source": [ 88 | "#note you may have to change the os limit for number of open files to use the RandomAccessFileReader\n", 89 | "#you can do this with the command \"sudo ulimit -n 20000\"\n", 90 | "#if sudo can't find the ulimit command try the following below\n", 91 | "#sudo sh -c \"ulimit -n 20000 && exec su $LOGNAME\"\n", 92 | "\n", 93 | "#reader = go_datafile_reader.RandomAccessFileReader(train_files)\n", 94 | "test_reader = go_datafile_reader.GoDatafileReader(test_files)\n", 95 | "\n", 96 | "test_reader.num_epochs = 0\n", 97 | "test_features = []\n", 98 | "test_targets = []\n", 99 | "test_move_numbers = []\n", 100 | "while(test_reader.num_epochs == 0):\n", 101 | " final_state, _, feature_cube = test_reader.read_sample()\n", 102 | " test_move_numbers.append(test_reader.move_index)\n", 103 | " test_features.append(feature_cube)\n", 104 | " test_targets.append(final_state)" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": 5, 110 | "metadata": { 111 | "collapsed": false 112 | }, 113 | "outputs": [], 114 | "source": [ 115 | "x, ownership = model.place_holders()\n", 116 | "y_conv = model.model(x)\n", 117 | "loss = model.loss_function(ownership, y_conv)\n", 118 | "train_op = model.train_step(loss)\n", 119 | "\n", 120 | "prediction = tf.round(y_conv)\n", 121 | "correct_prediction = tf.equal(ownership, prediction)\n", 122 | "correct_count = tf.reduce_sum(tf.cast(correct_prediction, \"float\"))\n", 123 | "accuracy = tf.reduce_mean(tf.cast(correct_prediction, \"float\"))\n", 124 | "\n", 125 | "sess = tf.InteractiveSession()\n", 126 | "sess.run(tf.initialize_all_variables())\n", 127 | "saver = tf.train.Saver(tf.all_variables())\n", 128 | "saver.restore(sess, ckpt_path)" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": 6, 134 | "metadata": { 135 | "collapsed": true 136 | }, 137 | "outputs": [], 138 | "source": [ 139 | "import matplotlib.pyplot as plt\n", 140 | "import numpy as np" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": 19, 146 | "metadata": { 147 | "collapsed": false 148 | }, 149 | "outputs": [ 150 | { 151 | "name": "stdout", 152 | "output_type": "stream", 153 | "text": [ 154 | "0\n", 155 | "500\n", 156 | "1000\n", 157 | "1500\n", 158 | "2000\n", 159 | "2500\n", 160 | "3000\n", 161 | "3500\n", 162 | "4000\n", 163 | "4500\n", 164 | "5000\n", 165 | "5500\n", 166 | "6000\n", 167 | "6500\n", 168 | "7000\n", 169 | "7500\n", 170 | "8000\n", 171 | "8500\n", 172 | "9000\n", 173 | "9500\n", 174 | "10000\n", 175 | "10500\n", 176 | "11000\n", 177 | "11500\n", 178 | "12000\n", 179 | "12500\n", 180 | "13000\n", 181 | "13500\n", 182 | "14000\n", 183 | "14500\n", 184 | "15000\n", 185 | "15500\n", 186 | "16000\n", 187 | "16500\n", 188 | "17000\n", 189 | "17500\n", 190 | "18000\n", 191 | "18500\n", 192 | "19000\n", 193 | "19500\n", 194 | "20000\n", 195 | "20500\n", 196 | "21000\n", 197 | "21500\n", 198 | "22000\n", 199 | "22500\n", 200 | "23000\n", 201 | "23500\n", 202 | "24000\n", 203 | "24500\n", 204 | "25000\n", 205 | "25500\n", 206 | "26000\n", 207 | "26500\n", 208 | "27000\n", 209 | "27500\n", 210 | "28000\n", 211 | "28500\n", 212 | "29000\n", 213 | "29500\n", 214 | "30000\n", 215 | "30500\n", 216 | "31000\n", 217 | "31500\n", 218 | "32000\n", 219 | "32500\n", 220 | "33000\n", 221 | "33500\n", 222 | "34000\n", 223 | "34500\n", 224 | "35000\n", 225 | "35500\n", 226 | "36000\n", 227 | "36500\n", 228 | "37000\n", 229 | "37500\n", 230 | "38000\n", 231 | "38500\n", 232 | "39000\n", 233 | "39500\n" 234 | ] 235 | } 236 | ], 237 | "source": [ 238 | "accuracies = []\n", 239 | "y_trues = []\n", 240 | "y_vals = []\n", 241 | "y_preds = []\n", 242 | "feature_cubes = []\n", 243 | "for i in xrange(len(test_features)):\n", 244 | " if i%500 == 0:\n", 245 | " print i\n", 246 | " x_, y_ = test_features[i], test_targets[i]\n", 247 | " y_val, y_pred, acc = sess.run([y_conv, prediction, accuracy], feed_dict={x:[x_], ownership:[y_]})\n", 248 | " accuracies.append(acc)\n", 249 | " y_trues.append(np.reshape(y_, [19,19]))\n", 250 | " y_preds.append(np.reshape(y_pred[0], [19,19]))\n", 251 | " y_vals.append(np.reshape(y_val[0], [19,19]))\n", 252 | " feature_cubes.append(x_)" 253 | ] 254 | }, 255 | { 256 | "cell_type": "code", 257 | "execution_count": 41, 258 | "metadata": { 259 | "collapsed": false 260 | }, 261 | "outputs": [ 262 | { 263 | "name": "stdout", 264 | "output_type": "stream", 265 | "text": [ 266 | "161 0.822715\n", 267 | "**************10*0* 1100000000000110001 9650000000013791106 1000000000000110000\n", 268 | "*100***000***010011 1100000000000010011 9900000000002090065 1100000000000010011\n", 269 | "*110**011000*0110** 1110000110001011010 9990000680008199064 1110000110000011001\n", 270 | "*100*0***10110*1000 1100000011011001000 9900102579099029002 1100000111011001000\n", 271 | "**1**100111**01*111 1111010011110011111 9995491199994099999 1110110011110011111\n", 272 | "1*1*01110*1*111*1** 1111011111111110101 9996099999999993948 1110011111111111111\n", 273 | "*10*0**010*****0*0* 0100000011111100100 4901054099999640813 1100010011111011111\n", 274 | "*00****011111***0** 0000000011111100000 3002234099999551001 0000001011111011011\n", 275 | "*******0011000***** 0000001001100000000 0123445009900032100 0000011001100011000\n", 276 | "**0******00*****00* 0001010000000000000 0005465200013543002 0000001100000000000\n", 277 | "*011************01* 0011010000000101010 0099463223443556093 0011011001000010011\n", 278 | "**01**00*******11*1 0001000010000111111 1009441155555569999 0001110011001011111\n", 279 | "*001***11******1010 0001110111110101111 2009764996665549999 0001000111011001111\n", 280 | "*01********1***1*1* 1011111111110001111 5099876998794449999 0011001111110011111\n", 281 | "*1*111******0*0*1** 1111111111100000111 7999999999951303999 0111111111110001111\n", 282 | "*1*01011******01*** 1110101111111001111 9981909999976409999 1110101111100101111\n", 283 | "*10*00*011111*01*** 1100001011111101111 9912007099999609888 1100001011111101111\n", 284 | "*110***00*000*001** 1110000001000000101 9990000008000100947 1110000001000000111\n", 285 | "****************0** 1111000000000000000 9995000011100001014 1100000000000001111\n" 286 | ] 287 | } 288 | ], 289 | "source": [ 290 | "idx = 160\n", 291 | "y_pred = y_preds[idx]\n", 292 | "y_true = y_trues[idx]\n", 293 | "y_val = y_vals[idx]\n", 294 | "feature_cube = feature_cubes[idx]\n", 295 | "\n", 296 | "print test_move_numbers[idx], accuracies[idx]\n", 297 | "model_eval.print_info(feature_cube, y_pred, y_val,y_true)\n", 298 | "\n", 299 | " " 300 | ] 301 | }, 302 | { 303 | "cell_type": "code", 304 | "execution_count": 9, 305 | "metadata": { 306 | "collapsed": true 307 | }, 308 | "outputs": [], 309 | "source": [ 310 | "import pandas as pd" 311 | ] 312 | }, 313 | { 314 | "cell_type": "code", 315 | "execution_count": 10, 316 | "metadata": { 317 | "collapsed": true 318 | }, 319 | "outputs": [], 320 | "source": [ 321 | "df = pd.DataFrame()\n", 322 | "df[\"Move Num\"] = test_move_numbers\n", 323 | "df[\"Accuracy\"] = accuracies\n", 324 | "grouped = df.groupby(\"Move Num\").aggregate(np.mean)\n" 325 | ] 326 | }, 327 | { 328 | "cell_type": "code", 329 | "execution_count": 16, 330 | "metadata": { 331 | "collapsed": false 332 | }, 333 | "outputs": [], 334 | "source": [ 335 | "grouped.plot()\n", 336 | "plt.title(\"Accuracy by move number, 5layer 64filters\")\n", 337 | "plt.xlabel(\"Move Number\")\n", 338 | "plt.ylabel(\"Accuracy\")\n", 339 | "plt.show()" 340 | ] 341 | }, 342 | { 343 | "cell_type": "code", 344 | "execution_count": 17, 345 | "metadata": { 346 | "collapsed": false 347 | }, 348 | "outputs": [], 349 | "source": [ 350 | "plot = plt.hist(df[df[\"Move Num\"] == 250][\"Accuracy\"].values, bins = 40)\n", 351 | "plt.title(\"Move 250 accuracy histogram, 5layer 64filters\")\n", 352 | "plt.xlabel(\"Accuracy\")\n", 353 | "plt.ylabel(\"Frequency\")\n", 354 | "plt.show()" 355 | ] 356 | }, 357 | { 358 | "cell_type": "code", 359 | "execution_count": 15, 360 | "metadata": { 361 | "collapsed": false 362 | }, 363 | "outputs": [ 364 | { 365 | "name": "stdout", 366 | "output_type": "stream", 367 | "text": [ 368 | "60\n" 369 | ] 370 | } 371 | ], 372 | "source": [ 373 | "bad_guys = df[(df[\"Move Num\"] > 200) & (df[\"Accuracy\"] < .70)]\n", 374 | "print len(bad_guys)" 375 | ] 376 | }, 377 | { 378 | "cell_type": "code", 379 | "execution_count": 32, 380 | "metadata": { 381 | "collapsed": false 382 | }, 383 | "outputs": [ 384 | { 385 | "data": { 386 | "text/html": [ 387 | "
\n", 388 | "\n", 389 | " \n", 390 | " \n", 391 | " \n", 392 | " \n", 393 | " \n", 394 | " \n", 395 | " \n", 396 | " \n", 397 | " \n", 398 | " \n", 399 | " \n", 400 | " \n", 401 | " \n", 402 | " \n", 403 | " \n", 404 | " \n", 405 | " \n", 406 | " \n", 407 | " \n", 408 | " \n", 409 | " \n", 410 | " \n", 411 | " \n", 412 | " \n", 413 | " \n", 414 | " \n", 415 | " \n", 416 | " \n", 417 | " \n", 418 | " \n", 419 | " \n", 420 | " \n", 421 | " \n", 422 | " \n", 423 | " \n", 424 | " \n", 425 | " \n", 426 | " \n", 427 | " \n", 428 | " \n", 429 | " \n", 430 | " \n", 431 | " \n", 432 | " \n", 433 | " \n", 434 | " \n", 435 | " \n", 436 | " \n", 437 | " \n", 438 | " \n", 439 | " \n", 440 | " \n", 441 | " \n", 442 | " \n", 443 | " \n", 444 | " \n", 445 | " \n", 446 | " \n", 447 | " \n", 448 | "
Move NumAccuracy
2962960.531856
5512550.578947
8012500.565097
11093080.584488
13962870.479224
16662700.562327
19342680.506925
22162820.570637
27162560.545706
30122960.487535
\n", 449 | "
" 450 | ], 451 | "text/plain": [ 452 | " Move Num Accuracy\n", 453 | "296 296 0.531856\n", 454 | "551 255 0.578947\n", 455 | "801 250 0.565097\n", 456 | "1109 308 0.584488\n", 457 | "1396 287 0.479224\n", 458 | "1666 270 0.562327\n", 459 | "1934 268 0.506925\n", 460 | "2216 282 0.570637\n", 461 | "2716 256 0.545706\n", 462 | "3012 296 0.487535" 463 | ] 464 | }, 465 | "execution_count": 32, 466 | "metadata": {}, 467 | "output_type": "execute_result" 468 | } 469 | ], 470 | "source": [ 471 | "bad_guys[:10]" 472 | ] 473 | }, 474 | { 475 | "cell_type": "code", 476 | "execution_count": null, 477 | "metadata": { 478 | "collapsed": true 479 | }, 480 | "outputs": [], 481 | "source": [] 482 | } 483 | ], 484 | "metadata": { 485 | "kernelspec": { 486 | "display_name": "Python 2", 487 | "language": "python", 488 | "name": "python2" 489 | }, 490 | "language_info": { 491 | "codemirror_mode": { 492 | "name": "ipython", 493 | "version": 2 494 | }, 495 | "file_extension": ".py", 496 | "mimetype": "text/x-python", 497 | "name": "python", 498 | "nbconvert_exporter": "python", 499 | "pygments_lexer": "ipython2", 500 | "version": "2.7.10" 501 | } 502 | }, 503 | "nbformat": 4, 504 | "nbformat_minor": 0 505 | } 506 | -------------------------------------------------------------------------------- /board_evaluation/go_datafile_reader.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import random 3 | 4 | #number of bytes in a single sample in a data file 5 | #2 bytes = "GO" for data sync 6 | #2 bytes for row, col of target move 7 | #46 bytes for the final ownership (where the final board is binary and flattened into consecutive bits) 8 | # this gives ceiling(19*19 / 8) = 46 bytes 9 | #19*19 bytes giving the features of the current board state, with piece liberties, ko position, and an all 1s bit pos 10 | NUM_BYTES_IN_SAMPLE = 2 + 1 + 1 + 46 + 19*19 11 | 12 | def _read_sequence(datafile, num_bits): 13 | bits_read = 0 14 | bit_pos = 256 15 | this_byte = 0 16 | sequence = np.zeros(num_bits) 17 | while(bits_read < num_bits): 18 | if bit_pos >= 256: 19 | bit_pos = 1 20 | this_byte = ord(datafile.read(1)) 21 | #print this_byte 22 | #if not this_byte: 23 | # raise EOFError("At the end of the file") 24 | if this_byte&bit_pos != 0: 25 | sequence[bits_read] = 1.0 26 | else: 27 | sequence[bits_read] = 0.0 28 | bit_pos *=2 29 | bits_read +=1 30 | return sequence 31 | 32 | class RandomAccessFileReader: 33 | def __init__(self, datafiles, board_size = 19): 34 | self.datafiles = datafiles 35 | assert(len(self.datafiles) != 0) 36 | self.num_epochs = 0 37 | self.index_of_file = 0 38 | self.board_size = board_size 39 | self.samples_read = 0 40 | 41 | self.open_files = [] 42 | print "Initializing pointers in %d datafiles, this may take a few minutes" %len(self.datafiles) 43 | for f in self.datafiles: 44 | file_obj = open(f, "rb") 45 | self._seek_random_place_in_file(file_obj) 46 | self.open_files.append(file_obj) 47 | 48 | def __del__(self): 49 | for f in self.open_files: 50 | f.close() 51 | 52 | #use resevoir sampling to pick a uniform random sample from the file of unknown number of samples 53 | @staticmethod 54 | def _seek_random_place_in_file(file_obj): 55 | file_pos = file_obj.tell() 56 | count = 1 57 | while True: 58 | temp_pos = file_obj.tell() 59 | sample_bytes = file_obj.read(NUM_BYTES_IN_SAMPLE) 60 | if len(sample_bytes) == 0: 61 | break 62 | assert(sample_bytes[:2] == "GO") 63 | if random.randint(1,count) == 1: 64 | file_pos = temp_pos 65 | count+=1 66 | file_obj.seek(file_pos,0) 67 | 68 | #read the next feature cube from the binary file. Note this will increment the position in the file. 69 | #This function assumes the bytes 'GO' and the target bytes have already been read 70 | def _get_feature_cube(self, file_obj): 71 | feature_cube = np.zeros((self.board_size,self.board_size,8)) 72 | for i in xrange(self.board_size): 73 | for j in xrange(self.board_size): 74 | feature_byte = ord(file_obj.read(1)) 75 | for k in xrange(8): 76 | feature_cube[i][j][k] = ((feature_byte >> k) & 1) 77 | assert(((feature_byte >> 7) &1) == 1) 78 | return feature_cube 79 | 80 | def read_sample_from_random_file(self): 81 | file_to_read_from = random.choice(self.open_files) 82 | go_byte = file_to_read_from.read(2) 83 | if len(go_byte) == 0: #at the end of the file, open next one in queue 84 | #print "END OF FILE!!!!" 85 | file_to_read_from.seek(0,0) 86 | go_byte = file_to_read_from.read(2) 87 | assert(go_byte == "GO") 88 | 89 | row = ord(file_to_read_from.read(1)) 90 | col = ord(file_to_read_from.read(1)) 91 | 92 | final_state = _read_sequence(file_to_read_from, self.board_size**2) 93 | feature_cube = self._get_feature_cube(file_to_read_from) 94 | return final_state, (row, col), feature_cube 95 | 96 | def get_batch(self, batch_size = 50): 97 | final_states = [] 98 | feature_cubes = [] 99 | for i in xrange(batch_size): 100 | final_state, _, feature_cube = self.read_sample_from_random_file() 101 | final_states.append(final_state) 102 | feature_cubes.append(feature_cube) 103 | 104 | return feature_cubes, final_states 105 | 106 | class GoDatafileReader: 107 | def __init__(self, datafiles, board_size = 19): 108 | self.datafiles = datafiles 109 | assert(len(self.datafiles) != 0) 110 | self.num_epochs = 0 111 | self.index_of_file = 0 112 | self.move_index = 0 113 | self.board_size = board_size 114 | self.samples_read = 0 115 | self.current_file = open(self.datafiles[self.index_of_file], "rb") 116 | 117 | def open_next_file(self): 118 | self.index_of_file+=1 119 | if self.index_of_file >= len(self.datafiles): 120 | self.num_epochs+=1 121 | self.index_of_file = 0 122 | self.current_file.close() 123 | self.current_file = open(self.datafiles[self.index_of_file], "rb") 124 | self.move_index = 0 125 | 126 | #read the next feature cube from the binary file. Note this will increment the position in the file. 127 | #This function assumes the bytes 'GO' and the target bytes have already been read 128 | def _get_feature_cube(self): 129 | feature_cube = np.zeros((self.board_size,self.board_size,8)) 130 | for i in xrange(self.board_size): 131 | for j in xrange(self.board_size): 132 | feature_byte = ord(self.current_file.read(1)) 133 | for k in xrange(8): 134 | feature_cube[i][j][k] = ((feature_byte >> k) & 1) 135 | assert(((feature_byte >> 7) &1) == 1) 136 | return feature_cube 137 | 138 | def read_sample(self): 139 | go_byte = self.current_file.read(2) 140 | if len(go_byte) == 0: #at the end of the file, open next one in queue 141 | #print "END OF FILE!!!!" 142 | self.open_next_file() 143 | go_byte = self.current_file.read(2) 144 | assert(go_byte == "GO") 145 | 146 | row = ord(self.current_file.read(1)) 147 | col = ord(self.current_file.read(1)) 148 | 149 | final_state = _read_sequence(self.current_file, self.board_size**2) 150 | #final_state = final_state.reshape((19,19)) 151 | 152 | feature_cube = self._get_feature_cube() 153 | self.move_index+=1 154 | return final_state, (row, col), feature_cube 155 | 156 | class BatchAggregator: 157 | def __init__(self, go_file_reader, mega_batch_size = 10000): 158 | self.go_file_reader = go_file_reader 159 | self.mega_batch_x = [] 160 | self.mega_batch_y = [] 161 | self.mega_batch_size = mega_batch_size 162 | self.index_in_mega_batch = mega_batch_size 163 | 164 | def init_mega_batch(self): 165 | self.mega_batch_x = [] 166 | self.mega_batch_y = [] 167 | for i in xrange(self.mega_batch_size): 168 | final_state, _, feature_cube = self.go_file_reader.read_sample() 169 | self.mega_batch_x.append(feature_cube) 170 | self.mega_batch_y.append(final_state) 171 | #jointly permute the features and the targets 172 | permutation = np.random.permutation(self.mega_batch_size) 173 | self.mega_batch_x = [self.mega_batch_x[i] for i in permutation] 174 | self.mega_batch_y = [self.mega_batch_y[i] for i in permutation] 175 | self.index_in_mega_batch = 0 176 | def get_batch(self, batch_size): 177 | if batch_size > self.mega_batch_size: 178 | raise ValueError('batch_size cannot be bigger than mega_batch_size') 179 | if self.index_in_mega_batch + batch_size > self.mega_batch_size: 180 | print "Got to end of mega batch, reinitializing..." 181 | print "Epoch = %d" %self.go_file_reader.num_epochs 182 | self.init_mega_batch() 183 | x_list = self.mega_batch_x[self.index_in_mega_batch:self.index_in_mega_batch+batch_size] 184 | y_list = self.mega_batch_y[self.index_in_mega_batch:self.index_in_mega_batch+batch_size] 185 | self.index_in_mega_batch+=batch_size 186 | return x_list, y_list 187 | -------------------------------------------------------------------------------- /board_evaluation/graphs/bad_data_mixing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/board_evaluation/graphs/bad_data_mixing.png -------------------------------------------------------------------------------- /board_evaluation/graphs/good_data_mixing5layer_64filters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/board_evaluation/graphs/good_data_mixing5layer_64filters.png -------------------------------------------------------------------------------- /board_evaluation/graphs/move_250_histogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/board_evaluation/graphs/move_250_histogram.png -------------------------------------------------------------------------------- /board_evaluation/graphs/move_accuracies_5layer_64filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/board_evaluation/graphs/move_accuracies_5layer_64filter.png -------------------------------------------------------------------------------- /board_evaluation/model.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | import numpy as np 3 | 4 | BOARD_SIZE = 19 5 | 6 | def weight_variable(shape): 7 | initial = tf.truncated_normal(shape, stddev=0.1) 8 | return tf.Variable(initial) 9 | 10 | def bias_variable(shape): 11 | initial = tf.constant(0.1, shape=shape) 12 | return tf.Variable(initial) 13 | 14 | def conv2d(x, W): 15 | return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') 16 | 17 | def place_holders(): 18 | x = tf.placeholder("float", shape=[None, BOARD_SIZE, BOARD_SIZE , 8]) 19 | ownership = tf.placeholder("float", shape=[None, BOARD_SIZE**2]) 20 | return x, ownership 21 | def model(x): 22 | 23 | x_board = tf.reshape(x, [-1, BOARD_SIZE, BOARD_SIZE, 8]) 24 | W_conv1 = weight_variable([5, 5, 8, 64]) 25 | b_conv1 = bias_variable([64]) 26 | h_conv1 = tf.nn.relu(conv2d(x_board, W_conv1) + b_conv1) 27 | 28 | W_conv2 = weight_variable([5, 5, 64, 64]) 29 | b_conv2 = bias_variable([64]) 30 | h_conv2 = tf.nn.relu(conv2d(h_conv1, W_conv2) + b_conv2) 31 | 32 | W_conv3 = weight_variable([5, 5, 64, 64]) 33 | b_conv3 = bias_variable([64]) 34 | h_conv3 = tf.nn.relu(conv2d(h_conv2, W_conv3) + b_conv3) 35 | 36 | W_conv4 = weight_variable([5, 5, 64, 48]) 37 | b_conv4 = bias_variable([48]) 38 | h_conv4 = tf.nn.relu(conv2d(h_conv3, W_conv4) + b_conv4) 39 | 40 | W_conv5 = weight_variable([5, 5, 48, 48]) 41 | b_conv5 = bias_variable([48]) 42 | h_conv5 = tf.nn.relu(conv2d(h_conv4, W_conv5) + b_conv5) 43 | 44 | # Final outputs from layer 5 45 | W_convm5 = weight_variable([5, 5, 48, 1]) 46 | b_convm5 = bias_variable([1]) 47 | h_convm5 = conv2d(h_conv5, W_convm5) + b_convm5 48 | 49 | pred_ownership = tf.sigmoid(tf.reshape(h_convm5, [-1, BOARD_SIZE**2])) 50 | return pred_ownership 51 | 52 | def loss_function(y_pred, y_true): 53 | loss = tf.reduce_mean(tf.pow(y_pred - y_true, 2)) 54 | return loss 55 | 56 | def train_step(loss): 57 | return tf.train.AdamOptimizer(1e-4).minimize(loss) 58 | 59 | -------------------------------------------------------------------------------- /board_evaluation/model_eval.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | from . import go_datafile_reader 3 | 4 | #Visual the outputs of the model. 5 | #Feature_cube: the x input of model, currently assumes first 6 planes are board position features 6 | #y_pred: 19x19 matrix of thresholded prediction of final board ownership 7 | #y_val: 19x19 matrix of probabilities output by model 8 | #y_true: 19x19 matrix of true board ownership 9 | def print_info(feature_cube = None, y_pred = None, y_val = None, y_true = None): 10 | for i in xrange(19): 11 | current_row = "" 12 | if not feature_cube is None: 13 | for j in xrange(19): 14 | b_sum = feature_cube[i][j][0] + feature_cube[i][j][1] + feature_cube[i][j][2] 15 | w_sum = feature_cube[i][j][3] + feature_cube[i][j][4] + feature_cube[i][j][5] 16 | if b_sum > 0: 17 | current_row += '1' 18 | elif w_sum > 0: 19 | current_row += '0' 20 | else: 21 | current_row += '*' 22 | current_row += " " 23 | if not y_pred is None: 24 | for j in xrange(19): 25 | if y_pred[i][j] == 1: 26 | current_row += '1' 27 | elif y_pred[i][j] == 0: 28 | current_row += '0' 29 | else: 30 | current_row += '*' 31 | current_row += " " 32 | if not y_val is None: 33 | for j in xrange(19): 34 | val = round(10*y_val[i][j]) 35 | if val >=10: 36 | val = 9 37 | current_row+= "%d" %val 38 | current_row += " " 39 | if not y_true is None: 40 | for j in xrange(19): 41 | if y_true[i][j] == 1: 42 | current_row += '1' 43 | elif y_true[i][j] == 0: 44 | current_row += '0' 45 | else: 46 | current_row += '*' 47 | print current_row 48 | 49 | def test_accuracy(features, targets, x, ownership, count_correct_op, BOARD_SIZE = 19): 50 | 51 | #I get a memory error when tf tries to feed the whole test set into my GPU, so we will do it in batches 52 | BATCH_SIZE = 100 53 | NUM_SAMPLES = len(features) 54 | batch_idx = 0 55 | 56 | num_correct = 0 57 | while batch_idx < NUM_SAMPLES: 58 | x_ = features[batch_idx:batch_idx+BATCH_SIZE] 59 | y_ = targets[batch_idx:batch_idx+BATCH_SIZE] 60 | num_correct += count_correct_op.eval(feed_dict = {x:x_, ownership:y_}) 61 | batch_idx += BATCH_SIZE 62 | return float(num_correct)/ float(NUM_SAMPLES * BOARD_SIZE * BOARD_SIZE) -------------------------------------------------------------------------------- /board_evaluation/model_util.py: -------------------------------------------------------------------------------- 1 | def print_info(feature_cube, y_pred, y_true): 2 | for i in xrange(19): 3 | current_row = "" 4 | for j in xrange(19): 5 | b_sum = feature_cube[i][j][0] + feature_cube[i][j][1] + feature_cube[i][j][2] 6 | w_sum = feature_cube[i][j][3] + feature_cube[i][j][4] + feature_cube[i][j][5] 7 | if b_sum > 0: 8 | current_row += '1' 9 | elif w_sum > 0: 10 | current_row += '0' 11 | else: 12 | current_row += '*' 13 | current_row += " " 14 | for j in xrange(19): 15 | if y_pred[i][j] == 1: 16 | current_row += '1' 17 | elif y_pred[i][j] == 0: 18 | current_row += '0' 19 | else: 20 | current_row += '*' 21 | current_row += " " 22 | for j in xrange(19): 23 | if y_true[i][j] == 1: 24 | current_row += '1' 25 | elif y_true[i][j] == 0: 26 | current_row += '0' 27 | else: 28 | current_row += '*' 29 | print current_row 30 | -------------------------------------------------------------------------------- /board_evaluation/train.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [ 10 | { 11 | "data": { 12 | "text/plain": [ 13 | "" 14 | ] 15 | }, 16 | "execution_count": 1, 17 | "metadata": {}, 18 | "output_type": "execute_result" 19 | } 20 | ], 21 | "source": [ 22 | "import tensorflow as tf\n", 23 | "import os\n", 24 | "import sys\n", 25 | "import go_datafile_reader\n", 26 | "import model\n", 27 | "import numpy as np\n", 28 | "import model_eval\n", 29 | "reload(model)\n", 30 | "reload(go_datafile_reader)\n", 31 | "reload(model_eval)" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 2, 37 | "metadata": { 38 | "collapsed": true 39 | }, 40 | "outputs": [], 41 | "source": [ 42 | "train_dir = \"/home/justin/Programming/GoAI/MovePredictionCNN/data/input/train\"\n", 43 | "test_dir = \"/home/justin/Programming/GoAI/MovePredictionCNN/data/input/test\"\n", 44 | "ckpt_path = \"/home/justin/Programming/GoAI/MovePredictionCNN/data/working/board_eval_cnn_5layer.ckpt\"" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 3, 50 | "metadata": { 51 | "collapsed": false 52 | }, 53 | "outputs": [ 54 | { 55 | "name": "stdout", 56 | "output_type": "stream", 57 | "text": [ 58 | "num train: 14724, num test: 149\n" 59 | ] 60 | } 61 | ], 62 | "source": [ 63 | "train_files = []\n", 64 | "for subdir, dirs, files in os.walk(train_dir):\n", 65 | " for file in files:\n", 66 | " filepath = subdir + os.sep + file\n", 67 | " if filepath.endswith(\".dat\"):\n", 68 | " train_files.append(filepath)\n", 69 | "\n", 70 | "test_files = []\n", 71 | "for subdir, dirs, files in os.walk(test_dir):\n", 72 | " for file in files:\n", 73 | " filepath = subdir + os.sep + file\n", 74 | " if filepath.endswith(\".dat\"):\n", 75 | " test_files.append(filepath)\n", 76 | "\n", 77 | "print \"num train: %d, num test: %d\" %(len(train_files), len(test_files))" 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": 4, 83 | "metadata": { 84 | "collapsed": false 85 | }, 86 | "outputs": [ 87 | { 88 | "name": "stdout", 89 | "output_type": "stream", 90 | "text": [ 91 | "Initializing pointers in 14724 datafiles, this may take a few minutes\n" 92 | ] 93 | } 94 | ], 95 | "source": [ 96 | "#note you may have to change the os limit for number of open files to use the RandomAccessFileReader\n", 97 | "#you can do this with the command \"sudo ulimit -n 20000\"\n", 98 | "#if sudo can't find the ulimit command try the following below\n", 99 | "#sudo sh -c \"ulimit -n 20000 && exec su $LOGNAME\"\n", 100 | "\n", 101 | "reader = go_datafile_reader.RandomAccessFileReader(train_files)\n", 102 | "test_reader = go_datafile_reader.GoDatafileReader(test_files)\n", 103 | "\n", 104 | "test_reader.num_epochs = 0\n", 105 | "test_features = []\n", 106 | "test_targets = []\n", 107 | "test_move_numbers = []\n", 108 | "while(test_reader.num_epochs == 0):\n", 109 | " test_move_numbers.append(test_reader.move_index)\n", 110 | " final_state, _, feature_cube = test_reader.read_sample()\n", 111 | " test_features.append(feature_cube)\n", 112 | " test_targets.append(final_state)" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 5, 118 | "metadata": { 119 | "collapsed": false 120 | }, 121 | "outputs": [ 122 | { 123 | "name": "stdout", 124 | "output_type": "stream", 125 | "text": [ 126 | "14724\n" 127 | ] 128 | } 129 | ], 130 | "source": [ 131 | "print len(reader.open_files)" 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": 6, 137 | "metadata": { 138 | "collapsed": false 139 | }, 140 | "outputs": [], 141 | "source": [ 142 | "x, ownership = model.place_holders()\n", 143 | "y_conv = model.model(x)\n", 144 | "loss = model.loss_function(ownership, y_conv)\n", 145 | "train_op = model.train_step(loss)\n", 146 | "\n", 147 | "prediction = tf.round(y_conv)\n", 148 | "correct_prediction = tf.equal(ownership, prediction)\n", 149 | "correct_count = tf.reduce_sum(tf.cast(correct_prediction, \"float\"))\n", 150 | "accuracy = tf.reduce_mean(tf.cast(correct_prediction, \"float\"))\n", 151 | "\n", 152 | "sess = tf.InteractiveSession()\n", 153 | "sess.run(tf.initialize_all_variables())\n", 154 | "saver = tf.train.Saver(tf.all_variables())\n", 155 | "saver.restore(sess, ckpt_path)" 156 | ] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": 40, 161 | "metadata": { 162 | "collapsed": false 163 | }, 164 | "outputs": [ 165 | { 166 | "name": "stdout", 167 | "output_type": "stream", 168 | "text": [ 169 | "0 0.104419 0.830305\n", 170 | "Test accuracy: 0.797925\n", 171 | "Saving Checkpoint...\n", 172 | "10 0.127818 0.78892\n", 173 | "20 0.128529 0.787922\n", 174 | "30 0.109889 0.819723\n", 175 | "40 0.106385 0.834848\n", 176 | "50 0.137336 0.775069\n", 177 | "60 0.106356 0.829086\n", 178 | "70 0.101814 0.835125\n", 179 | "80 0.0970651 0.843989\n", 180 | "90 0.123086 0.794571\n", 181 | "100 0.107515 0.826537\n", 182 | "110 0.11917 0.807645\n", 183 | "120 0.113948 0.817507\n", 184 | "130 0.118163 0.80964\n", 185 | "140 0.107079 0.832299\n", 186 | "150 0.115182 0.808476\n", 187 | "160 0.109975 0.821607\n", 188 | "170 0.117739 0.811247\n", 189 | "180 0.135597 0.768366\n", 190 | "190 0.116383 0.805706\n", 191 | "200 0.129871 0.787313\n", 192 | "210 0.116119 0.811579\n", 193 | "220 0.114238 0.812078\n", 194 | "230 0.110486 0.812964\n", 195 | "240 0.117634 0.808698\n", 196 | "250 0.128708 0.788532\n", 197 | "260 0.110861 0.821108\n", 198 | "270 0.110346 0.820831\n", 199 | "280 0.136241 0.777839\n", 200 | "290 0.106398 0.827535\n", 201 | "300 0.130055 0.781884\n", 202 | "310 0.13241 0.783601\n", 203 | "320 0.121305 0.796731\n", 204 | "330 0.0996772 0.837895\n", 205 | "340 0.0980423 0.841496\n", 206 | "350 0.113413 0.813296\n", 207 | "360 0.11084 0.82\n", 208 | "370 0.125082 0.798283\n", 209 | "380 0.0959454 0.845651\n", 210 | "390 0.111209 0.825097\n", 211 | "400 0.119706 0.81313\n", 212 | "410 0.114027 0.81446\n", 213 | "420 0.122607 0.796344\n", 214 | "430 0.10089 0.837452\n", 215 | "440 0.107323 0.828476\n", 216 | "450 0.111642 0.815291\n", 217 | "460 0.128331 0.787701\n", 218 | "470 0.124285 0.800554\n", 219 | "480 0.0984987 0.844377\n", 220 | "490 0.123039 0.796288\n", 221 | "500 0.119654 0.803269\n", 222 | "510 0.114512 0.813352\n", 223 | "520 0.111316 0.816288\n", 224 | "530 0.121692 0.802493\n", 225 | "540 0.113004 0.80892\n", 226 | "550 0.120041 0.799114\n", 227 | "560 0.130234 0.787922\n", 228 | "570 0.135629 0.775845\n", 229 | "580 0.108104 0.825152\n", 230 | "590 0.138526 0.77036\n", 231 | "600 0.116963 0.80554\n", 232 | "610 0.128223 0.792576\n", 233 | "620 0.117545 0.814183\n", 234 | "630 0.12671 0.791413\n", 235 | "640 0.128059 0.793296\n", 236 | "650 0.104755 0.833186\n", 237 | "660 0.122676 0.796233\n", 238 | "670 0.111422 0.818781\n", 239 | "680 0.12544 0.791247\n", 240 | "690 0.117317 0.805429\n", 241 | "700 0.101157 0.842105\n", 242 | "710 0.133048 0.782438\n", 243 | "720 0.122071 0.798172\n", 244 | "730 0.100538 0.842881\n", 245 | "740 0.122081 0.798172\n", 246 | "750 0.118927 0.812632\n", 247 | "760 0.118758 0.81108\n", 248 | "770 0.121482 0.803767\n", 249 | "780 0.109994 0.824986\n", 250 | "790 0.137539 0.771025\n", 251 | "800 0.128912 0.788199\n", 252 | "810 0.126571 0.796177\n", 253 | "820 0.108715 0.823601\n", 254 | "830 0.105315 0.834404\n", 255 | "840 0.106031 0.826814\n", 256 | "850 0.120924 0.803767\n", 257 | "860 0.107119 0.828587\n", 258 | "870 0.138559 0.768698\n", 259 | "880 0.108746 0.826925\n", 260 | "890 0.114275 0.815956\n", 261 | "900 0.125278 0.797175\n", 262 | "910 0.113365 0.817064\n", 263 | "920 0.107208 0.827368\n", 264 | "930 0.119531 0.805042\n", 265 | "940 0.117342 0.808089\n", 266 | "950 0.111265 0.822216\n", 267 | "960 0.107934 0.831357\n", 268 | "970 0.117324 0.810471\n", 269 | "980 0.11956 0.800665\n", 270 | "990 0.136344 0.777839\n", 271 | "1000 0.138076 0.765263\n", 272 | "Test accuracy: 0.800108\n", 273 | "Saving Checkpoint...\n", 274 | "1010 0.111448 0.81518\n", 275 | "1020 0.113708 0.817452\n", 276 | "1030 0.120712 0.806094\n", 277 | "1040 0.118647 0.809751\n", 278 | "1050 0.113908 0.810637\n", 279 | "1060 0.140771 0.76759\n", 280 | "1070 0.132044 0.777895\n", 281 | "1080 0.113681 0.814294\n", 282 | "1090 0.124388 0.798116\n", 283 | "1100 0.113067 0.816177\n", 284 | "1110 0.121914 0.79662\n", 285 | "1120 0.0992979 0.841385\n", 286 | "1130 0.128405 0.78482\n", 287 | "1140 0.115765 0.817562\n", 288 | "1150 0.103645 0.832742\n", 289 | "1160 0.128062 0.789086\n", 290 | "1170 0.124838 0.804488\n", 291 | "1180 0.110311 0.821773\n", 292 | "1190 0.11562 0.812022\n", 293 | "1200 0.0936222 0.846648\n", 294 | "1210 0.120904 0.798283\n", 295 | "1220 0.132591 0.782881\n", 296 | "1230 0.123283 0.804931\n", 297 | "1240 0.120846 0.805263\n", 298 | "1250 0.129723 0.78626\n", 299 | "1260 0.118249 0.80903\n", 300 | "1270 0.114303 0.810249\n", 301 | "1280 0.141945 0.766371\n", 302 | "1290 0.115157 0.807202\n", 303 | "1300 0.118153 0.812964\n", 304 | "1310 0.103993 0.833296\n", 305 | "1320 0.138571 0.770859\n", 306 | "1330 0.112144 0.814958\n", 307 | "1340 0.124899 0.8\n", 308 | "1350 0.111785 0.820166\n", 309 | "1360 0.10857 0.82277\n", 310 | "1370 0.108886 0.823213\n", 311 | "1380 0.105358 0.835069\n", 312 | "1390 0.114078 0.817784\n", 313 | "1400 0.10863 0.824654\n", 314 | "1410 0.117897 0.817341\n", 315 | "1420 0.105486 0.827535\n", 316 | "1430 0.130218 0.786593\n", 317 | "1440 0.114883 0.808864\n", 318 | "1450 0.102773 0.839834\n", 319 | "1460 0.115438 0.816011\n", 320 | "1470 0.122391 0.803158\n", 321 | "1480 0.0931436 0.852465\n", 322 | "1490 0.111478 0.818781\n", 323 | "1500 0.11611 0.814238\n", 324 | "1510 0.133553 0.782992\n", 325 | "1520 0.13035 0.782992\n", 326 | "1530 0.135585 0.782881\n", 327 | "1540 0.132784 0.778283\n", 328 | "1550 0.109232 0.820277\n", 329 | "1560 0.113089 0.822271\n", 330 | "1570 0.112577 0.814515\n", 331 | "1580 0.126764 0.791191\n", 332 | "1590 0.123391 0.797396\n", 333 | "1600 0.107805 0.828199\n", 334 | "1610 0.10907 0.825097\n", 335 | "1620 0.138092 0.769252\n", 336 | "1630 0.125589 0.800388\n", 337 | "1640 0.124715 0.788144\n", 338 | "1650 0.119873 0.80072\n", 339 | "1660 0.120038 0.804543\n", 340 | "1670 0.114235 0.818283\n", 341 | "1680 0.101423 0.839834\n", 342 | "1690 0.107964 0.824488\n", 343 | "1700 0.118647 0.804377\n", 344 | "1710 0.11625 0.812687\n", 345 | "1720 0.127407 0.792632\n", 346 | "1730 0.111497 0.821662\n", 347 | "1740 0.105458 0.828089\n", 348 | "1750 0.128516 0.794404\n", 349 | "1760 0.107619 0.826205\n", 350 | "1770 0.119983 0.802105\n", 351 | "1780 0.114556 0.820997\n", 352 | "1790 0.112638 0.818116\n", 353 | "1800 0.110684 0.820499\n", 354 | "1810 0.117662 0.809751\n", 355 | "1820 0.121942 0.801163\n", 356 | "1830 0.129718 0.792742\n", 357 | "1840 0.130291 0.787368\n", 358 | "1850 0.120776 0.799945\n", 359 | "1860 0.106423 0.828144\n", 360 | "1870 0.117504 0.807202\n", 361 | "1880 0.11061 0.822992\n", 362 | "1890 0.124792 0.795734\n", 363 | "1900 0.104124 0.83651\n", 364 | "1910 0.133676 0.780388\n", 365 | "1920 0.113907 0.814681\n", 366 | "1930 0.127846 0.791856\n", 367 | "1940 0.12089 0.804432\n", 368 | "1950 0.127679 0.793186\n", 369 | "1960 0.115839 0.809972\n", 370 | "1970 0.13274 0.784765\n", 371 | "1980 0.122327 0.795291\n", 372 | "1990 0.0878765 0.857729\n", 373 | "2000 0.1259 0.796676\n", 374 | "Test accuracy: 0.802168\n", 375 | "Saving Checkpoint...\n", 376 | "2010 0.116767 0.813019\n", 377 | "2020 0.10868 0.822438\n", 378 | "2030 0.125574 0.792133\n", 379 | "2040 0.106321 0.830582\n", 380 | "2050 0.111608 0.817784\n", 381 | "2060 0.116769 0.800222\n", 382 | "2070 0.111047 0.817174\n", 383 | "2080 0.111076 0.818947\n", 384 | "2090 0.117452 0.813296\n", 385 | "2100 0.11843 0.802493\n", 386 | "2110 0.107144 0.829751\n", 387 | "2120 0.103541 0.829751\n", 388 | "2130 0.110641 0.824709\n", 389 | "2140 0.119881 0.799612\n", 390 | "2150 0.104469 0.830471\n", 391 | "2160 0.113167 0.814183\n", 392 | "2170 0.0962785 0.843656\n", 393 | "2180 0.122921 0.800609\n", 394 | "2190 0.123411 0.802826\n", 395 | "2200 0.10982 0.817839\n", 396 | "2210 0.116251 0.812078\n", 397 | "2220 0.0941338 0.850194\n", 398 | "2230 0.112146 0.820443\n", 399 | "2240 0.122732 0.799834\n", 400 | "2250 0.0985775 0.842216\n", 401 | "2260 0.115365 0.81723\n", 402 | "2270 0.113349 0.819224\n", 403 | "2280 0.115099 0.809695\n", 404 | "2290 0.116579 0.80482\n", 405 | "2300 0.118235 0.812853\n", 406 | "2310 0.11122 0.820499\n", 407 | "2320 0.127848 0.790859\n", 408 | "2330 0.106249 0.826759\n", 409 | "2340 0.115735 0.815235\n", 410 | "2350 0.13437 0.776842\n", 411 | "2360 0.124878 0.792521\n", 412 | "2370 0.126262 0.793684\n", 413 | "2380 0.0996782 0.839557\n", 414 | "2390 0.122945 0.79867\n", 415 | "2400 0.125863 0.794515\n", 416 | "2410 0.131004 0.784211\n", 417 | "2420 0.133657 0.789307\n", 418 | "2430 0.0933902 0.85385\n", 419 | "2440 0.132532 0.780111\n", 420 | "2450 0.110817 0.827368\n", 421 | "2460 0.113216 0.815734\n", 422 | "2470 0.131207 0.787313\n", 423 | "2480 0.128976 0.79036\n", 424 | "2490 0.1323 0.783934\n", 425 | "2500 0.108408 0.819058\n", 426 | "2510 0.10534 0.834294\n", 427 | "2520 0.126315 0.797451\n", 428 | "2530 0.129745 0.787867\n", 429 | "2540 0.102657 0.834515\n", 430 | "2550 0.113751 0.817729\n", 431 | "2560 0.103246 0.831025\n", 432 | "2570 0.107954 0.830028\n", 433 | "2580 0.130933 0.783546\n", 434 | "2590 0.116236 0.817119\n", 435 | "2600 0.105442 0.830139\n", 436 | "2610 0.117645 0.809086\n", 437 | "2620 0.118665 0.806094\n", 438 | "2630 0.120372 0.805596\n", 439 | "2640 0.0893651 0.859058\n", 440 | "2650 0.110486 0.821274\n", 441 | "2660 0.123527 0.802604\n", 442 | "2670 0.117251 0.805042\n", 443 | "2680 0.117062 0.81097\n", 444 | "2690 0.119178 0.803324\n", 445 | "2700 0.112912 0.816067\n", 446 | "2710 0.108485 0.827812\n", 447 | "2720 0.125068 0.792355\n", 448 | "2730 0.1198 0.800443\n", 449 | "2740 0.110755 0.819169\n", 450 | "2750 0.118309 0.810693\n", 451 | "2760 0.105492 0.821717\n", 452 | "2770 0.127646 0.788033\n", 453 | "2780 0.110282 0.818393\n", 454 | "2790 0.0897737 0.858283\n", 455 | "2800 0.112129 0.816676\n", 456 | "2810 0.0984223 0.838726\n", 457 | "2820 0.0972547 0.845596\n", 458 | "2830 0.113156 0.823213\n", 459 | "2840 0.117864 0.807091\n", 460 | "2850 0.123039 0.798338\n", 461 | "2860 0.108256 0.818504\n", 462 | "2870 0.132752 0.773795\n", 463 | "2880 0.101077 0.836621\n", 464 | "2890 0.131177 0.786925\n", 465 | "2900 0.109419 0.822992\n", 466 | "2910 0.122186 0.806094\n", 467 | "2920 0.108598 0.821163\n", 468 | "2930 0.137341 0.774903\n", 469 | "2940 0.115242 0.80892\n", 470 | "2950 0.116792 0.803435\n", 471 | "2960 0.128761 0.789695\n", 472 | "2970 0.117077 0.81241\n", 473 | "2980 0.129808 0.787091\n", 474 | "2990 0.124182 0.793352\n", 475 | "3000 0.108835 0.821108\n", 476 | "Test accuracy: 0.803349\n", 477 | "Saving Checkpoint...\n", 478 | "3010 0.10606 0.827922\n", 479 | "3020 0.0924423 0.851634\n", 480 | "3030 0.127364 0.793684\n", 481 | "3040 0.137449 0.77723\n", 482 | "3050 0.109866 0.830194\n", 483 | "3060 0.109312 0.828587\n", 484 | "3070 0.135879 0.778172\n", 485 | "3080 0.104307 0.834515\n", 486 | "3090 0.131811 0.782659\n", 487 | "3100 0.112599 0.814404\n", 488 | "3110 0.119238 0.803047\n", 489 | "3120 0.112605 0.821662\n", 490 | "3130 0.127002 0.787036\n", 491 | "3140 0.102164 0.835291\n", 492 | "3150 0.122992 0.799612\n", 493 | "3160 0.112414 0.819169\n", 494 | "3170 0.0953398 0.846925\n", 495 | "3180 0.117806 0.805596\n", 496 | "3190 0.125725 0.796787\n", 497 | "3200 0.123652 0.796122\n", 498 | "3210 0.111723 0.820831\n", 499 | "3220 0.120705 0.80554\n", 500 | "3230 0.11621 0.80964\n", 501 | "3240 0.117786 0.810914\n", 502 | "3250 0.101663 0.841163\n", 503 | "3260 0.110869 0.819224\n", 504 | "3270 0.113858 0.817452\n", 505 | "3280 0.131345 0.787535\n", 506 | "3290 0.118386 0.810249\n", 507 | "3300 0.12942 0.780443\n", 508 | "3310 0.112043 0.817784\n", 509 | "3320 0.105038 0.830305\n", 510 | "3330 0.121934 0.794238\n", 511 | "3340 0.130987 0.783767\n", 512 | "3350 0.120279 0.804931\n", 513 | "3360 0.115094 0.812909\n", 514 | "3370 0.135751 0.776233\n", 515 | "3380 0.0958169 0.850305\n", 516 | "3390 0.115828 0.806537\n", 517 | "3400 0.120748 0.81036\n", 518 | "3410 0.107201 0.823656\n", 519 | "3420 0.115225 0.81518\n", 520 | "3430 0.108115 0.825042\n", 521 | "3440 0.114353 0.818449\n", 522 | "3450 0.122204 0.799834\n", 523 | "3460 0.120424 0.799778\n", 524 | "3470 0.0956141 0.843767\n", 525 | "3480 0.107396 0.827978\n", 526 | "3490 0.112315 0.812355\n", 527 | "3500 0.109773 0.821662\n", 528 | "3510 0.114072 0.814294\n", 529 | "3520 0.131553 0.784432\n", 530 | "3530 0.130177 0.790582\n", 531 | "3540 0.115516 0.814848\n", 532 | "3550 0.102491 0.836399\n", 533 | "3560 0.12333 0.801828\n", 534 | "3570 0.116909 0.811302\n", 535 | "3580 0.111951 0.814072\n", 536 | "3590 0.116648 0.810083\n", 537 | "3600 0.115721 0.810803\n", 538 | "3610 0.112364 0.820332\n", 539 | "3620 0.100799 0.840997\n", 540 | "3630 0.109525 0.823878\n", 541 | "3640 0.112591 0.817008\n", 542 | "3650 0.115695 0.817452\n", 543 | "3660 0.117492 0.805762\n", 544 | "3670 0.117643 0.805042\n", 545 | "3680 0.121906 0.799834\n", 546 | "3690 0.107991 0.821607\n", 547 | "3700 0.118793 0.806482\n", 548 | "3710 0.111487 0.818227\n", 549 | "3720 0.121173 0.808089\n", 550 | "3730 0.117028 0.806427\n", 551 | "3740 0.12423 0.798172\n", 552 | "3750 0.124115 0.799668\n", 553 | "3760 0.113916 0.820554\n", 554 | "3770 0.114836 0.814294\n", 555 | "3780 0.111884 0.821773\n", 556 | "3790 0.109576 0.821939\n", 557 | "3800 0.133347 0.778781\n", 558 | "3810 0.117672 0.812078\n", 559 | "3820 0.0977329 0.846205\n", 560 | "3830 0.107836 0.82964\n", 561 | "3840 0.109183 0.823213\n", 562 | "3850 0.0962643 0.843878\n", 563 | "3860 0.112667 0.81662\n", 564 | "3870 0.113762 0.818449\n", 565 | "3880 0.109026 0.824598\n", 566 | "3890 0.117122 0.811191\n", 567 | "3900 0.120144 0.80205\n", 568 | "3910 0.11478 0.814127\n", 569 | "3920 0.123071 0.796399\n", 570 | "3930 0.128912 0.796344\n", 571 | "3940 0.136728 0.765319\n", 572 | "3950 0.112267 0.81867\n", 573 | "3960 0.122488 0.800111\n", 574 | "3970 0.117424 0.804155\n", 575 | "3980 0.113804 0.82144\n", 576 | "3990 0.1045 0.836565\n", 577 | "4000 0.115332 0.816177\n", 578 | "Test accuracy: 0.803804\n", 579 | "Saving Checkpoint...\n", 580 | "4010 0.124522 0.792632\n", 581 | "4020 0.123712 0.797673\n", 582 | "4030 0.142917 0.757839\n", 583 | "4040 0.107525 0.828753\n", 584 | "4050 0.12205 0.806427\n", 585 | "4060 0.120528 0.806981\n", 586 | "4070 0.116938 0.808089\n", 587 | "4080 0.11176 0.821219\n", 588 | "4090 0.143288 0.771357\n", 589 | "4100 0.10179 0.837452\n", 590 | "4110 0.0953924 0.84626\n", 591 | "4120 0.101369 0.833241\n", 592 | "4130 0.104366 0.831745\n", 593 | "4140 0.118699 0.802216\n", 594 | "4150 0.124494 0.797895\n", 595 | "4160 0.115424 0.811136\n", 596 | "4170 0.112908 0.816122\n", 597 | "4180 0.127517 0.79108\n", 598 | "4190 0.118718 0.810914\n", 599 | "4200 0.105442 0.827867\n", 600 | "4210 0.113263 0.812244\n", 601 | "4220 0.102107 0.834848\n", 602 | "4230 0.115338 0.813795\n", 603 | "4240 0.0917221 0.852632\n", 604 | "4250 0.10848 0.822105\n", 605 | "4260 0.116808 0.809917\n", 606 | "4270 0.137212 0.774017\n", 607 | "4280 0.135335 0.77856\n", 608 | "4290 0.121521 0.805042\n", 609 | "4300 0.120671 0.804488\n", 610 | "4310 0.113054 0.812521\n", 611 | "4320 0.114487 0.813241\n", 612 | "4330 0.116019 0.815789\n", 613 | "4340 0.121358 0.804709\n", 614 | "4350 0.112997 0.808255\n", 615 | "4360 0.104994 0.834183\n", 616 | "4370 0.118433 0.813075\n", 617 | "4380 0.130569 0.792909\n", 618 | "4390 0.125535 0.795346\n", 619 | "4400 0.13561 0.774792\n", 620 | "4410 0.120812 0.800388\n", 621 | "4420 0.112133 0.819335\n", 622 | "4430 0.116301 0.812798\n", 623 | "4440 0.103037 0.831967\n", 624 | "4450 0.117422 0.815568\n", 625 | "4460 0.122929 0.797507\n", 626 | "4470 0.119538 0.802604\n", 627 | "4480 0.132382 0.786704\n", 628 | "4490 0.0986879 0.844321\n", 629 | "4500 0.130173 0.790859\n", 630 | "4510 0.108722 0.817729\n", 631 | "4520 0.126631 0.797507\n", 632 | "4530 0.113383 0.81856\n", 633 | "4540 0.112553 0.812244\n", 634 | "4550 0.0990954 0.840886\n", 635 | "4560 0.100489 0.837175\n", 636 | "4570 0.113019 0.821053\n", 637 | "4580 0.0988363 0.843656\n", 638 | "4590 0.130988 0.78687\n", 639 | "4600 0.109221 0.824211\n", 640 | "4610 0.118459 0.810637\n", 641 | "4620 0.134164 0.782881\n", 642 | "4630 0.104992 0.828587\n", 643 | "4640 0.113207 0.819169\n", 644 | "4650 0.127082 0.788366\n", 645 | "4660 0.121293 0.802382\n", 646 | "4670 0.121788 0.807701\n", 647 | "4680 0.110227 0.823767\n", 648 | "4690 0.115291 0.815457\n", 649 | "4700 0.117011 0.810859\n", 650 | "4710 0.108226 0.828144\n", 651 | "4720 0.124312 0.797784\n", 652 | "4730 0.124013 0.798172\n", 653 | "4740 0.137616 0.780222\n", 654 | "4750 0.116999 0.813352\n", 655 | "4760 0.125186 0.790138\n", 656 | "4770 0.126196 0.794737\n", 657 | "4780 0.125775 0.802548\n", 658 | "4790 0.129325 0.792465\n", 659 | "4800 0.107662 0.822881\n", 660 | "4810 0.124188 0.796731\n", 661 | "4820 0.0888942 0.860831\n", 662 | "4830 0.112556 0.814072\n", 663 | "4840 0.120487 0.810693\n", 664 | "4850 0.126349 0.794127\n", 665 | "4860 0.121295 0.800886\n", 666 | "4870 0.102257 0.837064\n", 667 | "4880 0.12405 0.804155\n", 668 | "4890 0.109136 0.816787\n", 669 | "4900 0.120174 0.806427\n", 670 | "4910 0.104563 0.830415\n", 671 | "4920 0.0961455 0.847258\n", 672 | "4930 0.118689 0.80964\n", 673 | "4940 0.105659 0.826814\n", 674 | "4950 0.112002 0.821163\n", 675 | "4960 0.128825 0.795235\n", 676 | "4970 0.102227 0.833352\n", 677 | "4980 0.130326 0.788975\n", 678 | "4990 0.113066 0.820055\n", 679 | "5000 0.108755 0.825706\n", 680 | "Test accuracy: 0.803950\n", 681 | "Saving Checkpoint...\n", 682 | "5010 0.110947 0.820665\n", 683 | "5020 0.117623 0.800554\n", 684 | "5030 0.116058 0.798283\n", 685 | "5040 0.112179 0.822825\n", 686 | "5050 0.119156 0.806704\n", 687 | "5060 0.108383 0.827645\n", 688 | "5070 0.128771 0.79036\n", 689 | "5080 0.110604 0.825152\n", 690 | "5090 0.118668 0.799668\n", 691 | "5100 0.110699 0.83169\n", 692 | "5110 0.102774 0.840554\n", 693 | "5120 0.109419 0.82482\n", 694 | "5130 0.117665 0.801163\n", 695 | "5140 0.10716 0.826537\n", 696 | "5150 0.116457 0.813629\n", 697 | "5160 0.107099 0.832742\n", 698 | "5170 0.0969147 0.849751\n", 699 | "5180 0.0997325 0.847091\n", 700 | "5190 0.124114 0.797008\n", 701 | "5200 0.110888 0.82277\n", 702 | "5210 0.114288 0.815291\n", 703 | "5220 0.104683 0.831302\n", 704 | "5230 0.109918 0.823767\n", 705 | "5240 0.103752 0.83241\n", 706 | "5250 0.104249 0.832078\n", 707 | "5260 0.117028 0.806039\n", 708 | "5270 0.11011 0.821773\n", 709 | "5280 0.111995 0.815568\n", 710 | "5290 0.116801 0.813906\n", 711 | "5300 0.125209 0.795291\n", 712 | "5310 0.102906 0.828753\n", 713 | "5320 0.126025 0.796953\n", 714 | "5330 0.140193 0.767258\n", 715 | "5340 0.126025 0.794737\n", 716 | "5350 0.119886 0.805873\n", 717 | "5360 0.137439 0.768809\n", 718 | "5370 0.114247 0.818338\n", 719 | "5380 0.128938 0.792299\n", 720 | "5390 0.107989 0.826427\n", 721 | "5400 0.119585 0.804044\n", 722 | "5410 0.118538 0.809806\n", 723 | "5420 0.119723 0.801385\n", 724 | "5430 0.0998984 0.840111\n", 725 | "5440 0.10487 0.838781\n", 726 | "5450 0.118403 0.814571\n", 727 | "5460 0.110053 0.81651\n", 728 | "5470 0.116647 0.813684\n", 729 | "5480 0.121376 0.803324\n", 730 | "5490 0.090022 0.859391\n", 731 | "5500 0.132281 0.78626\n", 732 | "5510 0.113643 0.814294\n", 733 | "5520 0.109109 0.827147\n", 734 | "5530 0.115344 0.810471\n", 735 | "5540 0.10461 0.832244\n", 736 | "5550 0.0977787 0.846759\n", 737 | "5560 0.121845 0.801108\n", 738 | "5570 0.112179 0.818892\n", 739 | "5580 0.142159 0.759335\n", 740 | "5590 0.121704 0.804654\n", 741 | "5600 0.0946846 0.852798\n", 742 | "5610 0.122864 0.805319\n", 743 | "5620 0.108976 0.82349\n", 744 | "5630 0.103527 0.83241\n", 745 | "5640 0.10226 0.833241\n", 746 | "5650 0.116293 0.811856\n", 747 | "5660 0.107495 0.830305\n", 748 | "5670 0.121285 0.800554\n", 749 | "5680 0.102132 0.839778\n", 750 | "5690 0.109557 0.824266\n", 751 | "5700 0.119993 0.810028\n", 752 | "5710 0.103742 0.830803\n", 753 | "5720 0.116861 0.809474\n", 754 | "5730 0.117974 0.812465\n", 755 | "5740 0.127432 0.793629\n", 756 | "5750 0.1061 0.826205\n", 757 | "5760 0.117996 0.808421\n", 758 | "5770 0.131122 0.788421\n", 759 | "5780 0.110261 0.818283\n", 760 | "5790 0.133988 0.784321\n", 761 | "5800 0.120059 0.799612\n", 762 | "5810 0.0998593 0.842715\n", 763 | "5820 0.117619 0.814903\n", 764 | "5830 0.119535 0.802548\n", 765 | "5840 0.10552 0.834349\n", 766 | "5850 0.106421 0.832133\n", 767 | "5860 0.111887 0.816787\n", 768 | "5870 0.110918 0.818283\n", 769 | "5880 0.117243 0.809307\n", 770 | "5890 0.12273 0.796399\n", 771 | "5900 0.0907381 0.857507\n", 772 | "5910 0.116342 0.814515\n", 773 | "5920 0.116483 0.811634\n", 774 | "5930 0.108064 0.825817\n", 775 | "5940 0.102479 0.832798\n", 776 | "5950 0.116386 0.807922\n", 777 | "5960 0.099734 0.839723\n", 778 | "5970 0.115091 0.816233\n", 779 | "5980 0.11542 0.815291\n", 780 | "5990 0.123331 0.80144\n", 781 | "6000 0.126886 0.8\n", 782 | "Test accuracy: 0.804034\n", 783 | "Saving Checkpoint...\n", 784 | "6010 0.115339 0.816011\n", 785 | "6020 0.12276 0.799612\n", 786 | "6030 0.129036 0.795679\n", 787 | "6040 0.142654 0.762659\n", 788 | "6050 0.110014 0.819114\n", 789 | "6060 0.0994475 0.843379\n", 790 | "6070 0.104152 0.830471\n", 791 | "6080 0.103595 0.832188\n", 792 | "6090 0.142717 0.76615\n", 793 | "6100 0.109274 0.826814\n", 794 | "6110 0.10725 0.822493\n", 795 | "6120 0.112814 0.822105\n", 796 | "6130 0.129952 0.785208\n", 797 | "6140 0.095089 0.852521\n", 798 | "6150 0.132722 0.787701\n", 799 | "6160 0.137263 0.773463\n", 800 | "6170 0.116098 0.808421\n", 801 | "6180 0.100609 0.84615\n", 802 | "6190 0.12088 0.806759\n", 803 | "6200 0.12006 0.804321\n", 804 | "6210 0.113979 0.819834\n", 805 | "6220 0.124924 0.793075\n", 806 | "6230 0.11291 0.819114\n", 807 | "6240 0.121172 0.803047\n", 808 | "6250 0.113022 0.813906\n", 809 | "6260 0.110064 0.819169\n", 810 | "6270 0.110614 0.824543\n", 811 | "6280 0.134918 0.781108\n", 812 | "6290 0.104959 0.831136\n", 813 | "6300 0.0969999 0.847812\n", 814 | "6310 0.117688 0.808421\n", 815 | "6320 0.118319 0.8041\n", 816 | "6330 0.111808 0.821496\n", 817 | "6340 0.120931 0.799612\n", 818 | "6350 0.10605 0.830582\n", 819 | "6360 0.113229 0.817507\n", 820 | "6370 0.102146 0.836454\n", 821 | "6380 0.108891 0.82349\n", 822 | "6390 0.117398 0.805263\n", 823 | "6400 0.12136 0.802271\n", 824 | "6410 0.10471 0.827147\n", 825 | "6420 0.117378 0.810139\n", 826 | "6430 0.10539 0.836399\n", 827 | "6440 0.127072 0.795069\n", 828 | "6450 0.120183 0.798504\n", 829 | "6460 0.125479 0.79241\n", 830 | "6470 0.105612 0.828532\n", 831 | "6480 0.120617 0.805429\n", 832 | "6490 0.134771 0.77313\n", 833 | "6500 0.106306 0.835734\n", 834 | "6510 0.113659 0.812632\n", 835 | "6520 0.114455 0.818837\n", 836 | "6530 0.108529 0.821053\n", 837 | "6540 0.119779 0.804986\n", 838 | "6550 0.125679 0.797119\n", 839 | "6560 0.115383 0.810249\n", 840 | "6570 0.118791 0.812853\n", 841 | "6580 0.102544 0.837119\n", 842 | "6590 0.105301 0.827313\n", 843 | "6600 0.116303 0.814017\n", 844 | "6610 0.115144 0.810249\n", 845 | "6620 0.106365 0.831911\n", 846 | "6630 0.127117 0.789474\n", 847 | "6640 0.108972 0.820443\n", 848 | "6650 0.117485 0.806925\n", 849 | "6660 0.122027 0.794958\n", 850 | "6670 0.0848175 0.86687\n", 851 | "6680 0.102884 0.835402\n", 852 | "6690 0.122504 0.801053\n", 853 | "6700 0.119961 0.805097\n", 854 | "6710 0.113972 0.807922\n", 855 | "6720 0.114368 0.8159\n", 856 | "6730 0.116376 0.803878\n", 857 | "6740 0.108957 0.828421\n", 858 | "6750 0.119238 0.805374\n", 859 | "6760 0.0899926 0.852742\n", 860 | "6770 0.128641 0.792853\n", 861 | "6780 0.104606 0.836122\n", 862 | "6790 0.0987224 0.845208\n", 863 | "6800 0.125352 0.795457\n", 864 | "6810 0.119776 0.803657\n", 865 | "6820 0.106983 0.83036\n", 866 | "6830 0.119117 0.810693\n", 867 | "6840 0.104333 0.828753\n", 868 | "6850 0.133223 0.783379\n", 869 | "6860 0.118933 0.802992\n", 870 | "6870 0.110472 0.817174\n", 871 | "6880 0.111982 0.822604\n", 872 | "6890 0.11735 0.81097\n", 873 | "6900 0.104128 0.826981\n", 874 | "6910 0.144692 0.761163\n", 875 | "6920 0.115307 0.809917\n", 876 | "6930 0.111603 0.812355\n", 877 | "6940 0.113023 0.817452\n", 878 | "6950 0.113237 0.812687\n", 879 | "6960 0.109302 0.825873\n", 880 | "6970 0.120125 0.805042\n", 881 | "6980 0.131436 0.786759\n", 882 | "6990 0.10354 0.836288\n", 883 | "7000 0.101546 0.83518\n", 884 | "Test accuracy: 0.804104\n", 885 | "Saving Checkpoint...\n", 886 | "7010 0.114896 0.813961\n", 887 | "7020 0.110522 0.828199\n", 888 | "7030 0.116244 0.812798\n", 889 | "7040 0.101797 0.835956\n", 890 | "7050 0.114429 0.815125\n", 891 | "7060 0.124589 0.793573\n", 892 | "7070 0.118804 0.810803\n", 893 | "7080 0.118804 0.805042\n", 894 | "7090 0.136366 0.771801\n", 895 | "7100 0.118091 0.809197\n", 896 | "7110 0.13021 0.782493\n", 897 | "7120 0.11218 0.825097\n", 898 | "7130 0.114599 0.81097\n", 899 | "7140 0.111703 0.823712\n", 900 | "7150 0.119085 0.806094\n", 901 | "7160 0.110151 0.818338\n", 902 | "7170 0.114648 0.811967\n", 903 | "7180 0.108462 0.825873\n", 904 | "7190 0.121616 0.805762\n", 905 | "7200 0.114702 0.818837\n", 906 | "7210 0.109005 0.827756\n", 907 | "7220 0.118651 0.809307\n", 908 | "7230 0.129864 0.782438\n", 909 | "7240 0.132234 0.783823\n", 910 | "7250 0.129294 0.792078\n", 911 | "7260 0.112171 0.82072\n", 912 | "7270 0.11756 0.815623\n", 913 | "7280 0.112981 0.817562\n", 914 | "7290 0.127807 0.796787\n", 915 | "7300 0.13224 0.779889\n", 916 | "7310 0.137681 0.779058\n", 917 | "7320 0.115968 0.814127\n", 918 | "7330 0.0830511 0.866648\n", 919 | "7340 0.116041 0.809474\n", 920 | "7350 0.0984263 0.842327\n", 921 | "7360 0.109676 0.822881\n", 922 | "7370 0.120166 0.802881\n", 923 | "7380 0.106789 0.83579\n", 924 | "7390 0.128433 0.786039\n", 925 | "7400 0.127891 0.796787\n", 926 | "7410 0.12307 0.802659\n", 927 | "7420 0.110235 0.81856\n", 928 | "7430 0.12952 0.793961\n", 929 | "7440 0.118575 0.809806\n", 930 | "7450 0.104511 0.829917\n", 931 | "7460 0.102293 0.834903\n", 932 | "7470 0.110917 0.817562\n", 933 | "7480 0.0975153 0.842881\n", 934 | "7490 0.113663 0.814404\n", 935 | "7500 0.115472 0.808089\n", 936 | "7510 0.1334 0.783435\n", 937 | "7520 0.115842 0.81241\n", 938 | "7530 0.130306 0.790194\n", 939 | "7540 0.115774 0.817562\n", 940 | "7550 0.116508 0.809972\n", 941 | "7560 0.118619 0.81374\n", 942 | "7570 0.112956 0.819778\n", 943 | "7580 0.115141 0.818781\n", 944 | "7590 0.102619 0.843047\n", 945 | "7600 0.0973834 0.844598\n", 946 | "7610 0.123534 0.792687\n", 947 | "7620 0.112813 0.816233\n", 948 | "7630 0.1089 0.823878\n", 949 | "7640 0.12355 0.799889\n", 950 | "7650 0.121106 0.803878\n", 951 | "7660 0.130181 0.782659\n", 952 | "7670 0.111784 0.823213\n", 953 | "7680 0.110598 0.816898\n", 954 | "7690 0.106566 0.831025\n", 955 | "7700 0.109188 0.825042\n", 956 | "7710 0.102948 0.839501\n", 957 | "7720 0.109417 0.825097\n", 958 | "7730 0.10207 0.84\n", 959 | "7740 0.112723 0.816067\n", 960 | "7750 0.127603 0.789529\n", 961 | "7760 0.104761 0.831524\n", 962 | "7770 0.13567 0.77036\n", 963 | "7780 0.113764 0.812521\n", 964 | "7790 0.106863 0.830693\n", 965 | "7800 0.112866 0.815623\n", 966 | "7810 0.105152 0.832133\n", 967 | "7820 0.125155 0.796898\n", 968 | "7830 0.126631 0.794737\n", 969 | "7840 0.0997036 0.843158\n", 970 | "7850 0.0941558 0.849363\n", 971 | "7860 0.121398 0.805873\n", 972 | "7870 0.127082 0.794848\n", 973 | "7880 0.114914 0.815069\n", 974 | "7890 0.101043 0.835291\n", 975 | "7900 0.113761 0.815069\n", 976 | "7910 0.124819 0.79856\n", 977 | "7920 0.111689 0.825429\n", 978 | "7930 0.127655 0.784654\n", 979 | "7940 0.116049 0.81313\n", 980 | "7950 0.125357 0.802493\n", 981 | "7960 0.100254 0.838061\n", 982 | "7970 0.114146 0.813296\n", 983 | "7980 0.107147 0.827036\n", 984 | "7990 0.122202 0.798615\n", 985 | "8000 0.0999906 0.838393\n", 986 | "Test accuracy: 0.804210\n", 987 | "Saving Checkpoint...\n", 988 | "8010 0.131069 0.786759\n", 989 | "8020 0.118199 0.814294\n", 990 | "8030 0.12196 0.798615\n", 991 | "8040 0.119169 0.803878\n", 992 | "8050 0.134623 0.776897\n", 993 | "8060 0.0935382 0.85651\n", 994 | "8070 0.126984 0.796787\n", 995 | "8080 0.145593 0.756454\n", 996 | "8090 0.0946611 0.849363\n", 997 | "8100 0.118877 0.805706\n", 998 | "8110 0.0945626 0.849197\n", 999 | "8120 0.102688 0.835291\n", 1000 | "8130 0.113504 0.814294\n", 1001 | "8140 0.0930065 0.850194\n", 1002 | "8150 0.114877 0.815734\n", 1003 | "8160 0.130488 0.782382\n", 1004 | "8170 0.108679 0.829474\n", 1005 | "8180 0.121152 0.800166\n", 1006 | "8190 0.126515 0.794127\n", 1007 | "8200 0.113196 0.82\n", 1008 | "8210 0.100276 0.843934\n", 1009 | "8220 0.104352 0.832133\n", 1010 | "8230 0.120053 0.800776\n", 1011 | "8240 0.110656 0.824044\n", 1012 | "8250 0.119323 0.804765\n", 1013 | "8260 0.113958 0.817174\n", 1014 | "8270 0.103345 0.836177\n", 1015 | "8280 0.126144 0.797451\n", 1016 | "8290 0.105657 0.833961\n", 1017 | "8300 0.123774 0.797175\n", 1018 | "8310 0.136456 0.776177\n", 1019 | "8320 0.115619 0.812078\n", 1020 | "8330 0.129678 0.789806\n", 1021 | "8340 0.112911 0.817396\n", 1022 | "8350 0.115731 0.810139\n", 1023 | "8360 0.121878 0.804155\n", 1024 | "8370 0.130519 0.786925\n", 1025 | "8380 0.095995 0.848698\n", 1026 | "8390 0.116877 0.81518\n", 1027 | "8400 0.10824 0.830748\n", 1028 | "8410 0.11946 0.797451\n", 1029 | "8420 0.105378 0.839003\n", 1030 | "8430 0.113971 0.817008\n", 1031 | "8440 0.0945552 0.85036\n", 1032 | "8450 0.122168 0.799945\n", 1033 | "8460 0.11676 0.809363\n", 1034 | "8470 0.0896165 0.856399\n", 1035 | "8480 0.100588 0.844377\n", 1036 | "8490 0.126977 0.795734\n", 1037 | "8500 0.106483 0.829252\n", 1038 | "8510 0.117106 0.817064\n", 1039 | "8520 0.129372 0.791468\n", 1040 | "8530 0.124654 0.796233\n", 1041 | "8540 0.122896 0.797507\n", 1042 | "8550 0.105288 0.83374\n", 1043 | "8560 0.122445 0.805596\n", 1044 | "8570 0.117473 0.815789\n", 1045 | "8580 0.104312 0.83374\n", 1046 | "8590 0.132606 0.781385\n", 1047 | "8600 0.0925472 0.84759\n", 1048 | "8610 0.100468 0.836233\n", 1049 | "8620 0.102941 0.838837\n", 1050 | "8630 0.120201 0.807922\n", 1051 | "8640 0.127027 0.791579\n", 1052 | "8650 0.116232 0.809695\n", 1053 | "8660 0.131491 0.778892\n", 1054 | "8670 0.11647 0.816898\n", 1055 | "8680 0.110083 0.824377\n", 1056 | "8690 0.114523 0.814238\n", 1057 | "8700 0.111441 0.823435\n", 1058 | "8710 0.107838 0.830249\n", 1059 | "8720 0.12208 0.804654\n", 1060 | "8730 0.116597 0.811524\n", 1061 | "8740 0.0978452 0.841994\n", 1062 | "8750 0.113256 0.822992\n", 1063 | "8760 0.111593 0.818892\n", 1064 | "8770 0.0966005 0.84205\n", 1065 | "8780 0.123361 0.791967\n", 1066 | "8790 0.111663 0.817285\n", 1067 | "8800 0.116187 0.811911\n", 1068 | "8810 0.116883 0.811967\n", 1069 | "8820 0.113194 0.819778\n", 1070 | "8830 0.096072 0.850194\n", 1071 | "8840 0.119155 0.799335\n", 1072 | "8850 0.116683 0.808864\n", 1073 | "8860 0.099274 0.840997\n", 1074 | "8870 0.110262 0.823435\n", 1075 | "8880 0.104141 0.831634\n", 1076 | "8890 0.106693 0.828864\n", 1077 | "8900 0.124742 0.792798\n", 1078 | "8910 0.132989 0.782493\n", 1079 | "8920 0.118558 0.811856\n", 1080 | "8930 0.10486 0.83097\n", 1081 | "8940 0.121866 0.810748\n", 1082 | "8950 0.115676 0.806648\n", 1083 | "8960 0.108939 0.822548\n", 1084 | "8970 0.0973369 0.847535\n", 1085 | "8980 0.106973 0.820997\n", 1086 | "8990 0.119575 0.804377\n", 1087 | "9000 0.0992153 0.839557\n", 1088 | "Test accuracy: 0.804262\n", 1089 | "Saving Checkpoint...\n", 1090 | "9010 0.100345 0.84133\n", 1091 | "9020 0.112037 0.821496\n", 1092 | "9030 0.118121 0.806371\n", 1093 | "9040 0.0978992 0.842548\n", 1094 | "9050 0.106398 0.82964\n", 1095 | "9060 0.119893 0.805374\n", 1096 | "9070 0.11826 0.809197\n", 1097 | "9080 0.124483 0.795457\n", 1098 | "9090 0.115096 0.816343\n", 1099 | "9100 0.113357 0.82349\n", 1100 | "9110 0.117002 0.812632\n", 1101 | "9120 0.114019 0.816731\n", 1102 | "9130 0.0959668 0.850083\n", 1103 | "9140 0.105641 0.825873\n", 1104 | "9150 0.110057 0.823047\n", 1105 | "9160 0.11458 0.811191\n", 1106 | "9170 0.122948 0.79867\n", 1107 | "9180 0.118032 0.804321\n", 1108 | "9190 0.109245 0.822881\n", 1109 | "9200 0.110957 0.825042\n", 1110 | "9210 0.120485 0.806537\n", 1111 | "9220 0.101673 0.827645\n", 1112 | "9230 0.122432 0.798781\n", 1113 | "9240 0.107453 0.83313\n", 1114 | "9250 0.122021 0.805152\n", 1115 | "9260 0.120947 0.8041\n", 1116 | "9270 0.104313 0.826316\n", 1117 | "9280 0.110511 0.820554\n", 1118 | "9290 0.107358 0.826205\n", 1119 | "9300 0.104545 0.834737\n", 1120 | "9310 0.122823 0.801994\n", 1121 | "9320 0.123516 0.795512\n", 1122 | "9330 0.111616 0.816067\n", 1123 | "9340 0.125763 0.795845\n", 1124 | "9350 0.118821 0.812521\n", 1125 | "9360 0.123935 0.796454\n", 1126 | "9370 0.0990414 0.841496\n", 1127 | "9380 0.145198 0.759114\n", 1128 | "9390 0.113401 0.814958\n", 1129 | "9400 0.113015 0.818283\n", 1130 | "9410 0.10817 0.824155\n", 1131 | "9420 0.123803 0.8\n", 1132 | "9430 0.131707 0.780665\n", 1133 | "9440 0.108824 0.825706\n", 1134 | "9450 0.10976 0.822493\n", 1135 | "9460 0.117162 0.811967\n", 1136 | "9470 0.101378 0.839778\n", 1137 | "9480 0.124622 0.796399\n", 1138 | "9490 0.124191 0.800665\n", 1139 | "9500 0.12704 0.794072\n", 1140 | "9510 0.123767 0.800166\n", 1141 | "9520 0.105689 0.822382\n", 1142 | "9530 0.115233 0.807479\n", 1143 | "9540 0.100874 0.839889\n", 1144 | "9550 0.131883 0.787036\n", 1145 | "9560 0.126029 0.79518\n", 1146 | "9570 0.126458 0.800055\n", 1147 | "9580 0.126406 0.791136\n", 1148 | "9590 0.127521 0.790083\n", 1149 | "9600 0.10418 0.831247\n", 1150 | "9610 0.112384 0.814681\n", 1151 | "9620 0.119761 0.806925\n", 1152 | "9630 0.103263 0.832299\n", 1153 | "9640 0.0975153 0.847091\n", 1154 | "9650 0.11666 0.807645\n", 1155 | "9660 0.108827 0.820388\n", 1156 | "9670 0.129691 0.793241\n", 1157 | "9680 0.111523 0.816787\n", 1158 | "9690 0.131101 0.782493\n", 1159 | "9700 0.115917 0.811413\n", 1160 | "9710 0.106886 0.82964\n", 1161 | "9720 0.110555 0.819003\n", 1162 | "9730 0.127951 0.795512\n", 1163 | "9740 0.116562 0.807701\n", 1164 | "9750 0.108804 0.825263\n", 1165 | "9760 0.119193 0.806427\n", 1166 | "9770 0.121436 0.804598\n", 1167 | "9780 0.116912 0.813684\n", 1168 | "9790 0.113119 0.816953\n", 1169 | "9800 0.10061 0.841773\n", 1170 | "9810 0.104683 0.832022\n", 1171 | "9820 0.105159 0.828144\n", 1172 | "9830 0.141013 0.774571\n", 1173 | "9840 0.118279 0.808366\n", 1174 | "9850 0.118806 0.810194\n", 1175 | "9860 0.114709 0.810028\n", 1176 | "9870 0.117299 0.810859\n", 1177 | "9880 0.100662 0.84072\n", 1178 | "9890 0.136303 0.778781\n", 1179 | "9900 0.110914 0.824321\n", 1180 | "9910 0.0886633 0.862604\n", 1181 | "9920 0.100805 0.836454\n", 1182 | "9930 0.128811 0.791413\n", 1183 | "9940 0.125841 0.795789\n", 1184 | "9950 0.124579 0.79374\n", 1185 | "9960 0.10984 0.819224\n", 1186 | "9970 0.117096 0.810637\n", 1187 | "9980 0.121784 0.809418\n", 1188 | "9990 0.0998872 0.842493\n", 1189 | "10000 0.109378 0.824488\n", 1190 | "Test accuracy: 0.804317\n", 1191 | "Saving Checkpoint...\n", 1192 | "10010 0.120071 0.802493\n", 1193 | "10020 0.107403 0.82554\n", 1194 | "10030 0.114588 0.81651\n", 1195 | "10040 0.121405 0.804377\n", 1196 | "10050 0.109191 0.821385\n", 1197 | "10060 0.131091 0.777175\n", 1198 | "10070 0.11995 0.806482\n", 1199 | "10080 0.117058 0.811911\n", 1200 | "10090 0.10434 0.833352\n", 1201 | "10100 0.125114 0.799723\n", 1202 | "10110 0.102792 0.835956\n", 1203 | "10120 0.110276 0.820886\n", 1204 | "10130 0.10471 0.836343\n", 1205 | "10140 0.11846 0.80482\n", 1206 | "10150 0.10817 0.829252\n", 1207 | "10160 0.0903789 0.857451\n", 1208 | "10170 0.115429 0.810859\n", 1209 | "10180 0.127086 0.797451\n", 1210 | "10190 0.112796 0.819612\n", 1211 | "10200 0.125708 0.798061\n", 1212 | "10210 0.112174 0.820111\n", 1213 | "10220 0.100716 0.840942\n", 1214 | "10230 0.0976194 0.837729\n", 1215 | "10240 0.106568 0.828089\n", 1216 | "10250 0.116153 0.808698\n", 1217 | "10260 0.113528 0.817673\n", 1218 | "10270 0.116894 0.80964\n", 1219 | "10280 0.115122 0.812022\n", 1220 | "10290 0.104823 0.830693\n", 1221 | "10300 0.126187 0.79662\n", 1222 | "10310 0.0956277 0.849141\n", 1223 | "10320 0.121704 0.80349\n", 1224 | "10330 0.11173 0.814127\n", 1225 | "10340 0.123609 0.800222\n", 1226 | "10350 0.105945 0.830693\n", 1227 | "10360 0.103906 0.823546\n", 1228 | "10370 0.118705 0.81036\n", 1229 | "10380 0.102449 0.833906\n", 1230 | "10390 0.106844 0.831801\n", 1231 | "10400 0.1246 0.798947\n", 1232 | "10410 0.114976 0.815734\n", 1233 | "10420 0.115572 0.815346\n", 1234 | "10430 0.119982 0.799335\n", 1235 | "10440 0.114361 0.813352\n", 1236 | "10450 0.117292 0.81108\n", 1237 | "10460 0.107705 0.828366\n", 1238 | "10470 0.0974952 0.849418\n", 1239 | "10480 0.125668 0.797895\n", 1240 | "10490 0.111111 0.819335\n", 1241 | "10500 0.114438 0.816288\n", 1242 | "10510 0.115574 0.815789\n", 1243 | "10520 0.114504 0.819668\n", 1244 | "10530 0.0956336 0.849307\n", 1245 | "10540 0.116708 0.813352\n", 1246 | "10550 0.111271 0.822604\n", 1247 | "10560 0.109382 0.824709\n", 1248 | "10570 0.122448 0.802493\n", 1249 | "10580 0.125565 0.792299\n", 1250 | "10590 0.132492 0.788366\n", 1251 | "10600 0.101595 0.837452\n", 1252 | "10610 0.11068 0.819945\n", 1253 | "10620 0.0949506 0.843767\n", 1254 | "10630 0.120124 0.798061\n", 1255 | "10640 0.119936 0.79856\n", 1256 | "10650 0.111988 0.82759\n", 1257 | "10660 0.109704 0.823546\n", 1258 | "10670 0.115739 0.816731\n", 1259 | "10680 0.0983194 0.842992\n", 1260 | "10690 0.102001 0.834848\n", 1261 | "10700 0.112493 0.821773\n", 1262 | "10710 0.121619 0.809917\n", 1263 | "10720 0.115242 0.81097\n", 1264 | "10730 0.128039 0.790028\n", 1265 | "10740 0.107414 0.830249\n", 1266 | "10750 0.122659 0.798947\n", 1267 | "10760 0.11111 0.819169\n", 1268 | "10770 0.102806 0.828366\n", 1269 | "10780 0.114759 0.808809\n", 1270 | "10790 0.113358 0.811745\n", 1271 | "10800 0.138393 0.774848\n", 1272 | "10810 0.1089 0.827922\n", 1273 | "10820 0.120792 0.806981\n", 1274 | "10830 0.127811 0.786316\n", 1275 | "10840 0.122308 0.798947\n", 1276 | "10850 0.133213 0.773573\n", 1277 | "10860 0.101639 0.840831\n", 1278 | "10870 0.0950747 0.849751\n", 1279 | "10880 0.0992128 0.83579\n", 1280 | "10890 0.124318 0.802548\n", 1281 | "10900 0.13219 0.777562\n", 1282 | "10910 0.11344 0.817562\n", 1283 | "10920 0.137308 0.765429\n", 1284 | "10930 0.112603 0.822493\n", 1285 | "10940 0.108372 0.822161\n", 1286 | "10950 0.0957624 0.848809\n", 1287 | "10960 0.0917794 0.85446\n", 1288 | "10970 0.109618 0.824488\n", 1289 | "10980 0.137036 0.774737\n", 1290 | "10990 0.124655 0.796066\n", 1291 | "11000 0.105233 0.827701\n", 1292 | "Test accuracy: 0.804381\n", 1293 | "Saving Checkpoint...\n", 1294 | "11010 0.116741 0.812521\n", 1295 | "11020 0.110657 0.821607\n", 1296 | "11030 0.104002 0.836731\n", 1297 | "11040 0.120601 0.805873\n", 1298 | "11050 0.089961 0.85651\n", 1299 | "11060 0.102335 0.838449\n", 1300 | "11070 0.121725 0.801773\n", 1301 | "11080 0.124683 0.794349\n", 1302 | "11090 0.112049 0.821717\n", 1303 | "11100 0.0986088 0.83795\n", 1304 | "11110 0.101107 0.83856\n", 1305 | "11120 0.107673 0.828975\n", 1306 | "11130 0.102525 0.835457\n", 1307 | "11140 0.135327 0.779169\n", 1308 | "11150 0.104818 0.838227\n", 1309 | "11160 0.103933 0.83856\n", 1310 | "11170 0.102125 0.831745\n", 1311 | "11180 0.118407 0.809418\n", 1312 | "11190 0.121956 0.799003\n", 1313 | "11200 0.107201 0.832078\n", 1314 | "11210 0.117055 0.813075\n", 1315 | "11220 0.109251 0.823102\n", 1316 | "11230 0.0982552 0.840831\n", 1317 | "11240 0.119731 0.808532\n", 1318 | "11250 0.108623 0.82072\n", 1319 | "11260 0.11877 0.807867\n", 1320 | "11270 0.112096 0.822659\n", 1321 | "11280 0.114555 0.818947\n", 1322 | "11290 0.113528 0.812465\n", 1323 | "11300 0.100488 0.834571\n", 1324 | "11310 0.0966538 0.842327\n", 1325 | "11320 0.0932009 0.855734\n", 1326 | "11330 0.0959037 0.849363\n", 1327 | "11340 0.121591 0.805208\n", 1328 | "11350 0.109033 0.823656\n", 1329 | "11360 0.123044 0.80831\n", 1330 | "11370 0.114063 0.814294\n", 1331 | "11380 0.111391 0.826704\n", 1332 | "11390 0.12591 0.794349\n", 1333 | "11400 0.101227 0.840831\n", 1334 | "11410 0.115091 0.818283\n", 1335 | "11420 0.0998392 0.840831\n", 1336 | "11430 0.0949381 0.85374\n", 1337 | "11440 0.117072 0.806814\n", 1338 | "11450 0.106472 0.831634\n", 1339 | "11460 0.127797 0.793463\n", 1340 | "11470 0.0977285 0.844044\n", 1341 | "11480 0.112783 0.817507\n", 1342 | "11490 0.102463 0.82903\n", 1343 | "11500 0.10484 0.83928\n", 1344 | "11510 0.1187 0.808255\n", 1345 | "11520 0.11274 0.821773\n", 1346 | "11530 0.105833 0.824488\n", 1347 | "11540 0.122795 0.805983\n", 1348 | "11550 0.103017 0.835125\n", 1349 | "11560 0.101438 0.835291\n", 1350 | "11570 0.116899 0.812632\n", 1351 | "11580 0.116527 0.816676\n", 1352 | "11590 0.114373 0.819114\n", 1353 | "11600 0.118632 0.804488\n", 1354 | "11610 0.121341 0.80615\n", 1355 | "11620 0.1118 0.817839\n", 1356 | "11630 0.109388 0.826759\n", 1357 | "11640 0.131051 0.786593\n", 1358 | "11650 0.116845 0.809861\n", 1359 | "11660 0.113454 0.812909\n", 1360 | "11670 0.113785 0.820942\n", 1361 | "11680 0.0982592 0.846981\n", 1362 | "11690 0.0993294 0.844543\n", 1363 | "11700 0.109825 0.818781\n", 1364 | "11710 0.119153 0.804765\n", 1365 | "11720 0.129419 0.785042\n", 1366 | "11730 0.126583 0.787535\n", 1367 | "11740 0.113398 0.818061\n", 1368 | "11750 0.118781 0.80831\n", 1369 | "11760 0.118323 0.80554\n", 1370 | "11770 0.105968 0.829197\n", 1371 | "11780 0.121198 0.798449\n", 1372 | "11790 0.109513 0.8159\n", 1373 | "11800 0.141236 0.775512\n", 1374 | "11810 0.109812 0.824155\n", 1375 | "11820 0.113257 0.820443\n", 1376 | "11830 0.133705 0.77928\n", 1377 | "11840 0.117868 0.81036\n", 1378 | "11850 0.108883 0.822992\n", 1379 | "11860 0.128923 0.79446\n", 1380 | "11870 0.0986422 0.847036\n", 1381 | "11880 0.12316 0.794792\n", 1382 | "11890 0.121479 0.803934\n", 1383 | "11900 0.0989643 0.841994\n", 1384 | "11910 0.111685 0.826814\n", 1385 | "11920 0.131453 0.789086\n", 1386 | "11930 0.112866 0.815069\n", 1387 | "11940 0.108306 0.837064\n", 1388 | "11950 0.115432 0.816399\n", 1389 | "11960 0.120334 0.802715\n", 1390 | "11970 0.115075 0.817341\n", 1391 | "11980 0.118437 0.81097\n", 1392 | "11990 0.109639 0.82615\n", 1393 | "12000 0.112073 0.811911\n", 1394 | "Test accuracy: 0.804477\n", 1395 | "Saving Checkpoint...\n", 1396 | "12010 0.115507 0.811413\n", 1397 | "12020 0.122717 0.799391\n", 1398 | "12030 0.120818 0.797341\n", 1399 | "12040 0.108053 0.829197\n", 1400 | "12050 0.122799 0.797729\n", 1401 | "12060 0.121377 0.800111\n", 1402 | "12070 0.0982472 0.843934\n", 1403 | "12080 0.100849 0.836842\n", 1404 | "12090 0.117178 0.815734\n", 1405 | "12100 0.0940054 0.849307\n", 1406 | "12110 0.132466 0.780776\n", 1407 | "12120 0.121862 0.799557\n", 1408 | "12130 0.119012 0.803213\n", 1409 | "12140 0.114737 0.817119\n", 1410 | "12150 0.0929734 0.85385\n", 1411 | "12160 0.106943 0.829751\n", 1412 | "12170 0.118584 0.803102\n", 1413 | "12180 0.119176 0.802382\n", 1414 | "12190 0.124974 0.792632\n", 1415 | "12200 0.119141 0.807368\n", 1416 | "12210 0.121203 0.806371\n", 1417 | "12220 0.117044 0.809418\n", 1418 | "12230 0.108109 0.826814\n", 1419 | "12240 0.130209 0.786593\n", 1420 | "12250 0.122703 0.803767\n", 1421 | "12260 0.101929 0.835069\n", 1422 | "12270 0.105457 0.828366\n", 1423 | "12280 0.12372 0.79662\n", 1424 | "12290 0.103845 0.829474\n", 1425 | "12300 0.0937501 0.850249\n", 1426 | "12310 0.127078 0.793961\n", 1427 | "12320 0.10329 0.835512\n", 1428 | "12330 0.137721 0.775402\n", 1429 | "12340 0.103451 0.833075\n", 1430 | "12350 0.116957 0.81518\n", 1431 | "12360 0.116164 0.808366\n", 1432 | "12370 0.114721 0.819834\n", 1433 | "12380 0.0940916 0.849307\n", 1434 | "12390 0.123288 0.79795\n", 1435 | "12400 0.124704 0.795623\n", 1436 | "12410 0.120441 0.806759\n", 1437 | "12420 0.117208 0.807368\n", 1438 | "12430 0.113293 0.815014\n", 1439 | "12440 0.122224 0.802438\n", 1440 | "12450 0.107201 0.827258\n", 1441 | "12460 0.105606 0.83036\n", 1442 | "12470 0.122634 0.797285\n", 1443 | "12480 0.109911 0.830249\n", 1444 | "12490 0.121184 0.800665\n", 1445 | "12500 0.106594 0.833463\n", 1446 | "12510 0.105408 0.834238\n", 1447 | "12520 0.120227 0.800665\n", 1448 | "12530 0.114184 0.821607\n", 1449 | "12540 0.103596 0.835125\n", 1450 | "12550 0.136122 0.77374\n", 1451 | "12560 0.115472 0.816011\n", 1452 | "12570 0.100593 0.840055\n", 1453 | "12580 0.109932 0.824432\n", 1454 | "12590 0.116912 0.817064\n", 1455 | "12600 0.127381 0.795845\n", 1456 | "12610 0.117533 0.803158\n", 1457 | "12620 0.104045 0.838227\n", 1458 | "12630 0.11937 0.806759\n", 1459 | "12640 0.118189 0.801773\n", 1460 | "12650 0.112848 0.819834\n", 1461 | "12660 0.120369 0.806205\n", 1462 | "12670 0.103035 0.837452\n", 1463 | "12680 0.111606 0.824211\n", 1464 | "12690 0.110779 0.81928\n", 1465 | "12700 0.114182 0.813961\n", 1466 | "12710 0.113091 0.818116\n", 1467 | "12720 0.113666 0.811413\n", 1468 | "12730 0.115307 0.813352\n", 1469 | "12740 0.101146 0.838338\n", 1470 | "12750 0.124452 0.798615\n", 1471 | "12760 0.131159 0.789307\n", 1472 | "12770 0.108614 0.827258\n", 1473 | "12780 0.106774 0.829363\n", 1474 | "12790 0.11013 0.816787\n", 1475 | "12800 0.12237 0.79856\n", 1476 | "12810 0.119801 0.808643\n", 1477 | "12820 0.110311 0.82144\n", 1478 | "12830 0.103002 0.827978\n", 1479 | "12840 0.101977 0.834792\n", 1480 | "12850 0.117669 0.814848\n", 1481 | "12860 0.121101 0.808476\n", 1482 | "12870 0.118167 0.809806\n", 1483 | "12880 0.125401 0.799668\n", 1484 | "12890 0.103609 0.832078\n", 1485 | "12900 0.109097 0.826039\n", 1486 | "12910 0.110138 0.825706\n", 1487 | "12920 0.107033 0.825983\n", 1488 | "12930 0.130798 0.790526\n", 1489 | "12940 0.123106 0.797784\n", 1490 | "12950 0.118043 0.805928\n", 1491 | "12960 0.129966 0.789086\n", 1492 | "12970 0.107098 0.829695\n", 1493 | "12980 0.119762 0.802548\n", 1494 | "12990 0.112015 0.821108\n", 1495 | "13000 0.119977 0.802493\n", 1496 | "Test accuracy: 0.804463\n", 1497 | "Saving Checkpoint...\n", 1498 | "13010 0.102748 0.837507\n", 1499 | "13020 0.120447 0.805706\n", 1500 | "13030 0.118193 0.807368\n", 1501 | "13040 0.122206 0.802659\n", 1502 | "13050 0.13009 0.784488\n", 1503 | "13060 0.111788 0.820166\n", 1504 | "13070 0.108364 0.827147\n", 1505 | "13080 0.108738 0.820609\n", 1506 | "13090 0.127112 0.795014\n", 1507 | "13100 0.100548 0.836288\n", 1508 | "13110 0.116932 0.811413\n", 1509 | "13120 0.110962 0.816787\n", 1510 | "13130 0.124712 0.789363\n", 1511 | "13140 0.120865 0.799335\n", 1512 | "13150 0.10934 0.827036\n", 1513 | "13160 0.110591 0.82349\n", 1514 | "13170 0.126604 0.796011\n", 1515 | "13180 0.119608 0.806759\n", 1516 | "13190 0.121669 0.803989\n", 1517 | "13200 0.120389 0.805651\n", 1518 | "13210 0.113303 0.815069\n", 1519 | "13220 0.118964 0.811025\n", 1520 | "13230 0.113848 0.813407\n", 1521 | "13240 0.117885 0.812133\n", 1522 | "13250 0.121125 0.803878\n", 1523 | "13260 0.116334 0.813407\n", 1524 | "13270 0.109699 0.825208\n", 1525 | "13280 0.127321 0.793407\n", 1526 | "13290 0.108441 0.827535\n", 1527 | "13300 0.110155 0.826925\n", 1528 | "13310 0.11693 0.807313\n", 1529 | "13320 0.104088 0.834681\n", 1530 | "13330 0.104579 0.833075\n", 1531 | "13340 0.119026 0.80831\n", 1532 | "13350 0.123664 0.797064\n", 1533 | "13360 0.123555 0.799723\n", 1534 | "13370 0.110399 0.817119\n", 1535 | "13380 0.117165 0.810028\n", 1536 | "13390 0.126235 0.795125\n", 1537 | "13400 0.134893 0.780111\n", 1538 | "13410 0.114805 0.813241\n", 1539 | "13420 0.112346 0.817839\n", 1540 | "13430 0.103653 0.826205\n", 1541 | "13440 0.12131 0.804931\n", 1542 | "13450 0.108441 0.827036\n", 1543 | "13460 0.120223 0.802604\n", 1544 | "13470 0.116811 0.81036\n", 1545 | "13480 0.120396 0.807368\n", 1546 | "13490 0.125643 0.79374\n", 1547 | "13500 0.114159 0.814183\n", 1548 | "13510 0.126309 0.790526\n", 1549 | "13520 0.118951 0.803601\n", 1550 | "13530 0.12107 0.798504\n", 1551 | "13540 0.120052 0.807812\n", 1552 | "13550 0.113938 0.81169\n", 1553 | "13560 0.114253 0.810305\n", 1554 | "13570 0.113078 0.817285\n", 1555 | "13580 0.108019 0.822271\n", 1556 | "13590 0.100591 0.841551\n", 1557 | "13600 0.110361 0.819335\n", 1558 | "13610 0.124181 0.796676\n", 1559 | "13620 0.117052 0.810748\n", 1560 | "13630 0.118689 0.79928\n", 1561 | "13640 0.120224 0.806316\n", 1562 | "13650 0.11929 0.804488\n", 1563 | "13660 0.103028 0.835512\n", 1564 | "13670 0.128457 0.790803\n", 1565 | "13680 0.106231 0.831468\n", 1566 | "13690 0.114253 0.815291\n", 1567 | "13700 0.111191 0.819391\n", 1568 | "13710 0.112341 0.820111\n", 1569 | "13720 0.124238 0.802992\n", 1570 | "13730 0.121231 0.800609\n", 1571 | "13740 0.11117 0.821773\n", 1572 | "13750 0.0983496 0.842992\n", 1573 | "13760 0.0959985 0.844488\n", 1574 | "13770 0.110262 0.822548\n", 1575 | "13780 0.0992587 0.842493\n", 1576 | "13790 0.110955 0.819335\n", 1577 | "13800 0.120387 0.806094\n", 1578 | "13810 0.11114 0.820997\n", 1579 | "13820 0.13458 0.776233\n", 1580 | "13830 0.123894 0.796399\n", 1581 | "13840 0.130996 0.785208\n", 1582 | "13850 0.108333 0.813186\n", 1583 | "13860 0.110273 0.823656\n", 1584 | "13870 0.0935804 0.847922\n", 1585 | "13880 0.115228 0.81662\n", 1586 | "13890 0.106618 0.83036\n", 1587 | "13900 0.10399 0.834737\n", 1588 | "13910 0.117386 0.810526\n", 1589 | "13920 0.126784 0.790194\n", 1590 | "13930 0.0997412 0.841884\n", 1591 | "13940 0.0951594 0.842216\n", 1592 | "13950 0.107613 0.825485\n", 1593 | "13960 0.12289 0.798116\n", 1594 | "13970 0.13437 0.780443\n", 1595 | "13980 0.115026 0.811745\n", 1596 | "13990 0.123222 0.797784\n", 1597 | "14000 0.108133 0.825651\n", 1598 | "Test accuracy: 0.804504\n", 1599 | "Saving Checkpoint...\n", 1600 | "14010 0.109306 0.822382\n", 1601 | "14020 0.0969454 0.849474\n", 1602 | "14030 0.105504 0.83097\n", 1603 | "14040 0.103439 0.829529\n", 1604 | "14050 0.130092 0.792022\n", 1605 | "14060 0.111811 0.821994\n", 1606 | "14070 0.0944804 0.853795\n", 1607 | "14080 0.119579 0.806371\n", 1608 | "14090 0.0995549 0.84205\n", 1609 | "14100 0.120463 0.803379\n", 1610 | "14110 0.116478 0.812188\n", 1611 | "14120 0.0921622 0.860166\n", 1612 | "14130 0.108887 0.822659\n", 1613 | "14140 0.129867 0.781607\n", 1614 | "14150 0.10747 0.831856\n", 1615 | "14160 0.113185 0.819114\n", 1616 | "14170 0.115791 0.806759\n", 1617 | "14180 0.127587 0.794072\n", 1618 | "14190 0.124043 0.794238\n", 1619 | "14200 0.12368 0.799834\n", 1620 | "14210 0.11708 0.806648\n", 1621 | "14220 0.118692 0.804654\n", 1622 | "14230 0.111516 0.823656\n", 1623 | "14240 0.107541 0.822216\n", 1624 | "14250 0.0998603 0.839446\n", 1625 | "14260 0.105883 0.831801\n", 1626 | "14270 0.143477 0.760609\n", 1627 | "14280 0.111945 0.817729\n", 1628 | "14290 0.0929616 0.854017\n", 1629 | "14300 0.108628 0.819391\n", 1630 | "14310 0.111234 0.82144\n", 1631 | "14320 0.125431 0.79662\n", 1632 | "14330 0.126506 0.792576\n", 1633 | "14340 0.118576 0.809529\n", 1634 | "14350 0.120795 0.807368\n", 1635 | "14360 0.122524 0.79795\n", 1636 | "14370 0.120888 0.804765\n", 1637 | "14380 0.117963 0.808089\n", 1638 | "14390 0.100103 0.841496\n", 1639 | "14400 0.11329 0.820166\n", 1640 | "14410 0.131369 0.783269\n", 1641 | "14420 0.104137 0.829141\n", 1642 | "14430 0.106718 0.825651\n", 1643 | "14440 0.111394 0.818449\n", 1644 | "14450 0.0911212 0.855789\n", 1645 | "14460 0.115057 0.813463\n", 1646 | "14470 0.114447 0.816122\n", 1647 | "14480 0.101154 0.83795\n", 1648 | "14490 0.124842 0.793407\n", 1649 | "14500 0.126061 0.78892\n", 1650 | "14510 0.108276 0.824654\n", 1651 | "14520 0.116801 0.809197\n", 1652 | "14530 0.106929 0.827313\n", 1653 | "14540 0.123585 0.801828\n", 1654 | "14550 0.119855 0.806814\n", 1655 | "14560 0.116058 0.816842\n", 1656 | "14570 0.108749 0.827202\n", 1657 | "14580 0.105798 0.827978\n", 1658 | "14590 0.104478 0.825817\n", 1659 | "14600 0.0973746 0.845319\n", 1660 | "14610 0.103856 0.834294\n", 1661 | "14620 0.134415 0.772632\n", 1662 | "14630 0.122171 0.800609\n", 1663 | "14640 0.112467 0.821053\n", 1664 | "14650 0.126786 0.799612\n", 1665 | "14660 0.112189 0.823269\n", 1666 | "14670 0.114357 0.813961\n", 1667 | "14680 0.129529 0.796344\n", 1668 | "14690 0.104924 0.826427\n", 1669 | "14700 0.120494 0.80554\n", 1670 | "14710 0.119829 0.81313\n", 1671 | "14720 0.119599 0.799889\n", 1672 | "14730 0.106093 0.83169\n", 1673 | "14740 0.116929 0.804155\n", 1674 | "14750 0.105025 0.827479\n", 1675 | "14760 0.12082 0.801607\n", 1676 | "14770 0.107406 0.823213\n", 1677 | "14780 0.106804 0.829972\n", 1678 | "14790 0.123104 0.80349\n", 1679 | "14800 0.118445 0.802382\n", 1680 | "14810 0.115775 0.814792\n", 1681 | "14820 0.124926 0.801939\n", 1682 | "14830 0.106511 0.826981\n", 1683 | "14840 0.102332 0.834903\n", 1684 | "14850 0.109891 0.820831\n", 1685 | "14860 0.109833 0.823102\n", 1686 | "14870 0.105129 0.828033\n", 1687 | "14880 0.113797 0.815734\n", 1688 | "14890 0.12018 0.807479\n", 1689 | "14900 0.125902 0.791856\n", 1690 | "14910 0.113743 0.819114\n", 1691 | "14920 0.130897 0.791302\n", 1692 | "14930 0.11663 0.809418\n", 1693 | "14940 0.114468 0.822936\n", 1694 | "14950 0.101037 0.835679\n", 1695 | "14960 0.11775 0.805651\n", 1696 | "14970 0.117079 0.807701\n", 1697 | "14980 0.116882 0.816011\n", 1698 | "14990 0.113329 0.814127\n", 1699 | "15000 0.116799 0.809861\n", 1700 | "Test accuracy: 0.804606\n", 1701 | "Saving Checkpoint...\n", 1702 | "15010 0.138051 0.771745\n", 1703 | "15020 0.1066 0.828255\n", 1704 | "15030 0.139336 0.770415\n", 1705 | "15040 0.0951707 0.84831\n", 1706 | "15050 0.1142 0.816565\n", 1707 | "15060 0.122381 0.802604\n", 1708 | "15070 0.0919808 0.856122\n", 1709 | "15080 0.130796 0.779391\n", 1710 | "15090 0.108794 0.831357\n", 1711 | "15100 0.11293 0.82144\n", 1712 | "15110 0.141025 0.754681\n", 1713 | "15120 0.119361 0.806593\n", 1714 | "15130 0.102106 0.830249\n", 1715 | "15140 0.111506 0.824377\n", 1716 | "15150 0.116491 0.813629\n", 1717 | "15160 0.1254 0.793075\n", 1718 | "15170 0.123399 0.797618\n", 1719 | "15180 0.114421 0.819557\n", 1720 | "15190 0.103022 0.832133\n", 1721 | "15200 0.120976 0.804321\n", 1722 | "15210 0.105712 0.827424\n", 1723 | "15220 0.111365 0.819003\n", 1724 | "15230 0.0829416 0.869307\n", 1725 | "15240 0.11267 0.818172\n", 1726 | "15250 0.112597 0.809751\n", 1727 | "15260 0.106389 0.829363\n", 1728 | "15270 0.134408 0.777452\n", 1729 | "15280 0.109549 0.822382\n", 1730 | "15290 0.119891 0.804488\n", 1731 | "15300 0.118673 0.813075\n", 1732 | "15310 0.126086 0.795568\n", 1733 | "15320 0.111757 0.820166\n", 1734 | "15330 0.12395 0.797562\n", 1735 | "15340 0.118127 0.808643\n", 1736 | "15350 0.122597 0.79518\n", 1737 | "15360 0.0867086 0.861828\n", 1738 | "15370 0.117479 0.807091\n", 1739 | "15380 0.12406 0.798393\n", 1740 | "15390 0.096925 0.84205\n", 1741 | "15400 0.114174 0.818504\n", 1742 | "15410 0.113318 0.819889\n", 1743 | "15420 0.130487 0.787812\n", 1744 | "15430 0.10736 0.827535\n", 1745 | "15440 0.107018 0.826094\n", 1746 | "15450 0.0953155 0.844488\n", 1747 | "15460 0.116761 0.806427\n", 1748 | "15470 0.117023 0.811413\n", 1749 | "15480 0.132824 0.779114\n", 1750 | "15490 0.0971955 0.849307\n", 1751 | "15500 0.0926577 0.852632\n", 1752 | "15510 0.113489 0.81374\n", 1753 | "15520 0.0840076 0.872244\n", 1754 | "15530 0.118299 0.804598\n", 1755 | "15540 0.115072 0.811413\n", 1756 | "15550 0.101658 0.834294\n", 1757 | "15560 0.107103 0.824543\n", 1758 | "15570 0.121557 0.801773\n", 1759 | "15580 0.104544 0.834238\n", 1760 | "15590 0.110348 0.825374\n", 1761 | "15600 0.112339 0.819612\n", 1762 | "15610 0.122323 0.804432\n", 1763 | "15620 0.125795 0.790416\n", 1764 | "15630 0.122517 0.798781\n", 1765 | "15640 0.109184 0.824654\n", 1766 | "15650 0.111276 0.814848\n", 1767 | "15660 0.127607 0.784211\n", 1768 | "15670 0.113899 0.816731\n", 1769 | "15680 0.10768 0.826759\n", 1770 | "15690 0.124153 0.794294\n", 1771 | "15700 0.12375 0.802604\n", 1772 | "15710 0.111819 0.82072\n", 1773 | "15720 0.102657 0.83723\n", 1774 | "15730 0.1006 0.840277\n", 1775 | "15740 0.114326 0.817064\n", 1776 | "15750 0.131492 0.786759\n", 1777 | "15760 0.123026 0.803712\n", 1778 | "15770 0.119725 0.796177\n", 1779 | "15780 0.104641 0.839945\n", 1780 | "15790 0.122027 0.808366\n", 1781 | "15800 0.103441 0.830859\n", 1782 | "15810 0.123458 0.797008\n", 1783 | "15820 0.116547 0.814571\n", 1784 | "15830 0.120087 0.803767\n", 1785 | "15840 0.118416 0.809474\n", 1786 | "15850 0.118989 0.808421\n", 1787 | "15860 0.12938 0.797119\n", 1788 | "15870 0.132937 0.781773\n", 1789 | "15880 0.105045 0.829917\n", 1790 | "15890 0.105593 0.830249\n", 1791 | "15900 0.1138 0.824488\n", 1792 | "15910 0.0936887 0.847258\n", 1793 | "15920 0.105811 0.829695\n", 1794 | "15930 0.105393 0.83036\n", 1795 | "15940 0.101997 0.840554\n", 1796 | "15950 0.115331 0.816676\n", 1797 | "15960 0.127241 0.787535\n", 1798 | "15970 0.120546 0.800388\n", 1799 | "15980 0.127531 0.790471\n", 1800 | "15990 0.104085 0.833795\n", 1801 | "16000 0.0991272 0.839169\n", 1802 | "Test accuracy: 0.804681\n", 1803 | "Saving Checkpoint...\n", 1804 | "16010 0.108437 0.824654\n", 1805 | "16020 0.113769 0.817008\n", 1806 | "16030 0.119006 0.806925\n", 1807 | "16040 0.132785 0.782548\n", 1808 | "16050 0.10315 0.833961\n", 1809 | "16060 0.119746 0.805429\n", 1810 | "16070 0.11704 0.81446\n", 1811 | "16080 0.109237 0.825762\n", 1812 | "16090 0.13602 0.77385\n", 1813 | "16100 0.10781 0.825596\n", 1814 | "16110 0.107937 0.823712\n", 1815 | "16120 0.101446 0.840332\n", 1816 | "16130 0.104439 0.82626\n", 1817 | "16140 0.121166 0.803324\n", 1818 | "16150 0.110599 0.823712\n", 1819 | "16160 0.123752 0.796676\n", 1820 | "16170 0.107343 0.82349\n", 1821 | "16180 0.114869 0.815789\n", 1822 | "16190 0.100413 0.842105\n", 1823 | "16200 0.113362 0.817895\n", 1824 | "16210 0.106268 0.827036\n", 1825 | "16220 0.107393 0.822604\n", 1826 | "16230 0.116588 0.813241\n", 1827 | "16240 0.111775 0.819945\n", 1828 | "16250 0.123935 0.798283\n", 1829 | "16260 0.0991871 0.843103\n", 1830 | "16270 0.107842 0.820443\n", 1831 | "16280 0.123825 0.804044\n", 1832 | "16290 0.11268 0.816731\n", 1833 | "16300 0.117428 0.811856\n", 1834 | "16310 0.116479 0.809197\n", 1835 | "16320 0.115741 0.818449\n", 1836 | "16330 0.127253 0.793906\n", 1837 | "16340 0.124356 0.8\n", 1838 | "16350 0.0977656 0.843601\n", 1839 | "16360 0.126592 0.795457\n", 1840 | "16370 0.116164 0.811967\n", 1841 | "16380 0.115203 0.815789\n", 1842 | "16390 0.127299 0.796011\n", 1843 | "16400 0.10399 0.831302\n", 1844 | "16410 0.118645 0.80277\n", 1845 | "16420 0.132126 0.787147\n", 1846 | "16430 0.128975 0.789584\n", 1847 | "16440 0.0952057 0.853573\n", 1848 | "16450 0.125934 0.79795\n", 1849 | "16460 0.1212 0.801828\n", 1850 | "16470 0.0801769 0.87241\n", 1851 | "16480 0.122046 0.80133\n", 1852 | "16490 0.125313 0.797175\n", 1853 | "16500 0.116663 0.814072\n", 1854 | "16510 0.119779 0.803213\n", 1855 | "16520 0.126396 0.794349\n", 1856 | "16530 0.123457 0.794958\n", 1857 | "16540 0.0975693 0.84687\n", 1858 | "16550 0.117199 0.80687\n", 1859 | "16560 0.101996 0.838061\n", 1860 | "16570 0.113031 0.821385\n", 1861 | "16580 0.121404 0.803767\n", 1862 | "16590 0.115105 0.814626\n", 1863 | "16600 0.119251 0.806759\n", 1864 | "16610 0.120718 0.803767\n", 1865 | "16620 0.0807739 0.876067\n", 1866 | "16630 0.103658 0.840665\n", 1867 | "16640 0.116014 0.806981\n", 1868 | "16650 0.117914 0.805485\n", 1869 | "16660 0.110693 0.823712\n", 1870 | "16670 0.11451 0.816565\n", 1871 | "16680 0.125484 0.799003\n", 1872 | "16690 0.10051 0.840499\n", 1873 | "16700 0.105492 0.832909\n", 1874 | "16710 0.119744 0.805706\n", 1875 | "16720 0.113654 0.812687\n", 1876 | "16730 0.100796 0.837895\n", 1877 | "16740 0.121796 0.796177\n", 1878 | "16750 0.113157 0.815679\n", 1879 | "16760 0.121809 0.799501\n", 1880 | "16770 0.114198 0.814294\n", 1881 | "16780 0.108549 0.830249\n", 1882 | "16790 0.120631 0.807368\n", 1883 | "16800 0.124865 0.803767\n", 1884 | "16810 0.137397 0.764986\n", 1885 | "16820 0.122348 0.800443\n", 1886 | "16830 0.122018 0.810803\n", 1887 | "16840 0.117954 0.810083\n", 1888 | "16850 0.112671 0.818892\n", 1889 | "16860 0.104582 0.830415\n", 1890 | "16870 0.122545 0.805485\n", 1891 | "16880 0.116784 0.80964\n", 1892 | "16890 0.11093 0.819169\n", 1893 | "16900 0.117902 0.802161\n", 1894 | "16910 0.0927494 0.850914\n", 1895 | "16920 0.119361 0.800609\n", 1896 | "16930 0.103953 0.836676\n", 1897 | "16940 0.123721 0.802826\n", 1898 | "16950 0.120412 0.806316\n", 1899 | "16960 0.112978 0.814017\n", 1900 | "16970 0.122664 0.794515\n", 1901 | "16980 0.107132 0.829862\n", 1902 | "16990 0.121149 0.811911\n", 1903 | "17000 0.122441 0.802604\n", 1904 | "Test accuracy: 0.804431\n", 1905 | "Saving Checkpoint...\n", 1906 | "17010 0.109525 0.818781\n", 1907 | "17020 0.106194 0.828809\n", 1908 | "17030 0.110666 0.820554\n", 1909 | "17040 0.0990247 0.847756\n", 1910 | "17050 0.116787 0.812078\n", 1911 | "17060 0.122445 0.798116\n", 1912 | "17070 0.116042 0.812078\n", 1913 | "17080 0.11826 0.808587\n", 1914 | "17090 0.0997505 0.84615\n", 1915 | "17100 0.112193 0.820222\n", 1916 | "17110 0.0979336 0.843158\n", 1917 | "17120 0.109779 0.817396\n", 1918 | "17130 0.101231 0.836454\n", 1919 | "17140 0.114165 0.820886\n", 1920 | "17150 0.0939307 0.848643\n", 1921 | "17160 0.103124 0.834958\n", 1922 | "17170 0.103094 0.831136\n", 1923 | "17180 0.121187 0.803158\n", 1924 | "17190 0.112634 0.815291\n", 1925 | "17200 0.11097 0.820055\n", 1926 | "17210 0.105698 0.832798\n", 1927 | "17220 0.102611 0.837618\n", 1928 | "17230 0.121051 0.806094\n", 1929 | "17240 0.116504 0.81518\n", 1930 | "17250 0.132871 0.785596\n", 1931 | "17260 0.116987 0.809529\n", 1932 | "17270 0.106715 0.827368\n", 1933 | "17280 0.10564 0.828199\n", 1934 | "17290 0.0958577 0.847756\n", 1935 | "17300 0.129191 0.785319\n", 1936 | "17310 0.115716 0.816842\n", 1937 | "17320 0.102966 0.835014\n", 1938 | "17330 0.124622 0.791247\n", 1939 | "17340 0.10501 0.82759\n", 1940 | "17350 0.102097 0.839224\n", 1941 | "17360 0.118966 0.810471\n", 1942 | "17370 0.103931 0.836399\n", 1943 | "17380 0.108638 0.82338\n", 1944 | "17390 0.105023 0.829418\n", 1945 | "17400 0.107006 0.826537\n", 1946 | "17410 0.11572 0.81446\n", 1947 | "17420 0.112834 0.810194\n", 1948 | "17430 0.119582 0.809141\n", 1949 | "17440 0.109376 0.825319\n", 1950 | "17450 0.115564 0.810637\n", 1951 | "17460 0.11662 0.820831\n", 1952 | "17470 0.121278 0.800277\n", 1953 | "17480 0.131046 0.783379\n", 1954 | "17490 0.118805 0.805097\n", 1955 | "17500 0.117288 0.805152\n", 1956 | "17510 0.111486 0.822659\n", 1957 | "17520 0.119687 0.808255\n", 1958 | "17530 0.125725 0.797341\n", 1959 | "17540 0.112914 0.814626\n", 1960 | "17550 0.12249 0.801884\n", 1961 | "17560 0.106087 0.823878\n", 1962 | "17570 0.10951 0.822493\n", 1963 | "17580 0.110412 0.821274\n", 1964 | "17590 0.11676 0.81108\n", 1965 | "17600 0.114492 0.814017\n", 1966 | "17610 0.100126 0.844709\n", 1967 | "17620 0.127 0.789252\n", 1968 | "17630 0.117337 0.810914\n", 1969 | "17640 0.131486 0.785429\n", 1970 | "17650 0.136878 0.774737\n", 1971 | "17660 0.128263 0.784986\n", 1972 | "17670 0.126149 0.786537\n", 1973 | "17680 0.127498 0.790471\n", 1974 | "17690 0.108011 0.828975\n", 1975 | "17700 0.115398 0.807091\n", 1976 | "17710 0.110063 0.82687\n", 1977 | "17720 0.106003 0.827756\n", 1978 | "17730 0.132862 0.779557\n", 1979 | "17740 0.126412 0.798504\n", 1980 | "17750 0.12614 0.790803\n", 1981 | "17760 0.119873 0.804211\n", 1982 | "17770 0.106065 0.82615\n", 1983 | "17780 0.098436 0.844765\n", 1984 | "17790 0.105339 0.828698\n", 1985 | "17800 0.106531 0.829197\n", 1986 | "17810 0.119573 0.806814\n", 1987 | "17820 0.141157 0.768753\n", 1988 | "17830 0.105093 0.830859\n", 1989 | "17840 0.0950118 0.844266\n", 1990 | "17850 0.111892 0.822825\n", 1991 | "17860 0.128509 0.793241\n", 1992 | "17870 0.12447 0.796565\n", 1993 | "17880 0.119654 0.805263\n", 1994 | "17890 0.115019 0.812964\n", 1995 | "17900 0.106119 0.834294\n", 1996 | "17910 0.117264 0.81169\n", 1997 | "17920 0.10211 0.83867\n", 1998 | "17930 0.104551 0.837784\n", 1999 | "17940 0.119542 0.803878\n", 2000 | "17950 0.137891 0.767091\n", 2001 | "17960 0.121963 0.803213\n", 2002 | "17970 0.114267 0.814127\n", 2003 | "17980 0.0950071 0.847258\n", 2004 | "17990 0.10812 0.828975\n", 2005 | "18000 0.116911 0.807091\n", 2006 | "Test accuracy: 0.804610\n", 2007 | "Saving Checkpoint...\n", 2008 | "18010 0.111309 0.821773\n", 2009 | "18020 0.111505 0.820222\n", 2010 | "18030 0.129078 0.783103\n", 2011 | "18040 0.11512 0.816011\n", 2012 | "18050 0.122577 0.800554\n", 2013 | "18060 0.113042 0.821108\n", 2014 | "18070 0.123863 0.800609\n", 2015 | "18080 0.119534 0.807701\n", 2016 | "18090 0.122912 0.799945\n", 2017 | "18100 0.106909 0.820388\n", 2018 | "18110 0.104947 0.832687\n", 2019 | "18120 0.100442 0.832244\n", 2020 | "18130 0.125929 0.794626\n", 2021 | "18140 0.119533 0.808753\n", 2022 | "18150 0.119685 0.808975\n", 2023 | "18160 0.102689 0.836454\n", 2024 | "18170 0.111632 0.819945\n", 2025 | "18180 0.122095 0.803102\n", 2026 | "18190 0.115704 0.813518\n", 2027 | "18200 0.10279 0.839391\n", 2028 | "18210 0.105855 0.836676\n", 2029 | "18220 0.108497 0.820499\n", 2030 | "18230 0.109633 0.830249\n", 2031 | "18240 0.1116 0.819668\n", 2032 | "18250 0.110294 0.829363\n", 2033 | "18260 0.127656 0.796898\n", 2034 | "18270 0.0952329 0.849363\n", 2035 | "18280 0.121078 0.804211\n", 2036 | "18290 0.112034 0.819335\n", 2037 | "18300 0.0950947 0.848033\n", 2038 | "18310 0.116713 0.815457\n", 2039 | "18320 0.114867 0.819557\n", 2040 | "18330 0.100633 0.835402\n", 2041 | "18340 0.115445 0.813075\n", 2042 | "18350 0.118024 0.809086\n", 2043 | "18360 0.113234 0.820942\n", 2044 | "18370 0.100681 0.840277\n", 2045 | "18380 0.10609 0.830305\n", 2046 | "18390 0.104555 0.831911\n", 2047 | "18400 0.111431 0.817064\n", 2048 | "18410 0.113858 0.824986\n", 2049 | "18420 0.13459 0.774903\n", 2050 | "18430 0.130437 0.785429\n", 2051 | "18440 0.104952 0.833186\n", 2052 | "18450 0.140342 0.769307\n", 2053 | "18460 0.109613 0.825042\n", 2054 | "18470 0.137576 0.774848\n", 2055 | "18480 0.101002 0.843379\n", 2056 | "18490 0.112056 0.822271\n", 2057 | "18500 0.130196 0.784765\n", 2058 | "18510 0.118204 0.809307\n", 2059 | "18520 0.120908 0.805928\n", 2060 | "18530 0.090313 0.854349\n", 2061 | "18540 0.111315 0.818615\n", 2062 | "18550 0.101439 0.836565\n", 2063 | "18560 0.108641 0.826094\n", 2064 | "18570 0.120997 0.806482\n", 2065 | "18580 0.0958723 0.845873\n", 2066 | "18590 0.106359 0.828975\n", 2067 | "18600 0.114813 0.811634\n", 2068 | "18610 0.12504 0.79795\n", 2069 | "18620 0.107056 0.831191\n", 2070 | "18630 0.121327 0.801108\n", 2071 | "18640 0.102532 0.830305\n", 2072 | "18650 0.114799 0.809917\n", 2073 | "18660 0.121041 0.807535\n", 2074 | "18670 0.115191 0.816067\n", 2075 | "18680 0.12649 0.792465\n", 2076 | "18690 0.134413 0.780609\n", 2077 | "18700 0.113208 0.816122\n", 2078 | "18710 0.110156 0.82554\n", 2079 | "18720 0.110348 0.822604\n", 2080 | "18730 0.105236 0.834681\n", 2081 | "18740 0.102099 0.834792\n", 2082 | "18750 0.0998498 0.841219\n", 2083 | "18760 0.102721 0.840776\n", 2084 | "18770 0.099276 0.841607\n", 2085 | "18780 0.126529 0.789972\n", 2086 | "18790 0.106658 0.830803\n", 2087 | "18800 0.112058 0.816565\n", 2088 | "18810 0.131829 0.78554\n", 2089 | "18820 0.111709 0.819778\n", 2090 | "18830 0.11707 0.805208\n", 2091 | "18840 0.0921732 0.852188\n", 2092 | "18850 0.111286 0.812022\n", 2093 | "18860 0.111156 0.820997\n", 2094 | "18870 0.117029 0.810471\n", 2095 | "18880 0.105557 0.830139\n", 2096 | "18890 0.115675 0.812355\n", 2097 | "18900 0.108483 0.822992\n", 2098 | "18910 0.0970879 0.846537\n", 2099 | "18920 0.108303 0.827812\n", 2100 | "18930 0.117721 0.805873\n", 2101 | "18940 0.129585 0.787258\n", 2102 | "18950 0.116749 0.813906\n", 2103 | "18960 0.125661 0.789418\n", 2104 | "18970 0.113843 0.814626\n", 2105 | "18980 0.118652 0.801219\n", 2106 | "18990 0.112253 0.822438\n", 2107 | "19000 0.106572 0.829695\n", 2108 | "Test accuracy: 0.804470\n", 2109 | "Saving Checkpoint...\n", 2110 | "19010 0.0942988 0.843712\n", 2111 | "19020 0.101932 0.834127\n", 2112 | "19030 0.136653 0.773795\n", 2113 | "19040 0.107603 0.828421\n", 2114 | "19050 0.113359 0.818892\n", 2115 | "19060 0.104337 0.83374\n", 2116 | "19070 0.112127 0.816731\n", 2117 | "19080 0.117647 0.804654\n", 2118 | "19090 0.113911 0.812632\n", 2119 | "19100 0.102642 0.83374\n", 2120 | "19110 0.110839 0.822382\n", 2121 | "19120 0.123376 0.803601\n", 2122 | "19130 0.11917 0.808255\n", 2123 | "19140 0.12442 0.801884\n", 2124 | "19150 0.111731 0.82072\n", 2125 | "19160 0.111161 0.819945\n", 2126 | "19170 0.129834 0.789584\n", 2127 | "19180 0.111945 0.811191\n", 2128 | "19190 0.0967387 0.844598\n", 2129 | "19200 0.13441 0.774404\n", 2130 | "19210 0.127924 0.787147\n", 2131 | "19220 0.138343 0.779557\n", 2132 | "19230 0.115656 0.810471\n", 2133 | "19240 0.097688 0.845152\n", 2134 | "19250 0.121041 0.798061\n", 2135 | "19260 0.121052 0.802105\n", 2136 | "19270 0.0992553 0.845651\n", 2137 | "19280 0.113724 0.816177\n", 2138 | "19290 0.093528 0.851745\n", 2139 | "19300 0.13008 0.7841\n", 2140 | "19310 0.106644 0.829252\n", 2141 | "19320 0.119696 0.807479\n", 2142 | "19330 0.124194 0.802327\n", 2143 | "19340 0.100947 0.839612\n", 2144 | "19350 0.114483 0.819668\n", 2145 | "19360 0.109165 0.82133\n", 2146 | "19370 0.128899 0.791801\n", 2147 | "19380 0.113676 0.810693\n", 2148 | "19390 0.120331 0.810582\n", 2149 | "19400 0.112235 0.818061\n", 2150 | "19410 0.11199 0.822881\n", 2151 | "19420 0.134657 0.781773\n", 2152 | "19430 0.104483 0.831524\n", 2153 | "19440 0.101504 0.839446\n", 2154 | "19450 0.106066 0.826427\n", 2155 | "19460 0.115716 0.813906\n", 2156 | "19470 0.13799 0.773186\n", 2157 | "19480 0.119554 0.807424\n", 2158 | "19490 0.123561 0.801219\n", 2159 | "19500 0.11076 0.818116\n", 2160 | "19510 0.0957234 0.849197\n", 2161 | "19520 0.100992 0.836399\n", 2162 | "19530 0.116719 0.810194\n", 2163 | "19540 0.1142 0.818061\n", 2164 | "19550 0.113885 0.813019\n", 2165 | "19560 0.0997916 0.841773\n", 2166 | "19570 0.112243 0.818116\n", 2167 | "19580 0.111906 0.817452\n", 2168 | "19590 0.123389 0.794848\n", 2169 | "19600 0.118923 0.809972\n", 2170 | "19610 0.117975 0.808199\n", 2171 | "19620 0.11735 0.803102\n", 2172 | "19630 0.121406 0.803047\n", 2173 | "19640 0.0968837 0.84615\n", 2174 | "19650 0.109678 0.820499\n", 2175 | "19660 0.0964626 0.847202\n", 2176 | "19670 0.121362 0.8\n", 2177 | "19680 0.105559 0.829252\n", 2178 | "19690 0.117979 0.806814\n", 2179 | "19700 0.091494 0.858338\n", 2180 | "19710 0.113088 0.816454\n", 2181 | "19720 0.105082 0.826648\n", 2182 | "19730 0.110304 0.819889\n", 2183 | "19740 0.109449 0.818947\n", 2184 | "19750 0.111864 0.816288\n", 2185 | "19760 0.113801 0.818504\n", 2186 | "19770 0.119849 0.805651\n", 2187 | "19780 0.111264 0.818947\n", 2188 | "19790 0.105633 0.83518\n", 2189 | "19800 0.108995 0.821884\n", 2190 | "19810 0.108215 0.829751\n", 2191 | "19820 0.126037 0.79241\n", 2192 | "19830 0.116978 0.808144\n", 2193 | "19840 0.116341 0.810083\n", 2194 | "19850 0.118773 0.803934\n", 2195 | "19860 0.109461 0.826371\n", 2196 | "19870 0.109926 0.821884\n", 2197 | "19880 0.101264 0.836454\n", 2198 | "19890 0.106267 0.833684\n", 2199 | "19900 0.103015 0.83518\n", 2200 | "19910 0.111576 0.819945\n", 2201 | "19920 0.109002 0.82349\n", 2202 | "19930 0.11233 0.826205\n", 2203 | "19940 0.109993 0.822382\n", 2204 | "19950 0.123887 0.799889\n", 2205 | "19960 0.120551 0.808366\n", 2206 | "19970 0.108768 0.818283\n", 2207 | "19980 0.0962115 0.845983\n", 2208 | "19990 0.11288 0.810416\n", 2209 | "20000 0.114933 0.812078\n", 2210 | "Test accuracy: 0.804154\n", 2211 | "Saving Checkpoint...\n", 2212 | "20010 0.122235 0.79795\n", 2213 | "20020 0.114602 0.813075\n", 2214 | "20030 0.118491 0.808476\n", 2215 | "20040 0.119735 0.800776\n", 2216 | "20050 0.105898 0.832022\n", 2217 | "20060 0.113931 0.816399\n", 2218 | "20070 0.116164 0.813352\n", 2219 | "20080 0.100463 0.837784\n", 2220 | "20090 0.100338 0.842659\n", 2221 | "20100 0.109698 0.824709\n", 2222 | "20110 0.121273 0.802271\n", 2223 | "20120 0.123322 0.799668\n", 2224 | "20130 0.121915 0.802161\n", 2225 | "20140 0.0879529 0.860665\n", 2226 | "20150 0.121149 0.804875\n", 2227 | "20160 0.118999 0.811911\n", 2228 | "20170 0.100091 0.841551\n", 2229 | "20180 0.118236 0.810748\n", 2230 | "20190 0.104253 0.831524\n", 2231 | "20200 0.103743 0.83723\n", 2232 | "20210 0.121666 0.80133\n", 2233 | "20220 0.0990006 0.843601\n", 2234 | "20230 0.108094 0.830139\n", 2235 | "20240 0.121983 0.805097\n", 2236 | "20250 0.10973 0.824765\n", 2237 | "20260 0.123717 0.798006\n", 2238 | "20270 0.107688 0.8241\n", 2239 | "20280 0.10777 0.827091\n", 2240 | "20290 0.100557 0.84349\n", 2241 | "20300 0.114636 0.814681\n", 2242 | "20310 0.120001 0.803878\n", 2243 | "20320 0.115595 0.810471\n", 2244 | "20330 0.118374 0.808698\n", 2245 | "20340 0.146784 0.758283\n", 2246 | "20350 0.112244 0.825706\n", 2247 | "20360 0.0990777 0.842105\n", 2248 | "20370 0.0953104 0.846205\n", 2249 | "20380 0.10968 0.826039\n", 2250 | "20390 0.108077 0.82554\n", 2251 | "20400 0.128294 0.794294\n", 2252 | "20410 0.131047 0.785928\n", 2253 | "20420 0.126411 0.795623\n", 2254 | "20430 0.127869 0.789307\n", 2255 | "20440 0.103041 0.83374\n", 2256 | "20450 0.102804 0.836731\n", 2257 | "20460 0.111487 0.822992\n", 2258 | "20470 0.111152 0.815291\n", 2259 | "20480 0.112178 0.821108\n", 2260 | "20490 0.112034 0.825983\n", 2261 | "20500 0.111935 0.81651\n", 2262 | "20510 0.102804 0.837064\n", 2263 | "20520 0.118254 0.810526\n", 2264 | "20530 0.11628 0.816011\n", 2265 | "20540 0.109625 0.827756\n", 2266 | "20550 0.0952481 0.850305\n", 2267 | "20560 0.122612 0.793684\n", 2268 | "20570 0.120322 0.805651\n", 2269 | "20580 0.11441 0.812299\n", 2270 | "20590 0.117446 0.81036\n", 2271 | "20600 0.0901867 0.863823\n", 2272 | "20610 0.115754 0.810028\n", 2273 | "20620 0.105577 0.830748\n", 2274 | "20630 0.120389 0.805817\n", 2275 | "20640 0.120454 0.80759\n", 2276 | "20650 0.100235 0.835125\n", 2277 | "20660 0.111495 0.818006\n", 2278 | "20670 0.110502 0.81856\n", 2279 | "20680 0.122358 0.806371\n", 2280 | "20690 0.130118 0.782548\n", 2281 | "20700 0.109222 0.828532\n", 2282 | "20710 0.121231 0.803989\n", 2283 | "20720 0.101075 0.838338\n", 2284 | "20730 0.116849 0.808199\n", 2285 | "20740 0.107606 0.825152\n", 2286 | "20750 0.132601 0.782105\n", 2287 | "20760 0.109207 0.821828\n", 2288 | "20770 0.114937 0.818726\n", 2289 | "20780 0.110347 0.825762\n", 2290 | "20790 0.088234 0.861496\n", 2291 | "20800 0.126767 0.799945\n", 2292 | "20810 0.119013 0.804875\n", 2293 | "20820 0.134929 0.779169\n", 2294 | "20830 0.115794 0.814571\n", 2295 | "20840 0.111794 0.818504\n", 2296 | "20850 0.131025 0.788809\n", 2297 | "20860 0.11178 0.819446\n", 2298 | "20870 0.144527 0.762881\n", 2299 | "20880 0.119995 0.804321\n", 2300 | "20890 0.105294 0.833019\n", 2301 | "20900 0.102854 0.832078\n", 2302 | "20910 0.129167 0.786981\n", 2303 | "20920 0.114063 0.815457\n", 2304 | "20930 0.112512 0.822271\n", 2305 | "20940 0.102853 0.835235\n", 2306 | "20950 0.123285 0.799612\n", 2307 | "20960 0.0965736 0.84615\n", 2308 | "20970 0.11738 0.805817\n", 2309 | "20980 0.120096 0.796898\n", 2310 | "20990 0.123196 0.802826\n", 2311 | "21000 0.103629 0.825319\n", 2312 | "Test accuracy: 0.803898\n", 2313 | "Saving Checkpoint...\n", 2314 | "21010 0.107886 0.828255\n", 2315 | "21020 0.125657 0.792465\n", 2316 | "21030 0.107797 0.826593\n", 2317 | "21040 0.133464 0.792133\n", 2318 | "21050 0.105503 0.832853\n", 2319 | "21060 0.117064 0.811524\n", 2320 | "21070 0.105838 0.83097\n", 2321 | "21080 0.105277 0.832465\n", 2322 | "21090 0.123081 0.799557\n", 2323 | "21100 0.106907 0.82831\n", 2324 | "21110 0.119799 0.808587\n", 2325 | "21120 0.124201 0.799391\n", 2326 | "21130 0.11046 0.821939\n", 2327 | "21140 0.126554 0.793019\n", 2328 | "21150 0.11788 0.817507\n", 2329 | "21160 0.116162 0.816399\n", 2330 | "21170 0.111731 0.825983\n", 2331 | "21180 0.109928 0.825817\n", 2332 | "21190 0.10448 0.836122\n", 2333 | "21200 0.11881 0.799114\n", 2334 | "21210 0.109895 0.825429\n", 2335 | "21220 0.123807 0.80349\n", 2336 | "21230 0.109541 0.820222\n", 2337 | "21240 0.122624 0.806759\n", 2338 | "21250 0.0991788 0.83518\n", 2339 | "21260 0.115768 0.807036\n", 2340 | "21270 0.104475 0.832576\n", 2341 | "21280 0.12586 0.793961\n", 2342 | "21290 0.110902 0.819778\n", 2343 | "21300 0.0921605 0.85374\n", 2344 | "21310 0.113758 0.812632\n", 2345 | "21320 0.11278 0.822105\n", 2346 | "21330 0.103895 0.838283\n", 2347 | "21340 0.105246 0.828199\n", 2348 | "21350 0.116379 0.808587\n", 2349 | "21360 0.105386 0.831524\n", 2350 | "21370 0.11206 0.81795\n", 2351 | "21380 0.120032 0.806039\n", 2352 | "21390 0.114566 0.81867\n", 2353 | "21400 0.131621 0.783878\n", 2354 | "21410 0.112753 0.818449\n", 2355 | "21420 0.104271 0.833186\n", 2356 | "21430 0.120081 0.807313\n", 2357 | "21440 0.118974 0.805429\n", 2358 | "21450 0.119249 0.803435\n", 2359 | "21460 0.100996 0.842881\n", 2360 | "21470 0.0996562 0.836565\n", 2361 | "21480 0.109608 0.823102\n", 2362 | "21490 0.114207 0.819723\n", 2363 | "21500 0.112327 0.816122\n", 2364 | "21510 0.106841 0.827479\n", 2365 | "21520 0.12173 0.799778\n", 2366 | "21530 0.103258 0.837008\n", 2367 | "21540 0.118925 0.814792\n", 2368 | "21550 0.112005 0.816288\n", 2369 | "21560 0.106969 0.827867\n", 2370 | "21570 0.126746 0.796676\n", 2371 | "21580 0.0984586 0.844765\n", 2372 | "21590 0.130401 0.784931\n", 2373 | "21600 0.0978923 0.838504\n", 2374 | "21610 0.107903 0.830249\n", 2375 | "21620 0.105781 0.830582\n", 2376 | "21630 0.101146 0.838338\n", 2377 | "21640 0.0955761 0.847701\n", 2378 | "21650 0.102736 0.834515\n", 2379 | "21660 0.1225 0.798006\n", 2380 | "21670 0.103929 0.835291\n", 2381 | "21680 0.102683 0.838172\n", 2382 | "21690 0.121505 0.800111\n", 2383 | "21700 0.111525 0.822659\n", 2384 | "21710 0.12025 0.805263\n", 2385 | "21720 0.112742 0.812909\n", 2386 | "21730 0.11262 0.815014\n", 2387 | "21740 0.125623 0.802992\n", 2388 | "21750 0.106915 0.828144\n", 2389 | "21760 0.112248 0.821773\n", 2390 | "21770 0.116053 0.814238\n", 2391 | "21780 0.113079 0.820554\n", 2392 | "21790 0.131318 0.790637\n", 2393 | "21800 0.103484 0.83097\n", 2394 | "21810 0.108393 0.825485\n", 2395 | "21820 0.121955 0.801274\n", 2396 | "21830 0.107647 0.826648\n", 2397 | "21840 0.110395 0.829141\n", 2398 | "21850 0.0929463 0.852244\n", 2399 | "21860 0.116619 0.80964\n", 2400 | "21870 0.128099 0.798615\n", 2401 | "21880 0.130748 0.783324\n", 2402 | "21890 0.112331 0.822161\n", 2403 | "21900 0.0965244 0.85036\n", 2404 | "21910 0.113739 0.813795\n", 2405 | "21920 0.129687 0.782992\n", 2406 | "21930 0.0981256 0.846593\n", 2407 | "21940 0.108331 0.820443\n", 2408 | "21950 0.103709 0.831856\n", 2409 | "21960 0.127678 0.785762\n", 2410 | "21970 0.111578 0.818726\n", 2411 | "21980 0.13229 0.791302\n", 2412 | "21990 0.111728 0.816676\n", 2413 | "22000 0.119403 0.801274\n", 2414 | "Test accuracy: 0.803972\n", 2415 | "Saving Checkpoint...\n", 2416 | "22010 0.106112 0.832576\n", 2417 | "22020 0.111247 0.82144\n", 2418 | "22030 0.125511 0.797784\n", 2419 | "22040 0.112746 0.805762\n", 2420 | "22050 0.103613 0.835291\n", 2421 | "22060 0.0988094 0.842216\n", 2422 | "22070 0.109808 0.82277\n" 2423 | ] 2424 | }, 2425 | { 2426 | "ename": "KeyboardInterrupt", 2427 | "evalue": "", 2428 | "output_type": "error", 2429 | "traceback": [ 2430 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 2431 | "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", 2432 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mk\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m100000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mx_batch\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my_batch\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mreader\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_batch\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m50\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0m_\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mloss_value\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my_value\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msess\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mtrain_op\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mloss\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my_conv\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m{\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mx_batch\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mownership\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0my_batch\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 6\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mk\u001b[0m \u001b[1;33m%\u001b[0m \u001b[1;36m10\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[0macc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0maccuracy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0meval\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfeed_dict\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m{\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mx_batch\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mownership\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0my_batch\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 2433 | "\u001b[1;32m/home/justin/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc\u001b[0m in \u001b[0;36mrun\u001b[1;34m(self, fetches, feed_dict)\u001b[0m\n\u001b[0;32m 343\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 344\u001b[0m \u001b[1;31m# Run request and get response.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 345\u001b[1;33m \u001b[0mresults\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_do_run\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtarget_list\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0munique_fetch_targets\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeed_dict_string\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 346\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 347\u001b[0m \u001b[1;31m# User may have fetched the same tensor multiple times, but we\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 2434 | "\u001b[1;32m/home/justin/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc\u001b[0m in \u001b[0;36m_do_run\u001b[1;34m(self, target_list, fetch_list, feed_dict)\u001b[0m\n\u001b[0;32m 402\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 403\u001b[0m return tf_session.TF_Run(self._session, feed_dict, fetch_list,\n\u001b[1;32m--> 404\u001b[1;33m target_list)\n\u001b[0m\u001b[0;32m 405\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 406\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mStatusNotOK\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 2435 | "\u001b[1;31mKeyboardInterrupt\u001b[0m: " 2436 | ] 2437 | } 2438 | ], 2439 | "source": [ 2440 | "training_accuracies = []\n", 2441 | "test_accuracies = []\n", 2442 | "for k in range(100000):\n", 2443 | " x_batch, y_batch = reader.get_batch(50)\n", 2444 | " _, loss_value, y_value = sess.run([train_op, loss, y_conv], feed_dict={x:x_batch, ownership:y_batch})\n", 2445 | " if k % 10 == 0:\n", 2446 | " acc = accuracy.eval(feed_dict={x:x_batch, ownership:y_batch})\n", 2447 | " training_accuracies.append(acc)\n", 2448 | " print k, loss_value, acc\n", 2449 | " \n", 2450 | " if k % 1000 == 0:\n", 2451 | " test_accuracy = model_eval.test_accuracy(test_features, test_targets, x, ownership, correct_count)\n", 2452 | " test_accuracies.append(test_accuracy)\n", 2453 | " print \"Test accuracy: %f\" %test_accuracy\n", 2454 | " if k % 1000 == 0:\n", 2455 | " print \"Saving Checkpoint...\"\n", 2456 | " saver.save(sess, ckpt_path)\n", 2457 | " " 2458 | ] 2459 | }, 2460 | { 2461 | "cell_type": "code", 2462 | "execution_count": 27, 2463 | "metadata": { 2464 | "collapsed": true 2465 | }, 2466 | "outputs": [], 2467 | "source": [ 2468 | "import matplotlib.pyplot as plt\n", 2469 | "import numpy as np" 2470 | ] 2471 | }, 2472 | { 2473 | "cell_type": "code", 2474 | "execution_count": 9, 2475 | "metadata": { 2476 | "collapsed": true 2477 | }, 2478 | "outputs": [], 2479 | "source": [ 2480 | "def rolling_mean(number_list, window = 20):\n", 2481 | " means = np.zeros(len(number_list))\n", 2482 | " for i in xrange(len(means)):\n", 2483 | " sub_window = number_list[i-window+1:i+1]\n", 2484 | " means[i] = np.mean(sub_window)\n", 2485 | " return means" 2486 | ] 2487 | }, 2488 | { 2489 | "cell_type": "code", 2490 | "execution_count": 17, 2491 | "metadata": { 2492 | "collapsed": false 2493 | }, 2494 | "outputs": [ 2495 | { 2496 | "name": "stdout", 2497 | "output_type": "stream", 2498 | "text": [ 2499 | "10000\n" 2500 | ] 2501 | } 2502 | ], 2503 | "source": [ 2504 | "print len(training_accuracies)\n", 2505 | "means = rolling_mean(test_accuracies, 20)\n", 2506 | "plt.plot(test_accuracies, label=\"Batch Accuracy\")\n", 2507 | "plt.plot(means, label= \"Rolling Mean\")\n", 2508 | "plt.title(\"Good Data Mixing 5layer 64filters\")\n", 2509 | "plt.xlabel(\"Batch Num / 10\")\n", 2510 | "plt.ylabel(\"Accuracy\")\n", 2511 | "plt.ylim([.6,1])\n", 2512 | "plt.legend(loc=3)\n", 2513 | "plt.show()" 2514 | ] 2515 | }, 2516 | { 2517 | "cell_type": "code", 2518 | "execution_count": 11, 2519 | "metadata": { 2520 | "collapsed": false 2521 | }, 2522 | "outputs": [ 2523 | { 2524 | "name": "stdout", 2525 | "output_type": "stream", 2526 | "text": [ 2527 | "0\n", 2528 | "500\n", 2529 | "1000\n", 2530 | "1500\n", 2531 | "2000\n", 2532 | "2500\n", 2533 | "3000\n", 2534 | "3500\n", 2535 | "4000\n", 2536 | "4500\n", 2537 | "5000\n", 2538 | "5500\n", 2539 | "6000\n", 2540 | "6500\n", 2541 | "7000\n", 2542 | "7500\n", 2543 | "8000\n", 2544 | "8500\n", 2545 | "9000\n", 2546 | "9500\n", 2547 | "10000\n", 2548 | "10500\n", 2549 | "11000\n", 2550 | "11500\n", 2551 | "12000\n", 2552 | "12500\n", 2553 | "13000\n", 2554 | "13500\n", 2555 | "14000\n", 2556 | "14500\n", 2557 | "15000\n", 2558 | "15500\n", 2559 | "16000\n", 2560 | "16500\n", 2561 | "17000\n", 2562 | "17500\n", 2563 | "18000\n", 2564 | "18500\n", 2565 | "19000\n", 2566 | "19500\n", 2567 | "20000\n", 2568 | "20500\n", 2569 | "21000\n", 2570 | "21500\n", 2571 | "22000\n", 2572 | "22500\n", 2573 | "23000\n", 2574 | "23500\n", 2575 | "24000\n", 2576 | "24500\n", 2577 | "25000\n", 2578 | "25500\n", 2579 | "26000\n", 2580 | "26500\n", 2581 | "27000\n", 2582 | "27500\n", 2583 | "28000\n", 2584 | "28500\n", 2585 | "29000\n", 2586 | "29500\n", 2587 | "30000\n", 2588 | "30500\n", 2589 | "31000\n", 2590 | "31500\n", 2591 | "32000\n", 2592 | "32500\n", 2593 | "33000\n", 2594 | "33500\n", 2595 | "34000\n", 2596 | "34500\n", 2597 | "35000\n", 2598 | "35500\n", 2599 | "36000\n", 2600 | "36500\n", 2601 | "37000\n", 2602 | "37500\n", 2603 | "38000\n", 2604 | "38500\n", 2605 | "39000\n", 2606 | "39500\n" 2607 | ] 2608 | } 2609 | ], 2610 | "source": [ 2611 | "accuracies = []\n", 2612 | "y_trues = []\n", 2613 | "y_preds = []\n", 2614 | "feature_cubes = []\n", 2615 | "for i in xrange(len(test_features)):\n", 2616 | " if i%500 == 0:\n", 2617 | " print i\n", 2618 | " x_, y_ = test_features[i], test_targets[i]\n", 2619 | " y_val, y_pred, acc = sess.run([y_conv, prediction, accuracy], feed_dict={x:[x_], ownership:[y_]})\n", 2620 | " accuracies.append(acc)\n", 2621 | " y_trues.append(np.reshape(y_, [19,19]))\n", 2622 | " y_preds.append(np.reshape(y_pred[0], [19,19]))\n", 2623 | " feature_cubes.append(x_)" 2624 | ] 2625 | }, 2626 | { 2627 | "cell_type": "code", 2628 | "execution_count": 21, 2629 | "metadata": { 2630 | "collapsed": false 2631 | }, 2632 | "outputs": [ 2633 | { 2634 | "name": "stdout", 2635 | "output_type": "stream", 2636 | "text": [ 2637 | "212 0.961219\n", 2638 | "*0*1*0****0*1*1**** 1111000000011100000 1111100000011110000\n", 2639 | "*1*110****010**010* 1111100000010000000 1111100000010100000\n", 2640 | "*11100***0*10000100 1111000000010000000 1111000000010000000\n", 2641 | "11000******1*11100* 1100000000111111000 1100000000110111000\n", 2642 | "10*******001****110 1000000000011111110 1000000000011111110\n", 2643 | "*0******0*101*1*10* 0000000000001111111 1000000000001111111\n", 2644 | "***0******1011**100 0000000000001111111 0000000000001111111\n", 2645 | "*01*1****1001*10*11 0000000000001111111 0000000000001111111\n", 2646 | "0***000*100101*1*** 0000000000000111111 0000000000000111111\n", 2647 | "10000101101*001**** 1000010000000011111 1000010000000011111\n", 2648 | "11101110001*0111*** 1110111000000111111 1110111000000111111\n", 2649 | "*0111**001*0**0011* 1111111000000000111 1111111000000100111\n", 2650 | "*****1001*1*00*001* 1111110000000000011 1111110000000000011\n", 2651 | "******10010**10*001 1111111000000000001 1111111000000000001\n", 2652 | "******1*0100001001* 1111111000000010011 1111111000000010011\n", 2653 | "**1**01*1010*01011* 1111111110100010111 1111111110100010111\n", 2654 | "****101*10110*1101* 1111111111110111111 1111111010110111111\n", 2655 | "***1*100001*11***** 1111110111111111111 1111110000111111111\n", 2656 | "****1****011******* 1111111011111111111 1111110000111111111\n" 2657 | ] 2658 | } 2659 | ], 2660 | "source": [ 2661 | "idx = 3500\n", 2662 | "y_pred = y_preds[idx]\n", 2663 | "y_true = y_trues[idx]\n", 2664 | "feature_cube = feature_cubes[idx]\n", 2665 | "\n", 2666 | "print test_move_numbers[idx], accuracies[idx]\n", 2667 | "model_eval.print_info(feature_cube, y_pred, y_true)\n", 2668 | "\n", 2669 | " " 2670 | ] 2671 | }, 2672 | { 2673 | "cell_type": "code", 2674 | "execution_count": 22, 2675 | "metadata": { 2676 | "collapsed": true 2677 | }, 2678 | "outputs": [], 2679 | "source": [ 2680 | "import pandas as pd" 2681 | ] 2682 | }, 2683 | { 2684 | "cell_type": "code", 2685 | "execution_count": 23, 2686 | "metadata": { 2687 | "collapsed": true 2688 | }, 2689 | "outputs": [], 2690 | "source": [ 2691 | "df = pd.DataFrame()\n", 2692 | "df[\"Move Num\"] = test_move_numbers\n", 2693 | "df[\"Accuracy\"] = accuracies\n", 2694 | "grouped = df.groupby(\"Move Num\").aggregate(np.mean)\n" 2695 | ] 2696 | }, 2697 | { 2698 | "cell_type": "code", 2699 | "execution_count": 29, 2700 | "metadata": { 2701 | "collapsed": false 2702 | }, 2703 | "outputs": [], 2704 | "source": [ 2705 | "grouped.plot()\n", 2706 | "plt.title(\"Accuracy by move number, 5layer 64filters\")\n", 2707 | "plt.xlabel(\"Move Number\")\n", 2708 | "plt.ylabel(\"Accuracy\")\n", 2709 | "plt.show()" 2710 | ] 2711 | }, 2712 | { 2713 | "cell_type": "code", 2714 | "execution_count": 33, 2715 | "metadata": { 2716 | "collapsed": false 2717 | }, 2718 | "outputs": [], 2719 | "source": [ 2720 | "plot = plt.hist(df[df[\"Move Num\"] == 250][\"Accuracy\"].values, bins = 40)\n", 2721 | "plt.show()" 2722 | ] 2723 | }, 2724 | { 2725 | "cell_type": "code", 2726 | "execution_count": null, 2727 | "metadata": { 2728 | "collapsed": true 2729 | }, 2730 | "outputs": [], 2731 | "source": [] 2732 | } 2733 | ], 2734 | "metadata": { 2735 | "kernelspec": { 2736 | "display_name": "Python 2", 2737 | "language": "python", 2738 | "name": "python2" 2739 | }, 2740 | "language_info": { 2741 | "codemirror_mode": { 2742 | "name": "ipython", 2743 | "version": 2 2744 | }, 2745 | "file_extension": ".py", 2746 | "mimetype": "text/x-python", 2747 | "name": "python", 2748 | "nbconvert_exporter": "python", 2749 | "pygments_lexer": "ipython2", 2750 | "version": "2.7.10" 2751 | } 2752 | }, 2753 | "nbformat": 4, 2754 | "nbformat_minor": 0 2755 | } 2756 | -------------------------------------------------------------------------------- /data/input/move_to_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | val=0 3 | count=0 4 | for file in ./train/*; do 5 | if ! ((val % 100)); then 6 | mv "$file" ./test 7 | echo "$file" 8 | let "count+=1" 9 | fi 10 | let "val+=1" 11 | done 12 | echo "$count" -------------------------------------------------------------------------------- /data/working/board_eval_cnn_5layer.ckpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/data/working/board_eval_cnn_5layer.ckpt -------------------------------------------------------------------------------- /munge/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/munge/__init__.py -------------------------------------------------------------------------------- /munge/bit_writer.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | 4 | def write_sequence(sequence, datafile): 5 | bit_pos = 1 6 | this_byte = 0 7 | num_bytes = 0 8 | for bit in sequence: 9 | if bit == 1: 10 | this_byte = this_byte | bit_pos 11 | bit_pos *= 2 12 | if bit_pos >= 256: 13 | bit_pos = 1 14 | datafile.write(chr(this_byte)) 15 | num_bytes += 1 16 | this_byte = 0 17 | if bit_pos > 1: 18 | datafile.write(chr(this_byte)) 19 | num_bytes += 1 20 | return num_bytes 21 | 22 | def read_sequence(datafile, num_bits): 23 | bits_read = 0 24 | bit_pos = 256 25 | this_byte = 0 26 | sequence = np.zeros(num_bits) 27 | while(bits_read < num_bits): 28 | if bit_pos >= 256: 29 | bit_pos = 1 30 | this_byte = ord(datafile.read(1)) 31 | #print this_byte 32 | #if not this_byte: 33 | # raise EOFError("At the end of the file") 34 | if this_byte&bit_pos != 0: 35 | sequence[bits_read] = 1.0 36 | else: 37 | sequence[bits_read] = 0.0 38 | bit_pos *=2 39 | bits_read +=1 40 | return sequence 41 | 42 | -------------------------------------------------------------------------------- /munge/finish_games.py: -------------------------------------------------------------------------------- 1 | #this file contains methods with call gnugo to finish games from sgf files (remove dead stones) 2 | #after removing dead stones we can easily determine final board ownership 3 | 4 | 5 | import subprocess 6 | import threading 7 | import re 8 | import os 9 | import numpy as np 10 | import gomill 11 | import gomill.sgf 12 | import sys 13 | from ..thirdparty import GoBoard 14 | 15 | 16 | 17 | #sgf_filepath - str, path to the sgf file we need to complete 18 | #gnugo will write the resutls to dest_file 19 | #returns True if successful and False if something went wrong 20 | def finish_sgf(sgf_filepath, dest_file, board_size=19, difference_threshold=6, 21 | year_lowerbound=0, gnugo_timeout=10): 22 | 23 | 24 | sgf_file = open(sgf_filepath, 'r') 25 | contents = sgf_file.read() 26 | sgf_file.close() 27 | 28 | move_count = contents.count(";") 29 | 30 | #I added this to speed up the process. Many files in the dataset were incomplete games, even though 31 | #the final score was recorded. gnugo would take a long time to finish these incomplete games. 32 | if move_count < 150: 33 | print "%s only had %d moves" %(sgf_filepath, move_count) 34 | return False 35 | 36 | if contents.find( 'SZ[%d]' %board_size ) < 0: 37 | print( 'not %dx%d, skipping: %s' %(board_size, board_size, sgf_filepath)) 38 | return False 39 | 40 | #we first determine the recorded score in the sgf file, this can be compared with what gnugo determines the score to be 41 | match_str = r'RE\[([a-zA-Z0-9_\+\.]+)\]' 42 | m = re.search(match_str,contents) 43 | if m: 44 | result_str = m.group(1) 45 | pieces = result_str.split("+") 46 | try: 47 | winner = pieces[0] 48 | if pieces[1] == "" or pieces[1][0].lower() == "r" or pieces[1][0].lower() == "t": 49 | print "Skipping because result was: %s" %result_str 50 | return False 51 | score = float(pieces[1]) 52 | if winner == "W": 53 | score*= -1 54 | except: 55 | print "Error parsing result, result_str = %s, file: %s" %(result_str, sgf_filepath) 56 | return False 57 | else: 58 | print "Couldn't find result, skipping: %s" %sgf_filepath 59 | return False 60 | 61 | #check the date of the game and skip if it is too old 62 | match_str = r"DT\[([0-9]+)" 63 | m = re.search(match_str,contents) 64 | if m: 65 | year = int(m.group(1)) 66 | if year < year_lowerbound: 67 | print "Game is too old: %s" %sgf_filepath 68 | return False 69 | 70 | #we call gnugo with the appropriate flags to finish the game. gnugo will write the results to dest_file 71 | p = subprocess.Popen(["gnugo", "-l", sgf_filepath, "--outfile", dest_file, \ 72 | "--score", "aftermath", "--capture-all-dead", "--chinese-rules"], stdout = subprocess.PIPE) 73 | timer = threading.Timer(gnugo_timeout, p.kill) 74 | try: 75 | timer.start() 76 | output, err = p.communicate() #gnugo will print the final score, we check this with whats written in the sgffile 77 | finally: 78 | timer.cancel() 79 | m = re.search(r"([A-Za-z]+) wins by ([0-9\.]+) points", output) 80 | if m is None: 81 | return False 82 | winner = m.group(1) 83 | gnu_score = float(m.group(2)) 84 | if winner == "White": 85 | gnu_score*=-1 86 | 87 | if np.abs(score - gnu_score) > difference_threshold: 88 | print "GNU messed up finishing this game... removing %s" %dest_file 89 | os.remove(dest_file) 90 | return False 91 | return True 92 | 93 | #gnu_sgf_outputfile - str, filepath to the file gnugo output 94 | #we parse this file and get the final state of the board from it. Seki positions both groups are considered alive 95 | #and we randomly assign the spaces between seki groups 96 | def get_final_ownership(gnu_sgf_outputfile, board_size = 19): 97 | sgffile = open(gnu_sgf_outputfile, 'r') 98 | sgfContents = sgffile.read() 99 | sgffile.close() 100 | 101 | sgf = gomill.sgf.Sgf_game.from_string( sgfContents ) 102 | 103 | if sgf.get_size() != board_size: 104 | print ('boardsize not %d, ignoring' %board_size ) 105 | return 106 | 107 | board = GoBoard.GoBoard(board_size) 108 | for move in sgf.root.get_setup_stones()[0]: 109 | board.applyMove("b", move) 110 | for move in sgf.root.get_setup_stones()[1]: 111 | board.applyMove("w", move) 112 | 113 | moveIdx = 0 114 | for it in sgf.main_sequence_iter(): 115 | (color,move) = it.get_move() 116 | if color != None and move != None: 117 | (row,col) = move 118 | board.applyMove( color, (row,col) ) 119 | moveIdx = moveIdx + 1 120 | 121 | black_ownership = board.get_final_ownership('b') 122 | white_ownership = np.zeros((board_size, board_size)) 123 | for i in xrange(len(white_ownership)): 124 | for j in xrange(len(white_ownership)): 125 | if black_ownership[i][j] == 0: 126 | white_ownership[i][j] = 1 127 | else: 128 | white_ownership[i][j] = 0 129 | 130 | 131 | return black_ownership, white_ownership 132 | 133 | def finish_sgf_and_get_ownership(sgf_file_path, sgf_file_name, completed_dir, board_size = 19, difference_threshold = 6, year_lowerbound = 0): 134 | dest_file = completed_dir + os.sep + sgf_file_name + "c" 135 | 136 | #first we check if gnugo has already finished this game, if so we just open the .sfgc file can grab final ownership 137 | #if we haven't munged already, munge it now. munging may fail if gnugo believes final score is more the difference_threshold away. 138 | if not os.path.exists(dest_file): 139 | if not(finish_sgf(sgf_file_path, dest_file, board_size, difference_threshold, year_lowerbound)): 140 | return None, None #failed to finish the game 141 | else: 142 | print "gnugo has already finished %s" %dest_file 143 | black_ownership, white_ownership = get_final_ownership(dest_file) 144 | return black_ownership, white_ownership 145 | 146 | #this method was used for testing purposes only, the main method will call finish_sgf_and_get_ownership 147 | def traverse_directory( source_dir_path, dest_dir_path): 148 | file_count = 0 149 | for subdir, dirs, files in os.walk(source_dir_path): 150 | for file in files: 151 | filepath = subdir + os.sep + file 152 | if filepath.endswith(".sgf"): 153 | print file_count 154 | try: 155 | finish_sgf(filepath, file, dest_dir_path) 156 | except: 157 | print "Uncaught exception for %s" %filepath 158 | file_count+=1 159 | print "There were %d files" %(file_count) 160 | 161 | ###testing purposes 162 | if __name__ == '__main__': 163 | source_dir = "/home/justin/Programming/GoAI/Completing_Go_Games/pro_games/1999/1/" 164 | dest_dir = "/home/justin/Programming/GoAI/Completing_Go_Games/finished_games/" 165 | filename = "YooChangHyuk-YangJaeHo24553.sgf" 166 | 167 | black_ownership, white_ownership = finish_sgf_and_get_ownership(source_dir + filename) 168 | 169 | for i in xrange(len(black_ownership)): 170 | row_str = "" 171 | for j in xrange(len(black_ownership)): 172 | row_str += str(int(black_ownership[i][j])) 173 | print row_str 174 | 175 | -------------------------------------------------------------------------------- /munge/go_dataset_preprocessor.py: -------------------------------------------------------------------------------- 1 | #Note this file was modified from Hugh Perkins kgsgo_dataset_preprocessor library. I added in functionality to call gnugo 2 | #in order to determine the final state of the board (remove dead stones, fill in dame, etc.) and changed how 3 | #it traverses directories. 4 | 5 | 6 | #!/usr/bin/python 7 | # 8 | # Copyright Hugh Perkins 2015 hughperkins at gmail 9 | # 10 | # This Source Code Form is subject to the terms of the Mozilla Public License, 11 | # v. 2.0. If a copy of the MPL was not distributed with this file, You can 12 | # obtain one at http://mozilla.org/MPL/2.0/. 13 | 14 | # assumptions: 15 | # - at least python 2.7 16 | # - not python 3.x 17 | # - internet is available 18 | # - on linux (since we're using signals) 19 | 20 | #See main at bottom of file. This file will recursively traverse a directory for all .sgf files and convert the moves 21 | #in those games to a binary format which can be used downstream for a CNN. 22 | 23 | from __future__ import absolute_import, division 24 | 25 | import argparse 26 | import json 27 | import sys,os,time, os.path 28 | import shutil 29 | from ..thirdparty import GoBoard 30 | import signal 31 | from os import sys, path 32 | #mydir = path.dirname(path.abspath(__file__)) 33 | #print( mydir ) 34 | #sys.path.append(mydir + '/gomill' ) 35 | import gomill 36 | import gomill.sgf 37 | 38 | import random 39 | import numpy as np 40 | from . import finish_games 41 | from . import bit_writer 42 | 43 | 44 | def addToDataFile( datafile, color, move, goBoard, ownership, black_ownership, white_ownership ): 45 | #datafile is an open binary file we are writing to 46 | # color is the color of the next person to move 47 | # move is the move they decided to make 48 | # goBoard represents the state of the board before they moved, object GoBoard 49 | # black ownership is a 19x19 array where 1 indicates black owns the intersection at 50 | #the end of the game, 0 indicates otherwise. white ownership is same matrix but flipped 51 | # - we should flip the board and color so we are basically always black 52 | # - we should calculate liberties at each position 53 | # - we should get ko 54 | # - and we should write to the file :-) 55 | # 56 | # planes we should write: 57 | # 0: our stones with 1 liberty 58 | # 1: our stones with 2 liberty 59 | # 2: our stones with 3 or more liberties 60 | # 3: their stones with 1 liberty 61 | # 4: their stones with 2 liberty 62 | # 5: their stones with 3 or more liberty 63 | # 6: simple ko 64 | # 7: all ones... 65 | 66 | (row,col) = move 67 | enemyColor = goBoard.otherColor( color ) 68 | datafile.write('GO') # write something first, so we can sync/validate on reading 69 | datafile.write(chr(row)) # write the move 70 | datafile.write(chr(col)) 71 | 72 | #If we are doing ownership, write the final state of the board as sequential bits 73 | if ownership: 74 | if color == 'b': 75 | to_move_ownership = black_ownership 76 | elif color =='w': 77 | to_move_ownership = white_ownership 78 | 79 | flattened_targets = [to_move_ownership[i][j] for i in xrange(board_size) for j in xrange(board_size)] 80 | num_bytes = bit_writer.write_sequence(flattened_targets, datafile) 81 | 82 | #The 8 board feature planes are encoded by sequential bytes, one byte per position on the board 83 | for row in range( 0, goBoard.boardSize ): 84 | for col in range( 0, goBoard.boardSize ): 85 | thisbyte = 0 86 | pos = (row,col) 87 | if goBoard.board.get(pos) == color: 88 | if goBoard.goStrings[pos].liberties.size() == 1: 89 | thisbyte = thisbyte | 1 90 | elif goBoard.goStrings[pos].liberties.size() == 2: 91 | thisbyte = thisbyte | 2 92 | else: 93 | thisbyte = thisbyte | 4 94 | if goBoard.board.get(pos) == enemyColor: 95 | if goBoard.goStrings[pos].liberties.size() == 1: 96 | thisbyte = thisbyte | 8 97 | elif goBoard.goStrings[pos].liberties.size() == 2: 98 | thisbyte = thisbyte | 16 99 | else: 100 | thisbyte = thisbyte | 32 101 | if goBoard.isSimpleKo( color, pos ): 102 | thisbyte = thisbyte | 64 103 | thisbyte = thisbyte | 128 104 | datafile.write( chr(thisbyte) ) 105 | 106 | #sgfContects - str with the contents of the sgf file to parse 107 | #sgf_file_path - str, path to the sgf file 108 | #output_file_path - str, path to the output file 109 | # 110 | #walk through the sgf file and write the binary samples to output_file_path 111 | def walkthroughSgf( sgf_contents , sgf_file_path, sgf_file_name, output_file_path, completed_dir, board_size, ownership): 112 | sgf = gomill.sgf.Sgf_game.from_string( sgf_contents ) 113 | try: 114 | if sgf.get_size() != board_size: 115 | print ('boardsize not %d, ignoring' %board_size ) 116 | return 117 | goBoard = GoBoard.GoBoard(board_size) 118 | if sgf.get_handicap() != None and sgf.get_handicap() != 0: 119 | print 'handicap not zero, ignoring (' + str( sgf.get_handicap() ) + ')' 120 | return 121 | except: 122 | print "Error getting handicap. Ignoring this file" 123 | return 124 | moveIdx = 0 125 | 126 | #here we attempt to use gnugo to finish the game and get the final ownership. 127 | #we check the score gnugo gives with the score written in the file, if this score is off 128 | #by more than difference_threshold then we skip the file. gnugo is often off by 1 because 129 | #of chinese scoring. 130 | black_ownership, white_ownership = None, None 131 | if ownership: 132 | black_ownership, white_ownership = finish_games.finish_sgf_and_get_ownership(sgf_file_path, sgf_file_name, completed_dir, 133 | board_size, difference_threshold = 6, year_lowerbound = 0) #set year_lowerbound will ignore all games before given year 134 | if black_ownership is None or white_ownership is None: 135 | print "Unable to get final ownership for %s" %sgf_file_path 136 | return 137 | 138 | #all samples from this sgf will be written to this file 139 | output_file = open(output_file_path , 'wb') 140 | 141 | for it in sgf.main_sequence_iter(): 142 | (color,move) = it.get_move() 143 | if color != None and move != None: 144 | (row,col) = move 145 | addToDataFile( output_file, color, move, goBoard, ownership, black_ownership, white_ownership) 146 | try: 147 | goBoard.applyMove( color, (row,col) ) 148 | except: 149 | print "exception caught at move %d" %(moveIdx) 150 | print "Ignoring the rest of this file" 151 | output_file.close() 152 | return 153 | moveIdx = moveIdx + 1 154 | output_file.close() 155 | 156 | #sgf_file_path - str, path to the sgf file 157 | #sgf_file_name - str, name of the sgf file (without the entire path) 158 | #output_file_path - str, path to the output file 159 | # 160 | #open the sgf file, read the contents and write them to the binary file output_file_path 161 | def munge_sgf( sgf_file_path, sgf_file_name, output_file_path, completed_dir, board_size, ownership): 162 | sgf_file = open( sgf_file_path, 'r' ) 163 | contents = sgf_file.read() 164 | sgf_file.close() 165 | 166 | if contents.find( 'SZ[%d]' %board_size ) < 0: 167 | print( 'not %dx%d, skipping: %s' %(board_size, board_size, sgf_file_path)) 168 | try: 169 | walkthroughSgf( contents , sgf_file_path, sgf_file_name, output_file_path, completed_dir, board_size, ownership) 170 | except: 171 | print( "Weird exception happened caught for file " + path.abspath( sgf_file_path ) ) 172 | print sys.exc_info()[0] 173 | print "Terminating the munging..." 174 | raise 175 | #print( sgf_file_path ) 176 | 177 | #recursively traverse the source_dir directory and process every .sgf file in that directory. 178 | #We ignore all files that are not board_sizexboard_size, and skip handicap games. The GoGod dataset I downloaded 179 | #had a few corrupted sgf files, these will be skipped as well. 180 | def munge_all_sgfs( input_dir, output_dir, completed_dir, board_size, ownership): 181 | file_count = 0 182 | for subdir, dirs, files in os.walk(input_dir): 183 | for file in files: 184 | filepath = subdir + os.sep + file 185 | if file_count % 1000 == 0: 186 | print file_count 187 | if filepath.endswith(".sgf"): 188 | output_file_path = output_dir + os.sep + file[:-4] + ".dat" 189 | if os.path.isfile(output_file_path): 190 | print "File already exists: %s" %output_file_path 191 | continue 192 | munge_sgf(filepath, file, output_file_path, completed_dir, board_size, ownership) 193 | file_count+=1 194 | print "There were %d files" %(file_count) 195 | if file_count == 0: 196 | print "No sgf_files were found in the directory, nothing to do." 197 | else: 198 | if not os.path.exists(output_dir): 199 | print "%s not found, creating it" %output_dir 200 | os.mkdir(output_dir) 201 | if not os.path.exists(completed_dir): 202 | print "%s not found, creating it" %completed_dir 203 | os.mkdir(completed_dir) 204 | 205 | 206 | if __name__ == '__main__': 207 | #munge_all_sgfs(source_dir_path, output_dir_path) 208 | 209 | parser = argparse.ArgumentParser() 210 | 211 | #settings for munging 212 | parser.add_argument('-i', '--input_dir', dest='input_dir', type=str, default='./data/sgf_files', help='directory containing sgf files as inputk') 213 | parser.add_argument('-o', '--output_dir', dest='output_dir', type=str, default='./data/input_samples_all', help='output directory to write processed binary files to') 214 | parser.add_argument('-c', '--completed_dir', dest='completed_dir', default='./data/completed_sgf_files', help='directory to save gnugo completed sgf files (with ownership info)') 215 | parser.add_argument('-b' '--board_size', dest='board_size', type=int, default=19, help='board size') 216 | parser.add_argument('--no_ownership', dest = 'ownership', action='store_false') 217 | parser.set_defaults(ownership = True) 218 | 219 | args = parser.parse_args() 220 | params = vars(args) 221 | print json.dumps(params, indent =2) 222 | 223 | input_dir = params["input_dir"] 224 | output_dir = params["output_dir"] 225 | completed_dir = params["completed_dir"] 226 | board_size = params["board_size"] 227 | ownership = params["ownership"] 228 | 229 | munge_all_sgfs(input_dir, output_dir, completed_dir, board_size, ownership) -------------------------------------------------------------------------------- /thirdparty/Bag2d.py: -------------------------------------------------------------------------------- 1 | # Copyright Hugh Perkins 2015 hughperkins at gmail 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public License, 4 | # v. 2.0. If a copy of the MPL was not distributed with this file, You can 5 | # obtain one at http://mozilla.org/MPL/2.0/. 6 | 7 | # doubly-indexed collection of locations on a board 8 | # - given a location, can determine if it exists in the 'bag' of lcoations, in O(1) 9 | # - can iterate over the locations, in time O(1) per locations 10 | # - can remove a location, in O(1) 11 | class Bag2d(object): 12 | def __init__(self, boardSize): 13 | self.boardSize = boardSize 14 | self.pieces = [] 15 | self.board = {} 16 | 17 | def insert( self, combo ): 18 | ( row, col ) = combo 19 | if self.board.has_key(combo): 20 | return 21 | self.pieces.append( combo ) 22 | self.board[combo] = len( self.pieces ) - 1 23 | 24 | def erase( self, combo ): 25 | if not self.board.has_key(combo): 26 | return 27 | i1d = self.board[combo] 28 | if i1d == len(self.pieces) - 1: 29 | del self.pieces[i1d] 30 | del self.board[combo] 31 | return 32 | self.pieces[i1d] = self.pieces[len(self.pieces) - 1] 33 | del self.pieces[len(self.pieces) - 1] 34 | movedcombo = self.pieces[i1d] 35 | self.board[movedcombo] = i1d 36 | del self.board[combo] 37 | 38 | def exists( self, combo ): 39 | return self.board.has_key(combo) 40 | 41 | def size(self): 42 | return len(self.pieces) 43 | 44 | def __getitem__( self, i1d ): 45 | return self.pieces[i1d] 46 | 47 | def __str__(self): 48 | result = 'Bag2d\n' 49 | for row in range(self.boardSize - 1, -1, -1 ): 50 | thisline = "" 51 | for col in range(0, self.boardSize): 52 | if self.exists( (row, col) ): 53 | thisline = thisline + "*" 54 | else: 55 | thisline = thisline + "." 56 | result = result + thisline + "\n" 57 | return result 58 | 59 | -------------------------------------------------------------------------------- /thirdparty/GoBoard.py: -------------------------------------------------------------------------------- 1 | # Copyright Hugh Perkins 2015 hughperkins at gmail 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public License, 4 | # v. 2.0. If a copy of the MPL was not distributed with this file, You can 5 | # obtain one at http://mozilla.org/MPL/2.0/. 6 | 7 | import GoString 8 | import Bag2d 9 | import numpy as np 10 | 11 | # a go board, can apply moves to it, contains gostrings, including their pieces, liberties etc 12 | # can check for simple ko, and handle captures 13 | 14 | def _fill(board, i, j, fill_val): 15 | if i < 0 or j < 0 or i >= len(board) or j >= len(board): 16 | return 17 | if board[i][j] != -1: 18 | return 19 | board[i][j] = fill_val 20 | _fill(board, i-1, j, fill_val) 21 | _fill(board, i+1, j, fill_val) 22 | _fill(board, i, j-1, fill_val) 23 | _fill(board, i, j+1, fill_val) 24 | 25 | 26 | class GoBoard(object): 27 | def __init__( self, boardSize ) : 28 | self.ko_lastMoveNumCaptured = 0 29 | self.ko_lastMove = -3 30 | self.boardSize = boardSize 31 | self.board = {} # I suppose it can be 'w', 'b' or nothing? 32 | self.goStrings = {} # map of pos to gostring 33 | 34 | def foldStrings( self, targetString, sourceString, joinPos ): 35 | if( targetString == sourceString ): 36 | return 37 | 38 | for piecePos in sourceString.pieces.pieces: 39 | self.goStrings[piecePos] = targetString 40 | targetString.insertPiece( piecePos ) 41 | 42 | # add the liberties from the second string 43 | targetString.copyLibertiesFrom( sourceString ) 44 | targetString.removeLiberty( joinPos ) 45 | 46 | def addAdjacentLiberty( self, pointString, pos ): 47 | (row,col) = pos 48 | if row < 0 or col < 0 or row >= self.boardSize or col >= self.boardSize: 49 | return 50 | if not self.board.has_key(pos): 51 | pointString.addLiberty(pos) 52 | 53 | # dont attempt to merge yet 54 | def createPointString( self, color, pos ): 55 | pointString = GoString.GoString( self.boardSize, color ) 56 | pointString.insertPiece( pos ) 57 | self.goStrings[pos] = pointString 58 | self.board[pos] = color 59 | 60 | (row,col) = pos 61 | for adjpos in [ (row-1,col), (row+1,col),(row,col-1), (row,col+1)]: 62 | self.addAdjacentLiberty( adjpos, pointString ) 63 | 64 | return pointString 65 | 66 | def otherColor( self, color ): 67 | if color == 'b': 68 | return 'w' 69 | if color == 'w': 70 | return 'b' 71 | 72 | def isSimpleKo( self, playColor, pos ): 73 | enemyColor = self.otherColor( playColor ) 74 | (row, col ) = pos 75 | # if exactly one stone captured on last move, then need to check for ko... 76 | if( self.ko_lastMoveNumCaptured == 1 ): 77 | # is the last move adjacent to us, and do we capture it? 78 | ( lastMoveRow, lastMoveCol ) = self.ko_lastMove 79 | manhattanDistanceLastMove = abs( lastMoveRow - row ) + abs( lastMoveCol - col ) 80 | if( manhattanDistanceLastMove == 1 ): 81 | lastGoString = self.goStrings.get((lastMoveRow,lastMoveCol)) 82 | if( lastGoString != None and lastGoString.numLiberties() == 1 ): 83 | # apparently we do .... 84 | # how many stones would we capture? means, do we capture any others, that are 85 | # not the same string? 86 | # first, check if this string has only one stone... 87 | if( lastGoString.numPieces() == 1 ): 88 | # apparently it does.... 89 | # any other adjacent enemy with no liberties? 90 | totalNoLibertyAdjacentEnemy = 0 91 | for adjpos in [ (row-1,col), (row+1,col),(row,col-1), (row,col+1)]: 92 | if( self.board.get(adjpos) == enemyColor and 93 | self.goStrings[adjpos].numLiberties() == 1 ): 94 | totalNoLibertyAdjacentEnemy = totalNoLibertyAdjacentEnemy + 1 95 | if( totalNoLibertyAdjacentEnemy == 1 ): 96 | # it's a ko... 97 | return True 98 | return False 99 | 100 | def checkEnemyLiberty( self, playColor, enemyPos, ourPos ): 101 | (enemyrow, enemycol) = enemyPos 102 | (ourrow, ourcol) = ourPos 103 | # print "checkEnemyLiberty enemy " + str(enemyPos) + " us " + str(ourPos) 104 | if( enemyrow < 0 or enemyrow >= self.boardSize or enemycol < 0 or enemycol >= self.boardSize ): 105 | return 106 | enemyColor = self.otherColor( playColor ) 107 | if self.board.get(enemyPos) != enemyColor: 108 | # not enemy 109 | # print 'not enemy: ' + str(self.board.get(enemyPos)) + ' vs ' + str(enemyColor) 110 | return 111 | enemyString = self.goStrings[enemyPos] 112 | if( enemyString == None ): 113 | raise("checkenemyliberty 1 " ) 114 | # print 'before removeliberty: ' + str( enemyString ) 115 | enemyString.removeLiberty( ourPos ) 116 | # print 'after removeliberty: ' + str( enemyString ) + ' numliberties:' + str(enemyString.numLiberties() ) 117 | if( enemyString.numLiberties() == 0 ): 118 | # killed it! 119 | # remove all pieces of this string from the board 120 | # and remove the string 121 | # ko stuff 122 | for enemypos in enemyString.pieces.pieces: 123 | (stringrow,stringcol) = enemypos 124 | del self.board[enemypos] 125 | del self.goStrings[enemypos] 126 | self.ko_lastMoveNumCaptured = self.ko_lastMoveNumCaptured + 1 127 | for adjstring in [ (stringrow-1,stringcol),(stringrow+1,stringcol),(stringrow,stringcol-1),(stringrow,stringcol+1) ]: 128 | self.addLibertyToAdjacentString( adjstring, enemypos, playColor ) 129 | 130 | def applyMove( self, playColor, pos ): 131 | if self.board.has_key(pos): 132 | raise( "violated expectation: board[row][col] ==0, at " + str(pos) ) 133 | 134 | self.ko_lastMoveNumCaptured = 0; 135 | 136 | (row,col) = pos 137 | # we need to remove any enemy that no longer has a liberty 138 | self.checkEnemyLiberty( playColor, ( row - 1, col), pos ) 139 | self.checkEnemyLiberty( playColor, ( row + 1, col), pos ) 140 | self.checkEnemyLiberty( playColor, ( row, col - 1), pos ) 141 | self.checkEnemyLiberty( playColor, ( row, col + 1), pos ) 142 | 143 | # then create a String for our new piece, and merge with any 144 | # adjacent strings 145 | playString = self.createPointString(playColor, pos) 146 | 147 | playString = self.foldStringIfOurs(playString, playColor, (row - 1, col), pos ) 148 | playString = self.foldStringIfOurs(playString, playColor, (row + 1, col), pos ) 149 | playString = self.foldStringIfOurs(playString, playColor, (row, col - 1), pos ) 150 | playString = self.foldStringIfOurs(playString, playColor, (row, col + 1), pos ) 151 | 152 | self.ko_lastMove = pos 153 | 154 | def addLibertyToAdjacentString( self, stringpos, libertypos, color ): 155 | if( self.board.get(stringpos) != color ): 156 | return 157 | goString = self.goStrings[stringpos] 158 | goString.insertLiberty( libertypos ) 159 | 160 | def addAdjacentLiberty( self, pos, goString ): 161 | (row,col) = pos 162 | if row < 0 or col < 0 or row > self.boardSize - 1 or col > self.boardSize - 1: 163 | return 164 | if( not self.board.has_key(pos) ): 165 | goString.insertLiberty(pos) 166 | 167 | def foldStringIfOurs( self, string2, color, pos, joinpos ): 168 | (row,col) = pos 169 | if( row < 0 or row >= self.boardSize or col < 0 or col >= self.boardSize ): 170 | return string2 171 | if( self.board.get(pos) != color ): 172 | return string2 173 | string1 = self.goStrings[pos] 174 | self.foldStrings( string1, string2, joinpos ) 175 | return string1 176 | 177 | def get_final_ownership(self, playColor): 178 | if playColor == 'b': 179 | otherColor = 'w' 180 | elif playColor == 'w': 181 | otherColor = 'b' 182 | else: 183 | raise ("playColor must be either b or w") 184 | board = np.full((self.boardSize,self.boardSize), -1) 185 | 186 | for i in range( 0, self.boardSize ): 187 | for j in range( 0, self.boardSize ): 188 | thispiece = self.board.get((i,j)) 189 | if thispiece == playColor: 190 | board[i][j] = 1 191 | if thispiece == otherColor: 192 | board[i][j] = 0 193 | for i in range( 0, self.boardSize ): 194 | for j in range( 0, self.boardSize ): 195 | thispiece = self.board.get((i,j)) 196 | if thispiece == playColor: 197 | board[i][j] = 1 198 | pass 199 | elif thispiece == otherColor: 200 | board[i][j] = 0 201 | pass 202 | else: 203 | pass 204 | 205 | for i in range( 0, self.boardSize ): 206 | for j in range( 0, self.boardSize ): 207 | if board[i][j] != -1: 208 | fill_val = board[i][j] 209 | _fill(board, i-1, j, fill_val) 210 | _fill(board, i+1, j, fill_val) 211 | _fill(board, i, j-1, fill_val) 212 | _fill(board, i, j+1, fill_val) 213 | return board 214 | 215 | def __str__(self): 216 | result = 'GoBoard\n' 217 | for i in range(self.boardSize - 1, -1, -1): 218 | line = '' 219 | for j in range(0,self.boardSize): 220 | thispiece = self.board.get((i,j)) 221 | if thispiece == None: 222 | line = line + '.' 223 | if thispiece == 'b': 224 | line = line + '*' 225 | if thispiece == 'w': 226 | line = line + 'O' 227 | result = result + line + '\n' 228 | return result 229 | 230 | -------------------------------------------------------------------------------- /thirdparty/GoString.py: -------------------------------------------------------------------------------- 1 | # Copyright Hugh Perkins 2015 hughperkins at gmail 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public License, 4 | # v. 2.0. If a copy of the MPL was not distributed with this file, You can 5 | # obtain one at http://mozilla.org/MPL/2.0/. 6 | 7 | import Bag2d 8 | 9 | # represents a string of contiguous pieces of one color on the board 10 | # including we have a list of all its liberties, and therefore their count 11 | class GoString(object): 12 | def __init__(self, boardSize, color ): 13 | self.boardSize = boardSize 14 | self.color = color 15 | self.liberties = Bag2d.Bag2d(boardSize) 16 | self.pieces = Bag2d.Bag2d(boardSize) 17 | 18 | def getPiece( self, index ): 19 | return self.pieces[index] 20 | 21 | def getLiberty( self, index ): 22 | return self.liberties[index] 23 | 24 | def insertPiece( self, combo ): 25 | self.pieces.insert( combo ) 26 | 27 | def numPieces(self): 28 | return self.pieces.size() 29 | 30 | def removeLiberty( self, combo ): 31 | self.liberties.erase( combo ) 32 | 33 | def numLiberties(self): 34 | return self.liberties.size() 35 | 36 | def insertLiberty( self, combo ): 37 | self.liberties.insert( combo ) 38 | 39 | def copyLibertiesFrom( self, source ): 40 | for libertyPos in source.liberties.pieces: 41 | self.liberties.insert( libertyPos ) 42 | 43 | def __str__(self): 44 | result = "GoString[ pieces=" + str(self.pieces) + " liberties=" + str(self.liberties) + " ]" 45 | return result 46 | 47 | -------------------------------------------------------------------------------- /thirdparty/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/thirdparty/__init__.py -------------------------------------------------------------------------------- /visualization/BoardEvaluator.py: -------------------------------------------------------------------------------- 1 | #BoardEvaluator.py 2 | import tensorflow as tf 3 | import sys 4 | from ..board_evaluation import model 5 | import numpy as np 6 | 7 | def _board_to_feature_cube(goBoard, color_to_move): 8 | enemy_color = goBoard.otherColor( color_to_move ) 9 | feature_cube = np.zeros((19,19, 8)) 10 | for row in range(goBoard.boardSize ): 11 | for col in range(goBoard.boardSize ): 12 | pos = (row,col) 13 | if goBoard.board.get(pos) == color_to_move: 14 | if goBoard.goStrings[pos].liberties.size() == 1: 15 | feature_cube[row][col][0] = 1.0 16 | elif goBoard.goStrings[pos].liberties.size() == 2: 17 | feature_cube[row][col][1] = 1.0 18 | else: 19 | feature_cube[row][col][2] = 1.0 20 | if goBoard.board.get(pos) == enemy_color: 21 | if goBoard.goStrings[pos].liberties.size() == 1: 22 | feature_cube[row][col][3] = 1.0 23 | elif goBoard.goStrings[pos].liberties.size() == 2: 24 | feature_cube[row][col][4] = 1.0 25 | else: 26 | feature_cube[row][col][5] = 1.0 27 | if goBoard.isSimpleKo( color_to_move, pos ): #FIX THIS! 28 | feature_cube[row][col][6] = 1.0 29 | feature_cube[row][col][7] = 1.0 30 | return feature_cube 31 | 32 | 33 | class BoardEvaluator: 34 | def __init__(self, tf_ckpt_path): 35 | #init the tensorflow model 36 | self.x, _ = model.place_holders() 37 | self.y_conv = model.model(self.x) 38 | self.sess = tf.InteractiveSession() 39 | self.sess.run(tf.initialize_all_variables()) 40 | saver = tf.train.Saver(tf.all_variables()) 41 | saver.restore(self.sess, tf_ckpt_path) 42 | 43 | #feature_cube - [361,8] matrix of floats 44 | #returns - [19,19] matrix of probabilities 45 | def predict_single_sample(self, feature_cube): 46 | y_pred = self.sess.run(self.y_conv, feed_dict={self.x:[feature_cube]}) 47 | return np.reshape(y_pred, [19,19]) 48 | 49 | #board - GoBoard object 50 | #returns [19,19] matrix of floats, each float in [0,1] indicating probability black owns the territory 51 | #at the end of the game 52 | def evaluate_board(self, goBoard, color_to_move): 53 | feature_cube = _board_to_feature_cube(goBoard, color_to_move) 54 | predicted_ownership = self.predict_single_sample(feature_cube) 55 | 56 | #the model was trained on predicting ownership of color to move 57 | #here we swap this back to predicting ownership of black 58 | if color_to_move == "w": 59 | for i in xrange(len(predicted_ownership)): 60 | for j in xrange(len(predicted_ownership)): 61 | predicted_ownership[i][j] = 1 - predicted_ownership[i][j] 62 | return predicted_ownership 63 | -------------------------------------------------------------------------------- /visualization/GoDriver.py: -------------------------------------------------------------------------------- 1 | #GoDriver.py 2 | from __future__ import print_function 3 | import numpy as np 4 | import sys 5 | 6 | #TODO: fix this relative path, it will cause an import error if gogui is not started from the visualization directory 7 | sys.path.append("../thirdparty") 8 | 9 | import GoBoard #this is in the thirdparty directory 10 | import gomill.sgf 11 | from BoardEvaluator import BoardEvaluator 12 | 13 | def _swap_color(color): 14 | if color == "b": 15 | return "w" 16 | elif color == "w": 17 | return "b" 18 | raise ValueError("color needs to be w or b") 19 | 20 | ''' 21 | GoDriver has a pointer to a gomill.Sgf_game object which contains the game tree defined by an sgf file. 22 | The current position in the file in maintained by the Sgf_game.main_sequence_iter() iterator. 23 | It also contains a BoardEvaluator object which will load the tensorflow model and be able to make predictions 24 | based on the current board. ''' 25 | class GoDriver: 26 | def __init__(self, sgf_filepath, tf_ckpt_path, BOARD_SIZE = 19): 27 | self.board_evaluator = BoardEvaluator(tf_ckpt_path) 28 | self.BOARD_SIZE = BOARD_SIZE 29 | self.load_sgf_file(sgf_filepath) 30 | self.color_to_move = "b" 31 | 32 | def load_sgf_file(self, sgf_filepath): 33 | with open(sgf_filepath, 'r') as sgf_file: 34 | sgfContents = sgf_file.read() 35 | self.sgf = gomill.sgf.Sgf_game.from_string( sgfContents) 36 | print("%s loaded. Winner: %s"%(sgf_filepath, self.sgf.get_winner()), file=sys.stderr) 37 | self.board = GoBoard.GoBoard(self.BOARD_SIZE) 38 | self.sgf_iterator = self.sgf.main_sequence_iter() 39 | 40 | def reset_board(self): 41 | self.board = GoBoard.GoBoard(self.BOARD_SIZE) 42 | self.sgf_iterator = self.sgf.main_sequence_iter() 43 | 44 | def gen_move(self): 45 | try: 46 | it = self.sgf_iterator.next() 47 | color, move = it.get_move() 48 | if move is None: #sometimes the first move isn't defined 49 | it = self.sgf_iterator.next() 50 | color, move = it.get_move() 51 | 52 | except StopIteration: #at the end of the file 53 | return "pass" 54 | 55 | if move is None: 56 | return "pass" 57 | 58 | self.color_to_move = _swap_color(color) 59 | (row,col) = move 60 | self.board.applyMove( color, (row,col) ) 61 | return row, col 62 | 63 | #returns [19,19] matrix of floats indicating the probability black will own the territory at the end 64 | #of the game 65 | def evaluate_current_board(self): 66 | if self.board is None: 67 | return np.zeros((19,19)) 68 | return self.board_evaluator.evaluate_board(self.board, self.color_to_move) -------------------------------------------------------------------------------- /visualization/README.md: -------------------------------------------------------------------------------- 1 | # Visualizing the trained model 2 | ## Usage 3 | 4 | Set the MODEL_PATH and SGF_DIRECTORY variables in main.py. If you cloned this repo a trained model .ckpt file 5 | should be in data/working. 6 | 7 | Start gogui, then goto Program -> Attach and enter "python /path/to/main.py" for the command. 8 | This should load a random sgf file in SGF_DIRECTORY. You can walk through the file in gogui 9 | by clicking the "make program play" button. You can visualize the output of the model or 10 | load a new sgf file by going to Tools -> Analyze Commands. Note after you load a new sgf make 11 | sure to click the 'clear board' button to tell gogui to reset the board as well. -------------------------------------------------------------------------------- /visualization/images/case for chain pooling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/visualization/images/case for chain pooling.png -------------------------------------------------------------------------------- /visualization/images/corner differences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/visualization/images/corner differences.png -------------------------------------------------------------------------------- /visualization/images/interesting game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmgilmer/GoCNN/67ab37075c76a35c9dc234b8298df00690ff7ac2/visualization/images/interesting game.png -------------------------------------------------------------------------------- /visualization/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | ''' 4 | This file contains the main loop which communicates to gogui via the Go Text Protocol (gtp) via stdin. 5 | We start by loading a random sgf file contained in the SGF_DIRECTORY. You can walk through 6 | the sgf file by clicking the 'make board_evaluator play' button in gogui. Everytime the 7 | loadsgf command is sent from gogui (Tools -> Analyze Commands in gogui) we load 8 | a new random sgf from the directory. When the predict ownership method is called 9 | we return the models board evaluation prediction on the current state of the board. 10 | ''' 11 | 12 | from __future__ import print_function 13 | import sys 14 | import re 15 | import random 16 | import numpy as np 17 | import os 18 | from .GoDriver import GoDriver 19 | 20 | MODEL_PATH = "../../data/working/board_eval_cnn_5layer.ckpt" 21 | 22 | #everytime we reset the board we will load a random game from this directory to view 23 | #SGF_DIRECTORY = "/home/justin/Programming/GoAI/Completing_Go_Games/pro_games" 24 | SGF_DIRECTORY = "../../data/sgf_files" 25 | 26 | N = 19 #size of the board 27 | letter_coords = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T'] 28 | 29 | #sgf_dir - string, directory containing sgf files 30 | #returns list of strings 31 | def get_sgf_filelist(sgf_dir): 32 | sgf_files = [] 33 | for subdir, dirs, files in os.walk(SGF_DIRECTORY): 34 | for file in files: 35 | filepath = subdir + os.sep + file 36 | if filepath.endswith(".sgf"): 37 | sgf_files.append(filepath) 38 | print("Number of sgf files found: %d" %len(sgf_files), file=sys.stderr) 39 | return sgf_files 40 | 41 | #go from matrix index to board position string e.g. 0,2 -> A3 42 | def coord_to_str(row, col): 43 | return letter_coords[row] + str(col+1) 44 | 45 | #ownership_matrix - [N,N] matrix of floats output from the CNN model 46 | #Formats a valid response string that can be fed into gogui as response to the 'predict_ownership' command 47 | def influence_str(ownership_matrix): 48 | rtn_str = "INFLUENCE " 49 | for i in xrange(len(ownership_matrix)): 50 | for j in xrange(len(ownership_matrix)): 51 | rtn_str+= "%s %.1lf " %(coord_to_str(i,j), 2*(ownership_matrix[i][j] - .5)) #convert to [-1,1] scale 52 | #rtn_str+= " %.1lf\n" %(ownership_matrix[i][j]) 53 | return rtn_str 54 | 55 | def gtp_io(): 56 | """ Main loop which communicates to gogui via GTP""" 57 | known_commands = ['boardsize', 'clear_board', 'komi', 'play', 'genmove', 58 | 'final_score', 'quit', 'name', 'version', 'known_command', 59 | 'list_commands', 'protocol_version', 'gogui-analyze_commands'] 60 | analyze_commands = ["gfx/Predict Final Ownership/predict_ownership", 61 | "none/Load New SGF/loadsgf"] 62 | sgf_files = get_sgf_filelist(SGF_DIRECTORY) 63 | sgf_file = random.choice(sgf_files) 64 | driver = GoDriver(sgf_file, MODEL_PATH) 65 | 66 | print("starting main.py: loading %s" %sgf_file,file=sys.stderr) 67 | output_file = open("output.txt", "wb") 68 | output_file.write("intializing\n") 69 | while True: 70 | try: 71 | line = raw_input().strip() 72 | print(line,file=sys.stderr) 73 | output_file.write(line + "\n") 74 | except EOFError: 75 | output_file.write('Breaking!!\n') 76 | break 77 | if line == '': 78 | continue 79 | command = [s.lower() for s in line.split()] 80 | if re.match('\d+', command[0]): 81 | cmdid = command[0] 82 | command = command[1:] 83 | else: 84 | cmdid = '' 85 | ret = '' 86 | if command[0] == "boardsize": 87 | if int(command[1]) != N: 88 | print("Warning: Trying to set incompatible boardsize %s (!= %d)"%(command[1], N), file=sys.stderr) 89 | elif command[0] == "clear_board": 90 | driver.reset_board() 91 | elif command[0] == "loadsgf": 92 | sgf_file = random.choice(sgf_files) 93 | print("Loading new file: %s" %sgf_file, file=sys.stderr) 94 | print("Make sure to click 'Clear board and start new game' in the gui", file=sys.stderr) 95 | driver.load_sgf_file(sgf_file) 96 | elif command[0] == "komi": 97 | pass 98 | elif command[0] == "play": 99 | pass 100 | print("play", file=sys.stderr) 101 | elif command[0] == "genmove": 102 | #color_str = command[1] #currently we ignore this 103 | tup = driver.gen_move() 104 | if tup == "pass": 105 | ret = "pass" 106 | else: 107 | ret = coord_to_str(tup[0],tup[1]) 108 | print("genmove", file=sys.stderr) 109 | elif command[0] == "final_score": 110 | print("final_score not implemented", file=sys.stderr) 111 | elif command[0] == "name": 112 | ret = 'board_evaluator' 113 | elif command[0] == "predict_ownership": 114 | ownership_prediction = driver.evaluate_current_board() 115 | ret = influence_str(ownership_prediction) 116 | elif command[0] == "version": 117 | ret = '1.0' 118 | elif command[0] == "list_commands": 119 | ret = '\n'.join(known_commands) 120 | elif command[0] == "gogui-analyze_commands": 121 | ret = '\n'.join(analyze_commands) 122 | 123 | elif command[0] == "known_command": 124 | ret = 'true' if command[1] in known_commands else 'false' 125 | elif command[0] == "protocol_version": 126 | ret = '2' 127 | elif command[0] == "quit": 128 | print('=%s \n\n' % (cmdid,), end='') 129 | break 130 | else: 131 | print('Warning: Ignoring unknown command - %s' % (line,), file=sys.stderr) 132 | ret = None 133 | 134 | if ret is not None: 135 | output_file.write("returning: '=%s %s'\n"%(cmdid, ret,)) 136 | print('=%s %s\n\n' % (cmdid, ret,), end='') 137 | else: 138 | output_file.write("returning: '=?%s ???'\n"%(cmdid)) 139 | print('?%s ???\n\n' % (cmdid,), end='') 140 | sys.stdout.flush() 141 | output_file.write('end of session\n') 142 | output_file.close() 143 | 144 | if __name__ == '__main__': 145 | gtp_io() -------------------------------------------------------------------------------- /visualization/output.txt: -------------------------------------------------------------------------------- 1 | intializing 2 | name 3 | returning: '= board_evaluator' 4 | protocol_version 5 | returning: '= 2' 6 | version 7 | returning: '= 1.0' 8 | list_commands 9 | returning: '= boardsize 10 | clear_board 11 | komi 12 | play 13 | genmove 14 | final_score 15 | quit 16 | name 17 | version 18 | known_command 19 | list_commands 20 | protocol_version 21 | gogui-analyze_commands' 22 | gogui-analyze_commands 23 | returning: '= gfx/Predict Final Ownership/predict_ownership 24 | none/Load New SGF/loadsgf' 25 | boardsize 19 26 | returning: '= ' 27 | clear_board 28 | returning: '= ' 29 | komi 6.5 30 | returning: '= ' 31 | --------------------------------------------------------------------------------