TensorFlow > mapping > R^2のinputをR^2のoutputにmappingする実装 v0.4 > tf.train.shuffle_batch の capacityを変更してみる

```txt:動作環境
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 14.04 LTS desktop amd64
TensorFlow v0.11
cuDNN v5.1 for Linux
CUDA v8.0
Python 2.7.6
IPython 5.1.0 -- An enhanced Interactive Python.
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
GNU bash, version 4.3.8(1)-release (x86_64-pc-linux-gnu)
```

### 概要

http://users.monash.edu/~app/Lrn/LearningMDS.pdf
の5.4 (Simple) example of function approximation。

R^2(2次元の実数)のinputをR^2のoutputにmappingしている。

TensorFlowで学習をさせて、学習結果を確認している。

### 関連 

v0.1: http://qiita.com/7of9/items/16bf19555dd97b09ecb0
前回: http://qiita.com/7of9/items/5431ca6ff8eb79d5eee7
y1,y2の式: http://qiita.com/7of9/items/54ec092a91880df9dc64
API doc: https://www.tensorflow.org/versions/master/api_docs/python/tf/train/shuffle_batch

### tf.train.shuffle_batch > capacity

参考　[TensorFlow – Readerクラスでバッチ処理 @ Logicky Blogさん ](http://endoyuta.com/2017/01/24/tensorflow-reader%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%A7%E3%83%90%E3%83%83%E3%83%81%E5%87%A6%E7%90%86/)

上記においてTensorFlowのcifar10のチュートリアルコード(cifar10_input.py)のcapacity値計算式が紹介されている。
それを実装してみた。

learn_xxyyfunc_170321.pyの該当箇所を以下のようにした。

```learn_xxyyfunc_170321.py
batch_size = 4  # [4]
# Ref: cifar10_input.py
min_fraction_of_examples_in_queue = 0.4
NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN = 100
min_queue_examples = int(NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN * 
	min_fraction_of_examples_in_queue)
#
inputs_batch, output_batch = tf.train.shuffle_batch(
    [inputs, output], batch_size, capacity=min_queue_examples + 3 * batch_size, 
    min_after_dequeue=batch_size)
```

## min_fraction_of_examples_in_queueに対する結果

min_fraction_of_examples_in_queue(以下、MFEQとする)の値を変更した場合の学習結果の再現性を調べた。

### MFEQ = 0.0

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/b73384a0-3791-2633-e75d-f5b0dd6bae56.png)


![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/c46921e9-854e-7df6-1335-083a5531fba0.png)

### MFEQ = 0.1

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/63d5b729-9c9a-3406-4705-c72391d26ce7.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/44862696-2acc-d46d-5698-0628281612b1.png)

### MFEQ = 0.2

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/4ab6b9f1-d196-9682-69c9-83f63e8613e5.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/e3af7ea8-9b3c-5433-8b67-0e95ed8e7e5c.png)

### MFEQ = 0.3

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/d66d9cf0-8c77-c980-3bc3-25cce2ea5f3d.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/3a3802c7-af30-eb71-9d7e-d00a88cfb6c1.png)

### MFEQ = 0.4

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/0e1bef9e-11a8-296b-1b85-5f406ead45ce.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/8e11ea0b-32f5-f87d-038a-521de0b7793f.png)

### MFEQ = 0.5

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/e0d52900-91de-7b10-3eed-880210d6c0a1.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/83706896-0a94-4df9-e86a-2f28219e5f3f.png)

### MFEQ = 0.6

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/9244f56d-d5e4-6708-fc8e-ca24b1e1ac06.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/af9af23b-657d-beb1-2340-16259f5dac7c.png)

### MFEQ = 0.7

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/cbc9ac48-301f-2410-73dc-bfa1908a0e06.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/82d8d9f4-5be5-1845-2b04-4fea2f4d19ea.png)

### MFEQ = 0.8

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/b8b4942e-b692-f5e8-8214-41eef59da007.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/0f7cb366-0764-277f-044e-45d36bf571be.png)

### MFEQ = 0.9

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/7152b54e-5209-ae64-1692-eedbf5dbf460.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/16fd4643-2476-3e00-b105-2786323dc88a.png)