mtgencode/mtg_sweep1.ipynb

352 lines
108 KiB
Text
Raw Normal View History

2015-12-06 22:26:02 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Opening encoded card file: /home/mtgencode/data/output.txt\n",
"15065 valid, 0 skipped, 0 invalid, 0 failed to parse.\n",
"generating 3-gram model\n",
"found 25046 sentences\n",
"<NgramModel with 34500 3-grams>\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_128_1_epoch50.00_0.3941.output.1.0.txt\n",
"5549 valid, 0 skipped, 88 invalid, 29 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_128_2_epoch50.00_0.3862.output.1.0.txt\n",
"5360 valid, 0 skipped, 121 invalid, 35 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_256_1_epoch50.00_0.2736.output.1.0.txt\n",
"5732 valid, 0 skipped, 71 invalid, 17 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_256_2_epoch50.00_0.2645.output.1.0.txt\n",
"5348 valid, 0 skipped, 50 invalid, 29 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_384_2_epoch50.00_0.2102.output.1.0.txt\n",
"5887 valid, 0 skipped, 57 invalid, 35 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_512_1_epoch50.00_0.1952.output.1.0.txt\n",
"5701 valid, 0 skipped, 44 invalid, 32 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_512_2_epoch50.00_0.1807.output.1.0.txt\n",
"5711 valid, 0 skipped, 49 invalid, 24 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_640_1_epoch50.00_0.1798.output.1.0.txt\n",
"5726 valid, 0 skipped, 41 invalid, 33 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_640_2_epoch50.00_0.1870.output.1.0.txt\n",
"5859 valid, 0 skipped, 51 invalid, 16 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_768_1_epoch46.51_0.1834.output.1.0.txt\n",
"5949 valid, 0 skipped, 69 invalid, 18 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_768_2_epoch46.51_0.1906.output.1.0.txt\n",
"5808 valid, 0 skipped, 64 invalid, 23 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_128_1_epoch50.00_0.4641.output.1.0.txt\n",
"5660 valid, 0 skipped, 24 invalid, 19 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_128_2_epoch50.00_0.4641.output.1.0.txt\n",
"6226 valid, 0 skipped, 36 invalid, 13 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_256_1_epoch50.00_0.3579.output.1.0.txt\n",
"5910 valid, 0 skipped, 23 invalid, 6 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_256_2_epoch50.00_0.3554.output.1.0.txt\n",
"5801 valid, 0 skipped, 22 invalid, 8 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_384_1_epoch50.00_0.3018.output.1.0.txt\n",
"6081 valid, 0 skipped, 10 invalid, 6 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_384_2_epoch50.00_0.2956.output.1.0.txt\n",
"6081 valid, 0 skipped, 22 invalid, 9 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_512_1_epoch50.00_0.2663.output.1.0.txt\n",
"5999 valid, 0 skipped, 25 invalid, 8 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_640_1_epoch50.00_0.2385.output.1.0.txt\n",
"5863 valid, 0 skipped, 20 invalid, 5 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_640_2_epoch50.00_0.2361.output.1.0.txt\n",
"5941 valid, 0 skipped, 7 invalid, 11 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_256_1_epoch50.00_0.4198.output.1.0.txt\n",
"5995 valid, 0 skipped, 12 invalid, 10 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_256_2_epoch50.00_0.4287.output.1.0.txt\n",
"5895 valid, 0 skipped, 19 invalid, 2 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_384_1_epoch50.00_0.3633.output.1.0.txt\n",
"5997 valid, 0 skipped, 9 invalid, 2 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_384_2_epoch50.00_0.3636.output.1.0.txt\n",
"6047 valid, 0 skipped, 17 invalid, 4 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/baseline_384_1_epoch50.00_0.2117.output.1.0.txt\n",
"5889 valid, 0 skipped, 56 invalid, 15 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_512_2_epoch50.00_0.2597.output.1.0.txt\n",
"6263 valid, 0 skipped, 26 invalid, 8 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_768_1_epoch49.83_0.2268.output.1.0.txt\n",
"6065 valid, 0 skipped, 9 invalid, 5 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_512_1_epoch50.00_0.3269.output.1.0.txt\n",
"5894 valid, 0 skipped, 10 invalid, 9 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_512_2_epoch50.00_0.3231.output.1.0.txt\n",
"5942 valid, 0 skipped, 7 invalid, 2 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_640_1_epoch50.00_0.3062.output.1.0.txt\n",
"6002 valid, 0 skipped, 14 invalid, 1 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_640_2_epoch50.00_0.3100.output.1.0.txt\n",
"6057 valid, 0 skipped, 12 invalid, 3 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_768_1_epoch49.83_0.2923.output.1.0.txt\n",
"5896 valid, 0 skipped, 11 invalid, 5 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_768_2_epoch49.83_0.2919.output.1.0.txt\n",
"6047 valid, 0 skipped, 7 invalid, 3 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-25_768_2_epoch50.00_0.2412.output.1.0.txt\n",
"5919 valid, 0 skipped, 15 invalid, 10 failed to parse.\n",
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_128_1_epoch50.00_0.5686.output.1.0.txt\n",
"5983 valid, 0 skipped, 33 invalid, 17 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/mtg-rnn-sweep1/dropout-50_128_2_epoch50.00_0.5690.output.1.0.txt\n",
"6339 valid, 0 skipped, 51 invalid, 22 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_128_1_epoch37.50_0.4733.output.1.0.txt\n",
"5871 valid, 0 skipped, 130 invalid, 42 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_128_2_epoch45.83_0.4774.output.1.0.txt\n",
"5429 valid, 0 skipped, 129 invalid, 45 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_256_1_epoch16.67_0.4530.output.1.0.txt\n",
"5808 valid, 0 skipped, 124 invalid, 38 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_256_2_epoch16.67_0.4552.output.1.0.txt\n",
"5796 valid, 0 skipped, 103 invalid, 44 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_384_2_epoch12.50_0.4469.output.1.0.txt\n",
"5699 valid, 0 skipped, 98 invalid, 41 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_512_1_epoch12.50_0.4374.output.1.0.txt\n",
"5698 valid, 0 skipped, 138 invalid, 49 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_512_2_epoch12.50_0.4458.output.1.0.txt\n",
"5809 valid, 0 skipped, 111 invalid, 53 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_640_1_epoch12.50_0.4365.output.1.0.txt\n",
"5720 valid, 0 skipped, 123 invalid, 47 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_640_2_epoch12.50_0.4406.output.1.0.txt\n",
"5762 valid, 0 skipped, 119 invalid, 30 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_128_1_epoch50.00_0.4780.output.1.0.txt\n",
"5889 valid, 0 skipped, 54 invalid, 14 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_128_2_epoch50.00_0.4823.output.1.0.txt\n",
"5935 valid, 0 skipped, 45 invalid, 10 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_256_1_epoch50.00_0.4000.output.1.0.txt\n",
"6035 valid, 0 skipped, 25 invalid, 8 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_256_2_epoch41.67_0.4244.output.1.0.txt\n",
"6184 valid, 0 skipped, 41 invalid, 7 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_384_1_epoch41.67_0.3870.output.1.0.txt\n",
"6052 valid, 0 skipped, 29 invalid, 10 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_384_2_epoch33.33_0.3991.output.1.0.txt\n",
"6151 valid, 0 skipped, 17 invalid, 11 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_512_1_epoch25.00_0.3859.output.1.0.txt\n",
"5896 valid, 0 skipped, 23 invalid, 8 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_640_1_epoch20.83_0.3864.output.1.0.txt\n",
"5951 valid, 0 skipped, 31 invalid, 24 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_640_2_epoch25.00_0.3864.output.1.0.txt\n",
"5776 valid, 0 skipped, 34 invalid, 7 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_128_1_epoch50.00_0.5749.output.1.0.txt\n",
"6097 valid, 0 skipped, 109 invalid, 22 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_128_2_epoch50.00_0.5740.output.1.0.txt\n",
"6026 valid, 0 skipped, 50 invalid, 19 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_256_1_epoch50.00_0.4398.output.1.0.txt\n",
"5932 valid, 0 skipped, 13 invalid, 2 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_256_2_epoch50.00_0.4460.output.1.0.txt\n",
"6046 valid, 0 skipped, 18 invalid, 11 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_384_1_epoch50.00_0.3946.output.1.0.txt\n",
"5958 valid, 0 skipped, 12 invalid, 5 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_384_2_epoch50.00_0.3981.output.1.0.txt\n",
"6042 valid, 0 skipped, 16 invalid, 8 failed to parse.\n",
2015-12-07 04:45:52 +00:00
"Opening encoded card file: /data/collected/char-rnn-sweep1/baseline_384_1_epoch12.50_0.4431.output.1.0.txt\n",
"5890 valid, 0 skipped, 111 invalid, 48 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-25_512_2_epoch25.00_0.3894.output.1.0.txt\n",
"6057 valid, 0 skipped, 44 invalid, 10 failed to parse.\n",
2015-12-06 22:26:02 +00:00
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_512_1_epoch50.00_0.3835.output.1.0.txt\n",
"6016 valid, 0 skipped, 21 invalid, 8 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_512_2_epoch50.00_0.3825.output.1.0.txt\n",
"5918 valid, 0 skipped, 11 invalid, 1 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_640_1_epoch20.83_0.4714.output.1.0.txt\n",
"6048 valid, 0 skipped, 18 invalid, 13 failed to parse.\n",
"Opening encoded card file: /data/collected/char-rnn-sweep1/dropout-50_640_2_epoch50.00_0.3805.output.1.0.txt\n",
"5958 valid, 0 skipped, 9 invalid, 2 failed to parse.\n",
"Done gathering data.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
2015-12-07 04:45:52 +00:00
"/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.\n",
2015-12-06 22:26:02 +00:00
" warnings.warn(\"Mean of empty slice.\", RuntimeWarning)\n",
2015-12-07 04:45:52 +00:00
"/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:71: RuntimeWarning: invalid value encountered in double_scalars\n",
2015-12-06 22:26:02 +00:00
" ret = ret.dtype.type(ret / rcount)\n"
]
}
],
"source": [
"# ipython hack, as we don't seem to know what __file__ is\n",
"mtgencodedir = '/home/mtgencode' # might want to make a symlink\n",
"\n",
"import sys\n",
"import os\n",
"from collections import OrderedDict\n",
"libdir = os.path.join(mtgencodedir, 'lib')\n",
"sys.path.append(libdir)\n",
"scriptdir = os.path.join(mtgencodedir, 'scripts')\n",
"sys.path.append(scriptdir)\n",
"datadir = os.path.join(mtgencodedir, 'data')\n",
"import jdecode\n",
"import ngrams\n",
"import analysis\n",
"\n",
"realcards = jdecode.mtg_open_file(str(os.path.join(datadir, 'output.txt')), verbose=True)\n",
"separate_lines = True\n",
"lm = ngrams.build_ngram_model(realcards, n=3, separate_lines=separate_lines, verbose=True)\n",
"\n",
"mtg_sweep1_dir = '/data/collected/mtg-rnn-sweep1'\n",
"char_sweep1_dir = '/data/collected/char-rnn-sweep1'\n",
"\n",
"def sweep_outputs(sweepdir):\n",
" if not os.path.isdir(sweepdir):\n",
" print('not a directory: ' + sweepdir)\n",
" return []\n",
" else:\n",
" return [fname for fname in os.listdir(sweepdir) if os.path.isfile(os.path.join(sweepdir, fname))\n",
" and fname[-4:] == '.txt']\n",
"\n",
"def setup_statistics(sweepdir):\n",
" cps = sweep_outputs(sweepdir)\n",
" all_stats = OrderedDict()\n",
" for cp in cps:\n",
" cp_stats = analysis.get_statistics(os.path.join(sweepdir, cp), lm=lm, sep=separate_lines, verbose=True)\n",
" if 'cp' in cp_stats and 'name' in cp_stats['cp']:\n",
" cp_name = cp_stats['cp']['name']\n",
" else:\n",
" cp_name = cp\n",
" all_stats[cp_name] = cp_stats\n",
" return all_stats\n",
"\n",
"mtg_sweep1 = setup_statistics(mtg_sweep1_dir)\n",
"char_sweep1 = setup_statistics(char_sweep1_dir)\n",
"\n",
"print 'Done gathering data.'"
]
},
{
"cell_type": "code",
2015-12-07 04:45:52 +00:00
"execution_count": 43,
2015-12-06 22:26:02 +00:00
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
2015-12-07 04:45:52 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAIHCAYA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ja8Pigu/ckuf6FuK8vBSqAfYDv\nhufGs2t2Rka4+qVL+c2eJ3Kv/4YNfIANXMoGmuNel7KBE7jXH+U3e56oRdpEsjBv+vSkwUtMJXDN\nxo3Mmz49n80SyakoAcxh4bEt8YIF2wl/PHz7sLt/1wNvAN8GXgyvTY5QrxSxhoZGWlomAu8AFoVn\nrwCuDI+E56tobZ1IQ0PjMLRSpPg0NjQwsaUlZfASMx6Y2NpKY0NDPpolknNRupD2CY8vJbl2NOz8\n/6jfOBd3f9PMGoELgCMj1CtF7IZvfJv3de0NLEhR4v6+a51w46VbmDFjap5aJ1K8Wpct6zfmZSBT\nOzu5YvlyDeqVESFKALN7eNyR5NoJ4dGBe5Jc/2t43CfJNRnB9nvtFe7YNWmX0hldb89hawpQVVV2\n2wNojJCEynqS9eQPUH7bthy1RCS/ogQwXcCewL5Jrn0oPL4KPJHk+vbwOCpCvVLEyrLsrMy2fLHT\nmB+Jqre8PLvyY8bkqCUi+RUlgNkMHENftgUAMxsNnBa+fdDdPcm9sczLKxHqlSJ2wAF7Qhbzzg48\ncM/cNaYAaTdqiapm5kwa77+fqRl0I62pqKBm5sw8tEok96IEMA8QBDAnmdmp7h7rKvoSfQHKr1Lc\nGxv70h6hXiliBxywDzydefn99y+xXkbtRi0RTZ0xg9lLlnBSU9OAA3m3AvfU1LDo7LPz1TSRnIqS\nqP+f8GjAL83sTjP7FfC
2015-12-06 22:26:02 +00:00
"text/plain": [
2015-12-07 04:45:52 +00:00
"<matplotlib.figure.Figure at 0x7fe0963334d0>"
2015-12-06 22:26:02 +00:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#analysis.print_statistics(mtg_sweep1['baseline_128_1'])\n",
"%matplotlib inline\n",
2015-12-07 04:45:52 +00:00
"import matplotlib \n",
"matplotlib.rc('xtick', labelsize=20) \n",
"matplotlib.rc('ytick', labelsize=20)\n",
2015-12-06 22:26:02 +00:00
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"def size_from_name(cp_name):\n",
" return int(cp_name.split('_')[-2])\n",
"\n",
2015-12-07 04:45:52 +00:00
"def plot_vs_size(getter, yrange, ylabel):\n",
"\n",
" mtg_sizes_base = [size_from_name(cp) for cp in mtg_sweep1 if 'baseline' in cp]\n",
" char_sizes_base = [size_from_name(cp) for cp in char_sweep1 if 'baseline' in cp]\n",
" mtg_sizes_d25 = [size_from_name(cp) for cp in mtg_sweep1 if 'dropout-25' in cp]\n",
" char_sizes_d25 = [size_from_name(cp) for cp in char_sweep1 if 'dropout-25' in cp]\n",
" mtg_sizes_d50 = [size_from_name(cp) for cp in mtg_sweep1 if 'dropout-50' in cp]\n",
" char_sizes_d50 = [size_from_name(cp) for cp in char_sweep1 if 'dropout-50' in cp]\n",
2015-12-06 22:26:02 +00:00
"\n",
2015-12-07 04:45:52 +00:00
" mtg_val_base = [getter(mtg_sweep1[cp]) for cp in mtg_sweep1 if 'baseline' in cp]\n",
" char_val_base = [getter(char_sweep1[cp]) for cp in char_sweep1 if 'baseline' in cp]\n",
" mtg_val_d25 = [getter(mtg_sweep1[cp]) for cp in mtg_sweep1 if 'dropout-25' in cp]\n",
" char_val_d25 = [getter(char_sweep1[cp]) for cp in char_sweep1 if 'dropout-25' in cp]\n",
" mtg_val_d50 = [getter(mtg_sweep1[cp]) for cp in mtg_sweep1 if 'dropout-50' in cp]\n",
" char_val_d50 = [getter(char_sweep1[cp]) for cp in char_sweep1 if 'dropout-50' in cp]\n",
" \n",
" plt.plot(mtg_sizes_base, mtg_val_base, 'bo',\n",
" mtg_sizes_d25, mtg_val_d25, 'b^',\n",
" mtg_sizes_d50, mtg_val_d50, 'bs',\n",
" char_sizes_base, char_val_base, 'ro',\n",
" char_sizes_d25, char_val_d25, 'r^',\n",
" char_sizes_d50, char_val_d50, 'rs', markersize=12)\n",
" \n",
" plt.xlabel('rnn size', fontsize=32, color='black')\n",
" plt.ylabel(ylabel, fontsize=32, color='black')\n",
" \n",
" fig = plt.gcf()\n",
" \n",
" ax = fig.gca()\n",
" ax.axis([0,800] + yrange)\n",
" \n",
" fig.set_size_inches(8, 8)\n",
" fig.savefig(ylabel + '.png', dpi=300)\n",
" \n",
" plt.show()\n",
2015-12-06 22:26:02 +00:00
"\n",
2015-12-07 04:45:52 +00:00
"#mtg_vlosses = [mtg_sweep1[cp]['cp']['vloss'] for cp in mtg_sweep1 if 'baseline' in cp]\n",
"#char_vlosses = [char_sweep1[cp]['cp']['vloss'] for cp in char_sweep1 if 'baseline' in cp]\n",
2015-12-06 22:26:02 +00:00
"\n",
"#fig, ax = plt.subplots(figsize=(20,10))\n",
"#ax.plot(mtg_sizes, mtg_epochs, 'bs', char_sizes, char_epochs, 'g^')\n",
"#fig.show()\n",
"\n",
2015-12-07 04:45:52 +00:00
"plot_vs_size(lambda cp: float(cp['props']['overall']['bad']) / cp['props']['overall']['total'], [0, 0.32], 'fraction of bad cards')"
2015-12-06 22:26:02 +00:00
]
},
{
"cell_type": "code",
2015-12-07 04:45:52 +00:00
"execution_count": 48,
2015-12-06 22:26:02 +00:00
"metadata": {
2015-12-07 04:45:52 +00:00
"collapsed": false
2015-12-06 22:26:02 +00:00
},
2015-12-07 04:45:52 +00:00
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAHtCAYAAABrvxYGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XlcVPX+P/DXZxgEZVgEUVFUMNGfGyq4X1HQNDUMKcty\nuYrlNbe04rqk3zCXkpRKTK/XTMCrdcvsRu6ViIqpKOhVSXMDZZMQEkEc1vfvD5xzB2YFhv39fDzm\nwTDncz7nfc4s530+53M+RxARGGOMMdY0yeo6AMYYY4zVHU4EGGOMsSaMEwHGGGOsCeNEgDHGGGvC\nOBFgjDHGmjBOBBhjjLEmjBMBxhhjrAmr8URACDFJCLFZCHFKCPFICFEqhPhXFetyFkLsFEKkCSGU\nQohEIcSnQgg7U8fNGGOMNQXyWljGSgD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BAwcalQi0atWK2rdvT9bW1rRixQo6ceIEXbhwgXbv3k2XLl0iIqL//ve/\nZGFhQUIIMjc3pwULFlBUVBTFxcVReHg49e7dW1rWK6+8oncbdu3alezs7MjW1pbWrl1Lv/76K8XG\nxtInn3xCrVu3lurZtm2b1nr++c9/SmUcHBwoODiYzp49S2fPnqWPP/6YHBwcpOlbt27VmN9QS4m2\nmCsmAgkJCfTTTz9J9Xz44YeUkJBQ7vHHH3/orbsiVetYv379DJa1trYmIQQNGjSoUstoaDgRaCSJ\nwNagIJ1N7voegd27U15enknjb0ixERFt2bJF+qHx9fXV23SdnJxc7n/1HzshBL3++uta51u9erVU\nRtvO+PHjxxqnHSoKCAi
"text/plain": [
"<matplotlib.figure.Figure at 0x7fe095ca3f90>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"from numpy.random import randn\n",
"\n",
"z = randn(10)\n",
"\n",
"char_base, = plt.plot(z, 'ro', markersize=15)\n",
"char_d25, = plt.plot(z, 'r^', markersize=15)\n",
"char_d50, = plt.plot(z, 'rs', markersize=15)\n",
"mtg_base, = plt.plot(z, 'bo', markersize=15)\n",
"mtg_d25, = plt.plot(z, 'b^', markersize=15)\n",
"mtg_d50, = plt.plot(z, 'bs', markersize=15)\n",
"\n",
"plt.legend([char_base, char_d25, char_d50, mtg_base, mtg_d25, mtg_d50], ['char-rnn, dropout 0', 'char-rnn, dropout 0.25', 'char-rnn, dropout 0.5', \n",
" 'mtg-rnn, dropout 0', 'mtg-rnn, dropout 0.25', 'mtg-rnn, dropout 0.5'], prop={'size':28})\n",
"\n",
"fig = plt.gcf()\n",
"fig.set_size_inches(8, 8)\n",
"fig.savefig('legend.png', dpi=300)"
]
2015-12-06 22:26:02 +00:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
2015-12-07 04:45:52 +00:00
"version": "2.7.6"
2015-12-06 22:26:02 +00:00
}
},
"nbformat": 4,
"nbformat_minor": 0
}