{"id":4839,"date":"2022-01-26T08:11:00","date_gmt":"2022-01-25T23:11:00","guid":{"rendered":"https:\/\/yorozu.cloudfree.jp\/wordpress\/?p=4839"},"modified":"2024-12-03T16:28:49","modified_gmt":"2024-12-03T07:28:49","slug":"%e3%82%a2%e3%83%a4%e3%83%a1%e3%81%ae%e7%a8%ae%e9%a1%9e%e5%88%a4%e5%88%a5%ef%bc%88%e3%81%9d%e3%81%ae%ef%bc%95%ef%bc%89","status":"publish","type":"post","link":"https:\/\/yorozu.cloudfree.jp\/wordpress\/?p=4839","title":{"rendered":"\u30a2\u30e4\u30e1\u306e\u7a2e\u985e\u5224\u5225\uff08\u305d\u306e\uff15\uff09"},"content":{"rendered":"\n<p>\u5b9f\u884c\u4f8b\u306f\u300csaka.mokumoku\u300d\u306e\u300cGoogle Colabotry\u300d\u74b0\u5883\u306b\u4fdd\u5b58\u3057\u3066\u3042\u308b<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff11\uff0e\u4e8b\u524d\u6e96\u5099<\/strong><\/h4>\n\n\n\n<p>\u3000<code>matplotlib<\/code>\u3092\u4f7f\u3063\u3066\u53ef\u8996\u5316\u3059\u308b<br>\u3000\u3000\u3000\u300cWork Shop\u300d\u306e\u300c\uff13\u5927\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u300d\u306e<a href=\"https:\/\/yorozu.cloudfree.jp\/wordpress\/?p=4461\" target=\"_blank\" rel=\"noreferrer noopener\">Matplotlib<\/a>\u3092\u53c2\u7167<br>\u3000<br>\u3000\u30b9\u30e9\u30a4\u30b9\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u7279\u5b9a\u3059\u308b<br>\u3000\u3000\u3000\u30ea\u30b9\u30c8\u3084\u6587\u5b57\u5217\u3001\u30bf\u30d7\u30eb\u7b49\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u578b\u306e\u4e00\u90e8\u3092<br>\u3000\u3000\u3000\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u6307\u5b9a\u3057\u3066\u53d6\u308a\u51fa\u3059<br><br>\u3000\u3000\u3000\u8907\u6570\u306e\u6570\u5024\u3092\u30b3\u30ed\u30f3(:)\u3067\u533a\u5207\u3063\u3066\uff3b\u3000\uff3d\u3067\u56f2\u3046<br>\u3000\u3000\u3000\u3000\u3000a[start : stop : step]<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000step\uff1a\u4f55\u500b\u3054\u3068\u306b\u62bd\u51fa\u3059\u308b\u304b\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\uff1d1\uff09<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000start\uff1a\u5207\u308a\u53d6\u308a\u305f\u3044\u90e8\u5206\u306e\u958b\u59cb\uff08\u4e00\u756a\u5de6\uff09\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000stop\uff1a\u5207\u308a\u53d6\u308a\u305f\u3044\u90e8\u5206\u306e\u7d42\u308f\u308a\uff08\u4e00\u756a\u53f3\uff09\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff12\uff0e\u6563\u5e03\u56f3\u306e\u4f5c\u6210<\/strong><\/h4>\n\n\n\n<p>\u3000x\u8ef8\u306b\u306f\u304c\u304f\u7247\u306e\u9577\u3055\u3001y\u8ef8\u306b\u306f\u304c\u304f\u7247\u306e\u5e45\u3092\u30bb\u30c3\u30c8\u3001\u6563\u5e03\u56f3\u3092\u63cf\u304f<br>\u3000\u3000\u3000\u304c\u304f\u7247\u306e\u9577\u3055\u3068\u304c\u304f\u7247\u306e\u5e45\u3060\u3051\u3067\u3001\u7279\u5fb4\u304c\u73fe\u308c\u308b<br><br>\u3000\u3000\u3000<font color=\"ff0000\">\uff13\u3064\u306e\u30d6\u30ed\u30c3\u30af\u304c50\u339d\u3001100\u339d\u3067\u533a\u5207\u3089\u308c\u308b\u7406\u7531\u304c\u5206\u304b\u3089\u306a\u3044<\/font><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import matplotlib.pyplot as plt\n\nx = iris.data\ny = iris.target\n\nplt.scatter(x[:50, 0], x[:50, 1], color=&#39;r&#39;, marker=&#39;o&#39;, label=&#39;setosa&#39;)\nplt.scatter(x[50:100, 0], x[50:100, 1], color=&#39;g&#39;, marker=&#39;+&#39;, label=&#39;versicolor&#39;)\nplt.scatter(x[100:, 0], x[100:, 1], color=&#39;b&#39;, marker=&#39;x&#39;, label=&#39;virginica&#39;)\nplt.title(&quot;Iris Plants Database&quot;)\nplt.xlabel(&quot;sepal length(cm)&quot;)\nplt.ylabel(&quot;sepal width(cm)&quot;)\nplt.legend()\nplt.show<\/code><\/pre><\/div>\n\n\n\n<p>\u3000<code>scatter<\/code>\u547d\u4ee4\u306b\u3064\u3044\u3066<br>\u3000\u3000\u3000<code>scatter<\/code>\u306e\u7b2c1\u5f15\u6570\u304cX\u8ef8\u3001\u7b2c2\u5f15\u6570\u304cY\u8ef8<br>\u3000\u3000\u3000\u5f15\u6570\u3067\u7dda\u306e\u8272(<code>color=''<\/code>)\u3084\u30de\u30fc\u30ab\u30fc\u306e\u7a2e\u985e(<code>marker=''<\/code>)\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9(<code>index=''<\/code>)\u306a\u3069\u3082\u6307\u5b9a\u3067\u304d\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/yorozu.cloudfree.jp\/wordpress\/wp-content\/uploads\/2022\/01\/\u6563\u5e03\u56f3.jpg\" rel=\"lightbox[4839]\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/yorozu.cloudfree.jp\/wordpress\/wp-content\/uploads\/2022\/01\/\u6563\u5e03\u56f3-150x150.jpg\" alt=\"\" class=\"wp-image-4861\"\/><\/a><figcaption class=\"wp-element-caption\">\u3000\u3000\u3000\u6563\u5e03\u56f3<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff13\uff0e\u6a5f\u68b0\u5b66\u7fd2<\/strong><\/h4>\n\n\n\n<p>\u3000TensorFlow\u3068Keras\u3092\u30ed\u30fc\u30c9\u3059\u308b<br><br>\u3000\u4e71\u6570\u306e\u30b7\u30fc\u30c9\u5024\u3092\u56fa\u5b9a\u3057\u3066\u4e26\u3079\u66ff\u3048\u308b<br>\u3000\u3000\u3000\u5f15\u6570\u306f\u5b9f\u6570\u3067\u3042\u308c\u3070\u826f\u3044\u30011\u306b\u8a2d\u5b9a\u3059\u308b<br>\u3000\u3000\u3000TensorFlow\u306e\u91cd\u307f\u306e\u8a2d\u5b9a\u304c\u56fa\u5b9a\u3055\u308c\u308b<br><br>\u3000<code>idxr = [k for k in range(Ndata)]<\/code>\u306f\u30ea\u30b9\u30c8\u5185\u5305\u8868\u8a18\u3068\u3044\u3046<br>\u3000\u3000\u3000\u65e2\u5b58\u306e\u30ea\u30b9\u30c8\u304b\u3089\u65b0\u3057\u3044\u30ea\u30b9\u30c8\u3092\u4f5c\u308b\u3053\u3068<br>\u3000\u3000\u3000\u5206\u304b\u308a\u3084\u3059\u304f\u5206\u89e3\u3059\u308b\u3068\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308b<br>\u3000\u3000\u3000\u3000\u3000idxr = []<br>\u3000\u3000\u3000\u3000\u3000for k in Ndate<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000idxr.append(k)<br><br>\u3000print\u6587\u3067\u30ea\u30b9\u30c8\u5185\u306b0\u304b\u3089149\u307e\u3067\u306e\u6570\u5024\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b<br><br>\u3000<code>random.shuffle(idxr)<\/code>\u3088\u3063\u3066\u5148\u307b\u3069\u306e\u30ea\u30b9\u30c8\u306e\u4e2d\u8eab\u3092\u30b7\u30e3\u30c3\u30d5\u30eb\u3057\u3001<br>\u3000\u3000\u3000<code>print(idxr)<\/code>\u3067\u4e2d\u8eab\u304c\u30e9\u30f3\u30c0\u30e0\u306b\u518d\u914d\u7f6e\u3055\u308c\u305f\u304b\u78ba\u8a8d\u3059\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>#\n#TensorFlow\u3068Keras\u3092\u30ed\u30fc\u30c9\u3059\u308b\n#\nimport tensorflow as tf\nfrom tensorflow import keras\nprint(tf.__version__)\n#\n#\u30b7\u30fc\u30c9\u5024\u3092\u8a2d\u5b9a\u3059\u308b\n#\ntf.random.set_seed(1)\n#\n#\u30c7\u30fc\u30bf\u3092\u30e9\u30f3\u30c0\u30e0\u306b\u4e26\u3079\u66ff\u3048\u308b\n#\nimport random\n\nrandom.seed(12345)\nNdata = len(iris.data)\nprint(f&quot;Ndata={Ndata}&quot;)\nidxr = [k for k in range(Ndata)]\nprint(idxr)\nrandom.shuffle(idxr)\nprint(idxr)<\/code><\/pre><\/div>\n\n\n\n<p class=\"has-text-align-left\">\u3000\u30c7\u30fc\u30bf\u3092\u5206\u5272\u3059\u308b<br>\u3000\u3000\u3000\u8a13\u7df4\u30c7\u30fc\u30bf\u3068\u691c\u8a3c\u30c7\u30fc\u30bf\u3092\u534a\u5206\u3001\u534a\u5206\u306b\u5206\u5272\u3059\u308b<br><br>\u3000<code>print(f\"# of training data = {Ndata_train}\")<\/code>\u3068<br>\u3000<code>print(f\"# of validation data = {Ndata-Ndata_train}\")<\/code>\u3067<br>\u3000\u3000\u3000\u305d\u308c\u305e\u308c\u8a13\u7df4\u30c7\u30fc\u30bf\u3068\u691c\u8a3c\u30c7\u30fc\u30bf\u306e\u6570\u3092\u51fa\u529b\u3059\u308b<br><br>\u3000<code>train_data = iris.data[idxr[:Ndata_train]]<\/code>\u306e\u884c\u3067\u306f\u8a13\u7df4\u30c7\u30fc\u30bf\u3092\u3001<br><code>\u3000train_labels = iris.target[idxr[:Ndata_train]]<\/code>\u306e\u884c\u3067\u306f\u8a13\u7df4\u30c7\u30fc\u30bf\u306e\u6559\u5e2b\u30e9\u30d9\u30eb\u3092<br>\u3000\u3000\u3000\u30b9\u30e9\u30a4\u30b9\u3092\u4f7f\u3063\u3066\u3001<code>idxr<\/code>\u306e0~74\u756a\u76ee\u3092\u5404<code>iris.data<\/code>\u3068<code>iris.target<\/code>\u306b\u5bfe\u5fdc\u3055\u305b<br>\u3000\u3000\u3000<code>train_data<\/code>\u3068<code>train_labels<\/code>\u306b\u4ee3\u5165\u3059\u308b<br><br>\u3000<code>val_data = iris.data[idxr[Ndata_train:]]<\/code>\u306e\u884c\u3067\u306f\u691c\u8a3c\u30c7\u30fc\u30bf\u3092\u3001<br>\u3000<code>val_labels = iris.target[idxr[Ndata_train:]]<\/code>\u306e\u884c\u3067\u306f\u691c\u8a3c\u30c7\u30fc\u30bf\u306e\u6559\u5e2b\u30e9\u30d9\u30eb\u3092<br>\u3000\u3000\u3000\u30b9\u30e9\u30a4\u30b9\u3092\u4f7f\u3063\u3066\u3001<code>idxr<\/code>\u306e75~149\u756a\u76ee\u3092\u5404<code>iris.data<\/code>\u3068<code>iris.target<\/code>\u306b\u5bfe\u5fdc\u3055\u305b<br>\u3000\u3000\u3000<code>val_data<\/code>\u3068<code>val_labels<\/code>\u306b\u4ee3\u5165\u3059\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>Ndata_train=int(Ndata*0.5)\nprint(f&quot;# of training data = {Ndata_train}&quot;)\nprint(f&quot;# of validation data = {Ndata-Ndata_train}&quot;)\n\ntrain_data = iris.data[idxr[:Ndata_train]]\ntrain_labels = iris.target[idxr[:Ndata_train]]\n\nval_data = iris.data[idxr[Ndata_train:]]\nval_labels = iris.target[idxr[Ndata_train:]]<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u4f5c\u6210\u3059\u308b<br>\u3000\u3000\u3000Keras\u306eSequential\u3068\u3044\u3046\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u4f5c\u6210<br><br>\u3000\u3000\u30004\u6b21\u5143(\u304c\u304f\u7247\u306e\u9577\u3055\u3001\u304c\u304f\u7247\u306e\u5e45\u3001\u82b1\u5f01\u306e\u9577\u3055\u3001\u82b1\u5f01\u306e\u5e45)\u306e\u30c7\u30fc\u30bf\u304b\u3089<br>\u3000\u3000\u30003\u6b21\u5143(setosa, versicolor, virginica)\u306e\u30e9\u30d9\u30eb\u3078\u5c64\u304c\u69cb\u6210\u3055\u308c\u3066\u3044\u308b<br><br>\u3000\u3000\u3000\u4e2d\u9593\u5c64\u306f2\u5c64\u3067\u30e6\u30cb\u30c3\u30c8\u6570(\u4e2d\u9593\u5c64\u306e\u6b21\u5143)\u306f10\u3001<br>\u3000\u3000\u3000\u3000\u3000<code>Dense<\/code>\u3067\u8a2d\u5b9a\u3057\u305f\u305f\u3081\u5168\u7d50\u5408\u5c64\u306b\u306a\u3063\u3066\u3044\u308b<br><br>\u3000\u3000\u3000<code>model<\/code>\u306b\u306f\u3001<code>keras.Sequential<\/code>\u304b\u3089\u4f5c\u6210\u3057\u305f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u5165\u3063\u3066\u304a\u308a\u3001<br>\u3000\u3000\u3000\u3000\u3000\u3053\u308c\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u3092\u5b66\u7fd2\u3055\u305b\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>model = keras.Sequential([\n    keras.layers.Dense(4, activation=&#39;relu&#39;),\n    keras.layers.Dense(10, activation=&#39;relu&#39;),\n    keras.layers.Dense(10, activation=&#39;relu&#39;),\n    keras.layers.Dense(3, activation=&#39;softmax&#39;)\n])<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u6a5f\u68b0\u5b66\u7fd2\u306e\u6e96\u5099\u3092\u884c\u3046<br>\u3000\u3000\u3000<code>model<\/code>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e<code>compile<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u5b66\u7fd2\u306e\u8a2d\u5b9a\u3092\u884c\u3046<br><br>\u3000\u3000\u3000<code>compile<\/code>\u306b\u306f\u5f15\u6570\u304c3\u3064<br>\u3000\u3000\u3000\u3000\u3000optimizer:\u6700\u9069\u5316\u624b\u6cd5\u3092\u8a2d\u5b9a\u3059\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u4eca\u56de\u306f<code>SGD<\/code>\u306b\u8a2d\u5b9a<br>\u3000\u3000\u3000\u3000\u3000loss:\u640d\u5931\u95a2\u6570\u3092\u8a2d\u5b9a\u3059\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u4eca\u56de\u306f<code>sparse_categorical_crossentropy<\/code>\u306b\u8a2d\u5b9a<br>\u3000\u3000\u3000\u3000\u3000metrics:\u8a55\u4fa1\u95a2\u6570\u3092\u8a2d\u5b9a\u3059\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000<code>accuracy<\/code>\u3092\u5165\u308c\u3066\u304a\u3051\u3070\u554f\u984c\u306a\u3044\u3001\u8a55\u4fa1\u95a2\u6570\u3092\u8a2d\u5b9a\u3057\u3066\u3082\u826f\u3044<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>model.compile(optimizer=&#39;SGD&#39;,\n              loss=&#39;sparse_categorical_crossentropy&#39;,\n              metrics=[&#39;accuracy&#39;])<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u6a5f\u68b0\u5b66\u7fd2\u3092\u884c\u3046<br>\u3000\u3000\u3000<code>model<\/code>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e<code>fit<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067\u5b66\u7fd2\u3092\u884c\u3046<br><br>\u3000\u3000\u3000<code>fit<\/code>\u306e\u5f15\u6570\u306b<br>\u3000\u3000\u3000\u3000\u3000\u8a13\u7df4\u30c7\u30fc\u30bf\u3068\u305d\u308c\u306b\u5bfe\u5fdc\u3059\u308b\u8a13\u7df4\u30c7\u30fc\u30bf\u306e\u30e9\u30d9\u30eb\u3092\u4ee3\u5165\u3059\u308b<br>\u3000\u3000\u3000\u3000\u3000\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u3057\u3066\u4ed6\u306b4\u3064\u306e\u5f15\u6570\u3092\u4f7f\u3063\u3066\u3044\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000validation_data:\u691c\u8a3c\u7528\u30c7\u30fc\u30bf\u3092\u30bf\u30d7\u30eb\u306b\u3057\u3066\u6e21\u3059<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000<code>(val_data, val_labels)<\/code>\u3092\u8a2d\u5b9a\u3059\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000epochs:\u30a8\u30dd\u30c3\u30af\u6570\u3092\u8a2d\u5b9a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306f1<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u300030\u306b\u8a2d\u5b9a\u3059\u308b\u3057\u3066\u3044\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000batch_size:\u30d0\u30c3\u30c1\u30b5\u30a4\u30ba\u3092\u8a2d\u5b9a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306f32<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30df\u30cb\u30d0\u30c3\u30c1\u306e\u30b5\u30a4\u30ba\u306f<code>Ndata_train\/\/10<\/code>\u306b\u3088\u3063\u30667\u3064\u3060\u304c\u3001<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3053\u306e\u6570\u5b57\u306b\u7279\u306b\u610f\u5473\u306f\u306a\u3044<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000verbose:\u30ed\u30b0\u51fa\u529b\u306e\u8a2d\u5b9a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306f1<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30000\u3060\u3068\u30ed\u30b0\u304c\u51fa\u306a\u3044<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u6b63\u306e\u5024\u3060\u3068\u7d30\u304b\u3044\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u8ca0\u306e\u5024\u3060\u3068epoch\u6570\u306e\u307f\u8868\u793a\u3055\u308c\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>training_history = model.fit(train_data, train_labels,\n                             validation_data=(val_data, val_labels),\n                             epochs=30,\n                             batch_size = Ndata_train\/\/10,\n                             verbose=1)<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u7d50\u679c\u3092\u8a55\u4fa1\u3059\u308b<br>\u3000\u3000\u3000\u5c65\u6b74\u3092\u898b\u308b<br>\u3000\u3000\u3000\u3000\u3000fit\u306e\u8fd4\u308a\u5024\u3092<code>training_history<\/code>\u306b\u4ee3\u5165\u3057\u3001\u4e2d\u8eab\u3092\u898b\u308b<br><br>\u3000\u3000\u3000\u5927\u91cf\u306b\u8868\u793a\u3055\u308c\u308b\u304c\u5c65\u6b74\u306f<code>history<\/code>\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b<br>\u3000\u3000\u3000\u3000\u3000\u51fa\u529b\u7d50\u679c\u306b<code>'accuracy':<\/code>\u3068\u3042\u308b\u3053\u3068\u304b\u3089dict\u578b\u306e\u30ea\u30b9\u30c8\u3067\u3042\u308b<br><br>\u3000\u3000\u3000\u8f9e\u66f8\u306e\u30ad\u30fc\u306b\u4f55\u304c\u5165\u3063\u3066\u308b\u306e\u304b\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b<code>keys<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046<br>\u3000\u3000\u3000\u3000\u30004\u3064\u306e\u30ad\u30fc\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000val_accuracy:\u691c\u8a3c\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u5024<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000loss:\u8a13\u7df4\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u640d\u5931\u95a2\u6570\u306e\u5024<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000accuracy:\u8a13\u7df4\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u5024<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000val_loss:\u691c\u8a3c\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u640d\u5931\u95a2\u6570\u306e\u5024<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>dir(training_history)\n\ntraining_history.history\n\ntraining_history.history.keys()<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u7cbe\u5ea6\u3092\u78ba\u8a8d\u3059\u308b<br>\u3000\u3000\u3000\u8a13\u7df4\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u5024\u3068\u691c\u8a3c\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u5024\u3092\u78ba\u8a8d\u3059\u308b<br>\u3000\u3000\u3000\u3000\u3000\u8a13\u7df4\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u5024\u304c79%<br>\u3000\u3000\u3000\u3000\u3000\u691c\u8a3c\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u5024\u304c73%<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>print(&quot;traininig&quot;)\nprint(training_history.history[&#39;accuracy&#39;][-1])\nprint(&quot;validation&quot;)\nprint(training_history.history[&#39;val_accuracy&#39;][-1])<\/code><\/pre><\/div>\n\n\n\n<p>\u3000\u640d\u5931\u95a2\u6570\u3068\u7cbe\u5ea6\u306e\u5c65\u6b74\u306b\u3064\u3044\u3066\u6563\u5e03\u56f3\u3067\u53ef\u8996\u5316\u3059\u308b<br>\u3000\u3000\u3000\u640d\u5931\u95a2\u6570\u306e\u6563\u5e03\u56f3\u306f\u5bfe\u6570\u8ef8\u306b\u3059\u308b\u305f\u3081\u306b<code>plt.semilogy<\/code>\u3092\u4f7f\u3046<br>\u3000\u3000\u3000\u7cbe\u5ea6\u306e\u6563\u5e03\u56f3\u306f<code>plt.ylim<\/code>\u3092\u4f7f\u3063\u3066y\u8ef8\u306e\u7bc4\u56f2\u30920~1.1\u306b\u8a2d\u5b9a\u3059\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># \u8a13\u7df4\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u640d\u5931\u95a2\u6570\u306e\u30d7\u30ed\u30c3\u30c8\ny=training_history.history[&#39;loss&#39;]\nx=range(len(y))\nplt.semilogy(x,y,label=&quot;loss for training&quot;)\n\n# \u691c\u8a3c\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u640d\u5931\u95a2\u6570\u306e\u30d7\u30ed\u30c3\u30c8\ny=training_history.history[&#39;val_loss&#39;]\nx=range(len(y))\nplt.semilogy(x,y,label=&quot;loss for validation&quot;,alpha=0.5)\n\nplt.legend()\nplt.xlabel(&quot;Steps&quot;)\nplt.show()\n\n# \u8a13\u7df4\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u30d7\u30ed\u30c3\u30c8\ny=training_history.history[&#39;accuracy&#39;]\nx=range(len(y))\nplt.plot(x,y,label=&quot;accuracy for training&quot;)\n\n# \u691c\u8a3c\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u7cbe\u5ea6\u306e\u30d7\u30ed\u30c3\u30c8\ny=training_history.history[&#39;val_accuracy&#39;]\nx=range(len(y))\nplt.plot(x,y,label=&quot;accuracy for validation&quot;)\n\nplt.legend()\nplt.xlabel(&quot;Steps&quot;)\nplt.ylim(0,1.1)\nplt.show()<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff14\uff0e\u7d50\u8ad6<\/strong><\/h4>\n\n\n\n<p>\u3000\u6700\u7d42\u7684\u306a\u8a13\u7df4\u30c7\u30fc\u30bf\u306e\u6b63\u7b54\u7387\u306f79%\u3001\u691c\u8a3c\u30c7\u30fc\u30bf\u306e\u6b63\u7b54\u7387\u306f73%<br>\u3000\u3000\u3000\u30a2\u30e4\u30e1\u306f3\u7a2e\u985e\u306a\u306e\u3067\u5f53\u3066\u305a\u3063\u307d\u3046\u306e33.3%\u3088\u308a\u306f\u9ad8\u3044\u7cbe\u5ea6<br><br>\u3000\u6563\u5e03\u56f3\u3067\u306f\u640d\u5931\u95a2\u6570\u304c\u6e1b\u5c11\u3059\u308b\u3068\u5206\u985e\u7cbe\u5ea6\u306f\u4e0a\u6607\u3059\u308b\u3001\u8ca0\u306e\u76f8\u95a2\u304c\u898b\u3089\u308c\u308b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30fb\u300c\u3042\u3084\u3081\u300d\u306e\u7a2e\u985e\u3092\u5224\u5225\u3059\u308b\u6a5f\u68b0\u5b66\u7fd2\u306b\u3064\u3044\u3066<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[24],"class_list":["post-4839","post","type-post","status-publish","format-standard","hentry","category-99_","tag-24"],"_links":{"self":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4839"}],"version-history":[{"count":29,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4839\/revisions"}],"predecessor-version":[{"id":4928,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4839\/revisions\/4928"}],"wp:attachment":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}