{"id":5254,"date":"2024-08-22T11:39:26","date_gmt":"2024-08-22T02:39:26","guid":{"rendered":"https:\/\/blog.since2020.jp\/?p=5254"},"modified":"2024-09-04T14:54:12","modified_gmt":"2024-09-04T05:54:12","slug":"autoencoder2","status":"publish","type":"post","link":"https:\/\/since2020.jp\/media\/autoencoder2\/","title":{"rendered":"\u3010\u6a5f\u68b0\u5b66\u7fd2\u3011\u7570\u5e38\u691c\u77e5_autoencoder"},"content":{"rendered":"\n<p>\u4eca\u56de\u306f\u6a5f\u68b0\u5b66\u7fd2\u624b\u6cd5\u306e\u4e00\u3064\u3067\u3042\u308bAutoencoder\u3001\u304a\u3088\u3073\u305d\u306e\u7570\u5e38\u691c\u77e5\u3078\u306e\u5fdc\u7528\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>\u6a5f\u68b0\u5b66\u7fd2\u624b\u6cd5\u306e\u4e00\u3064\u3067\u3042\u308bAutoencoder\u3001\u304a\u3088\u3073\u305d\u306e\u7570\u5e38\u691c\u77e5\u3078\u306e\u5fdc\u7528\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u3000Autoencoder\u3068\u306f\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u4e00\u7a2e\u3067\u6559\u5e2b\u306a\u3057\u5b66\u7fd2\u306b\u5206\u985e\u3055\u308c\u307e\u3059\u3002\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3067\u306f\u5165\u529b\u5c64\u304b\u3089\u51fa\u529b\u5c64\u307e\u3067\u30c7\u30fc\u30bf\u304c\u6d41\u308c\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u306b\u304a\u3044\u3066\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c7\u30fc\u30bf\u3092\u305d\u306e\u307e\u307e\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u5b66\u7fd2\u3057\u307e\u3059\u3002\u305d\u3053\u3067\u5165\u529b\u5c64\u3068\u51fa\u529b\u5c64\u3068\u306e\u5dee\u5206\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u7570\u5e38\u691c\u77e5\u306b\u5fdc\u7528\u3055\u305b\u305f\u308a\u3001\u672c\u8cea\u90e8\u5206\u306e\u307f\u3092\u629c\u304d\u51fa\u3059\u3088\u3046\u306a\u7279\u5fb4\u304b\u3089\u30ce\u30a4\u30ba\u9664\u53bb\u306a\u3069\u306b\u5fdc\u7528\u3055\u308c\u305f\u308a\u3057\u307e\u3059\u3002\u672c\u30d6\u30ed\u30b0\u3067\u306fAutoencoder\u306e\u8aac\u660e\u3001\u7570\u5e38\u691c\u77e5\u3078\u306e\u5fdc\u7528\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u308b\u5b9f\u88c5\u307e\u3067\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n<h2>Autoencoder\u3068\u306f<\/h2>\n<p>\u3000Autoencoder\u306f\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u4e00\u7a2e\u3067\u3042\u308a\u3001\u5358\u7d14\u306a\u30e2\u30c7\u30eb\u306f\u5165\u529b\u5c64\u3001\u4e2d\u9593\u5c64\u3001\u51fa\u529b\u5c64\u304b\u3089\u6210\u308a\u7acb\u3061\u307e\u3059\u3002Autoencoder\u306e\u51fa\u529b\u5c64\u306f\u3001\u5165\u529b\u5c64\u3068\u540c\u3058\u30c7\u30fc\u30bf\u3092\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u6a5f\u80fd\u3057\u307e\u3059\u3002\u3053\u3053\u3067Autoencoder\u3067\u306f\u5165\u529b\u5c64\u304b\u3089\u4e2d\u9593\u5c64\u306e\u3053\u3068\u3092\u300c\u30a8\u30f3\u30b3\u30fc\u30c0\u300d\u3001\u4e2d\u9593\u5c64\u304b\u3089\u51fa\u529b\u5c64\u306e\u3053\u3068\u3092\u300c\u30c7\u30b3\u30fc\u30c0\u300d\u3068\u547c\u3073\u307e\u3059\u3002\u4e00\u822c\u7684\u306a\u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u306b\u304a\u3044\u3066\u6700\u3082\u7279\u5fb4\u7684\u306a\u3053\u3068\u306f\u3001\u5165\u529b\u5c64\u3068\u51fa\u529b\u5c64\u306e\u30ce\u30fc\u30c9\u306e\u6570\u304c\u540c\u3058\u3067\u3042\u308a\u3001\u4e2d\u9593\u5c64\u306e\u30ce\u30fc\u30c9\u6570\u304c\u5c0f\u3055\u304f\u306a\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u5165\u529b\u5c64\u3068\u540c\u3058\u69cb\u9020\u3092\u6301\u3064\u51fa\u529b\u3092\u8003\u3048\u308b\u3053\u3068\u304c\u51fa\u6765\u3001\u4e2d\u9593\u5c64\u3067\u91cd\u8981\u306a\u7279\u5fb4\u306e\u307f\u3092\u62bd\u51fa\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u4ee5\u4e0b\u3001\u30a4\u30e1\u30fc\u30b8\u56f3\u3067\u3059\u3002<\/p>\r\n\r\n<div id=\"attachment_5255\" style=\"width: 204px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-5255\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-1-300x218.png\" alt=\"Autoencoder\" width=\"194\" height=\"141\" class=\"wp-image-5255\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-1-300x218.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-1.png 602w\" sizes=\"(max-width: 194px) 100vw, 194px\" \/><p id=\"caption-attachment-5255\" class=\"wp-caption-text\">Autoencoder<\/p><\/div>\r\n\r\n<p><!-- notionvc: aa00de7b-44c9-4ccf-bbce-35d6daf2aaa1 --><\/p>\r\n<p>\u5165\u529b\u5c64\u304b\u3089\u4e2d\u9593\u5c64\u307e\u3067\u306e\u30a8\u30f3\u30b3\u30fc\u30c0\u3067\u306f\u5165\u529b\u30c7\u30fc\u30bf\u304b\u3089\u5fa9\u5143\u306b\u95a2\u3057\u3066\u91cd\u8981\u306a\u60c5\u5831\u306e\u307f\u3092\u53d6\u308a\u51fa\u3059\u6b21\u5143\u524a\u6e1b\u90e8\u3001\u4e2d\u9593\u5c64\u304b\u3089\u51fa\u529b\u5c64\u307e\u3067\u306e\u30c7\u30b3\u30fc\u30c0\u3067\u306f\u62bd\u51fa\u30c7\u30fc\u30bf\u304b\u3089\u5143\u306e\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3059\u308b\u30c7\u30fc\u30bf\u751f\u6210\u90e8\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\r\n<p>\u4e2d\u9593\u5c64\u3001\u51fa\u529b\u5c64\u3067\u306f\u901a\u5e38\u306e\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3068\u540c\u69d8\u306b\u5165\u529b\u5c64\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u5404\u7279\u5fb4\u91cf\u3092\u91cd\u307f\u3065\u3051\u3057\u548c\u3092\u53d6\u308a\u3001\u30ce\u30fc\u30c9\u306e\u4e2d\u3067\u6d3b\u6027\u5316\u95a2\u6570\u3092\u901a\u3057\u8a08\u7b97\u3057\u307e\u3059\u3002<\/p>\r\n<p>\u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u306e\u672c\u8cea\u306f\u5b66\u7fd2\u30c7\u30fc\u30bf\u304b\u3089\u3044\u304b\u306b\u3057\u3066\u9069\u5207\u306a\u4e2d\u9593\u5c64\u3092\u4f5c\u6210\u3059\u308b\u304b\u3067\u3059\u3002\u9069\u5207\u306b\u4e2d\u9593\u5c64\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u5b66\u7fd2\u30c7\u30fc\u30bf\u306e\u91cd\u8981\u306a\u60c5\u5831\u3092\u8868\u73fe\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u306e\u3067\u3059\u3002<\/p>\n\n<h2>\u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u3068\u7570\u5e38\u691c\u77e5\u306e\u95a2\u4fc2<\/h2>\n<p>\u3053\u3053\u307e\u3067\u3001\u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u3068\u306f\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u4e00\u7a2e\u3067\u3042\u308a\u5165\u529b\u5c64\u3068\u540c\u3058\u3088\u3046\u306b\u51fa\u529b\u5c64\u3092\u751f\u6210\u3055\u305b\u308b\u305f\u3081\u5b66\u7fd2\u306b\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u8ff0\u3079\u3066\u304d\u307e\u3057\u305f\u3002\u3057\u305f\u304c\u3063\u3066\u5b66\u7fd2\u30c7\u30fc\u30bf\u306b\u6b63\u5e38\u30c7\u30fc\u30bf\u306e\u307f\u3092\u4e0e\u3048\u3066\u5b66\u7fd2\u3055\u305b\u305f\u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u30e2\u30c7\u30eb\u306b\u5bfe\u3057\u3066\u3001\u7570\u5e38\u5024\u304c\u5165\u529b\u3057\u305f\u3068\u304d\u3001\u5165\u529b\u5c64\u3068\u51fa\u529b\u5c64\u306e\u5024\u306f\u6b63\u5e38\u30c7\u30fc\u30bf\u306e\u5dee\u306b\u6bd4\u3079\u3066\u5927\u304d\u304f\u306a\u308b\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002\u3053\u308c\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u7570\u5e38\u691c\u77e5\u306b\u7528\u3044\u3089\u308c\u308b\u306e\u3067\u3059\u3002<\/p>\n\n<h2>\u5b9f\u88c5<\/h2>\n<p>\u3067\u306f\u3001\u5165\u529b\u30c7\u30fc\u30bf\u306b\u6b63\u5e38\u30c7\u30fc\u30bf\u3092\u4e0e\u3048\u7570\u5e38\u691c\u77e5\u3059\u308b\u6d41\u308c\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u4eca\u56de\u306fMNIST\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f7f\u7528\u3057\u3066\u5b9f\u88c5\u3057\u307e\u3059\u3002\u3053\u308c\u306f\uff10\uff5e\uff19\u306e\u6570\u5024\u304c\uff12\uff18\uff0a\uff12\uff18\u306e\u30d4\u30af\u30bb\u30eb\u3067\u8868\u73fe\u3055\u308c\u305f\u624b\u66f8\u304d\u753b\u50cf\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u3059\u3002<br \/>\r\n\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\uff1a<\/p>\r\n\r\n<div id=\"attachment_5256\" style=\"width: 180px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-5256\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-2-300x120.png\" alt=\"\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\" width=\"170\" height=\"68\" class=\"wp-image-5256\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-2-300x120.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-2-768x307.png 768w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/Untitled-2.png 992w\" sizes=\"(max-width: 170px) 100vw, 170px\" \/><p id=\"caption-attachment-5256\" class=\"wp-caption-text\">\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf<\/p><\/div>\r\n\r\n<p>\u4eca\u56de\u306f\u5165\u529b\u30c7\u30fc\u30bf\u306b\uff10\uff0c\uff11\uff0c\uff12\u3092\u4e0e\u3048\u3001\uff08\uff10\uff0c\uff11\uff0c\uff12\u3092\u6b63\u5e38\u30c7\u30fc\u30bf\u3068\u307f\u306a\u3059\u3002\uff09\u6b63\u5e38\u30c7\u30fc\u30bf\u304c\u5165\u529b\u3055\u308c\u305f\u3068\u304d\u30018\u306a\u3069\u306e\u7570\u5e38\u30c7\u30fc\u30bf\u304c\u5165\u529b\u3055\u308c\u305f\u3068\u304d\u306e\u6319\u52d5\u3092\u78ba\u8a8d\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\r\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u6e96\u5099\u304b\u3089\u884c\u3044\u307e\u3059\u3002\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304a\u3088\u3073\u30c7\u30fc\u30bf\u306e\u524d\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>import numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom tensorflow.keras.layers import Input, Dense\r\nfrom tensorflow.keras.models import Model\r\nfrom tensorflow.keras.datasets import mnist\r\n\r\n# MNIST\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u30ed\u30fc\u30c9\r\n(x_train, y_train), (x_test, y_test) = mnist.load_data()\r\n\r\n# \u6570\u5b570, 1, 2\u306e\u307f\u3092\u9078\u629e\r\ntrain_filter = np.where((y_train == 0) | (y_train == 1) | (y_train == 2))\r\n\r\nx_train, y_train = x_train[train_filter], y_train[train_filter]\r\n\r\n# \u30c7\u30fc\u30bf\u306e\u6b63\u898f\u5316\uff080\u301c1\u306e\u7bc4\u56f2\u306b\u30b9\u30b1\u30fc\u30eb\uff09\r\nx_train = x_train.astype('float32') \/ 255.\r\nx_test = x_test.astype('float32') \/ 255.\r\n\r\n# 28x28\u306e\u753b\u50cf\u3092784\u6b21\u5143\u306e\u30d9\u30af\u30c8\u30eb\u306b\u5909\u63db\r\nx_train = x_train.reshape((len(x_train), np.prod(x_train.shape[1:])))\r\nx_test = x_test.reshape((len(x_test), np.prod(x_test.shape[1:])))\r\n\r\n# \u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u30fc\u306e\u6b21\u5143\u3092\u5b9a\u7fa9\r\ninput_dim = 784 # 28*28\r\nencoding_dim = 32 # \u5727\u7e2e\u5f8c\u306e\u6b21\u5143\u6570<\/code><\/pre>\r\n<\/div>\r\n<p>\u6b21\u306b\u3001\u30a8\u30f3\u30b3\u30fc\u30c0\u90e8\u3001\u30c7\u30b3\u30fc\u30c0\u90e8\u3092\u5b9a\u7fa9,\u3001\u304a\u3088\u3073\u30e2\u30c7\u30eb\u306e\u751f\u6210\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u300cactivation\u300d\u306b\u300crelu\u300d\u3084\u300csigmoid\u300d\u304c\u3042\u308a\u307e\u3059\u304c\u3053\u308c\u304c\u6d3b\u6027\u5316\u95a2\u6570\u306b\u306a\u308a\u307e\u3059\u3002\u3069\u306e\u3088\u3046\u306a\u6d3b\u6027\u5316\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u304b\u306f\u3001\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u9078\u3076\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"># \u30a8\u30f3\u30b3\u30fc\u30c0\u30fc\r\ninput_img = Input(shape=(input_dim,))\r\nencoded = Dense(encoding_dim, activation='relu')(input_img)\r\n\r\n# \u30c7\u30b3\u30fc\u30c0\u30fc\r\ndecoded = Dense(input_dim, activation='sigmoid')(encoded)\r\n\r\n# \u30aa\u30fc\u30c8\u30a8\u30f3\u30b3\u30fc\u30c0\u30fc\u30e2\u30c7\u30eb\r\nautoencoder = Model(input_img, decoded)<\/pre>\r\n<\/div>\r\n<p>\u6700\u5f8c\u306b\u30e2\u30c7\u30eb\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u3001\u5b66\u7fd2\u3092\u884c\u3044\u307e\u3059\u3002\u3053\u3053\u3067loss\u3084epochs\u306a\u3069\u3082\u30cf\u30a4\u30d1\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u3042\u308a\u4e8b\u524d\u306b\u4e0e\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># \u30e2\u30c7\u30eb\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\r\nautoencoder.compile(optimizer='adam', loss='binary_crossentropy')\r\n\r\n# \u30e2\u30c7\u30eb\u306e\u8a13\u7df4\r\nautoencoder.fit(x_train, x_train,\r\nepochs=5,\r\nbatch_size=256,\r\nshuffle=True,\r\nvalidation_data=(x_test, x_test))\r\n\r\n# \u30a8\u30f3\u30b3\u30fc\u30c0\u30fc\u30e2\u30c7\u30eb\r\nencoder = Model(input_img, encoded)\r\n<\/code><\/pre>\r\n<\/div>\r\n<p><br \/>\r\n\u3067\u306f\u3001\u4f5c\u6210\u3057\u305f\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3057\u3066\u753b\u50cf\u3092\u518d\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\r\n<p>&nbsp;<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>decoded_imgs = autoencoder.predict(x_test)\r\n\r\n# \u518d\u69cb\u6210\u753b\u50cf\u306e\u8868\u793a\r\nn = 10 # \u8868\u793a\u3059\u308b\u6570\u5b57\u306e\u6570\r\nplt.figure(figsize=(20, 4))\r\nfor i in range(n):\r\n# \u30aa\u30ea\u30b8\u30ca\u30eb\u753b\u50cf\r\nax = plt.subplot(2, n, i + 1)\r\nplt.imshow(x_test[i].reshape(28, 28))\r\nplt.gray()\r\nax.get_xaxis().set_visible(False)\r\nax.get_yaxis().set_visible(False)\r\n\r\n # \u518d\u69cb\u6210\u3055\u308c\u305f\u753b\u50cf\r\nax = plt.subplot(2, n, i + 1 + n)\r\nplt.imshow(decoded_imgs[i].reshape(28, 28))\r\nplt.gray()\r\nax.get_xaxis().set_visible(False)\r\nax.get_yaxis().set_visible(False)\r\nplt.show()\r\n\r\n<\/code><\/pre>\r\n<p>\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<\/div>\r\n<p><img decoding=\"async\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/image-1-1-300x62.png\" alt=\"\" width=\"300\" height=\"62\" class=\"alignnone size-medium wp-image-5257\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/image-1-1-300x62.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/image-1-1.png 741w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\r\n<p>\u3053\u306e\u3088\u3046\u306b\u6b63\u5e38\u30c7\u30fc\u30bf\u3068\u3057\u3066\u7528\u3044\u305f\uff10\uff0c\uff11\uff0c\uff12\u306f\u3088\u304f\u518d\u69cb\u7bc9\u3055\u308c\u3066\u3044\u308b\u306e\u306b\u5bfe\u3057\u3066\uff17\uff0c\u3084\uff19\u3068\u3044\u3063\u305f\u6b63\u5e38\u30c7\u30fc\u30bf\u306b\u7528\u3044\u3066\u3044\u306a\u3044\u30c7\u30fc\u30bf\u3092\u518d\u69cb\u7bc9\u3059\u308b\u3068\u4e0a\u624b\u304f\u518d\u69cb\u7bc9\u3067\u304d\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u3053\u308c\u3092\u3055\u3089\u306b\u6570\u5024\u3067\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\r\n<p>&nbsp;<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># \u5143\u306e\u753b\u50cf\u3068\u518d\u69cb\u6210\u3055\u308c\u305f\u753b\u50cf\u306e\u5dee\u3092\u8a08\u7b97\r\nerror = np.mean(np.abs(x_test[0] - decoded_imgs[0]))\r\nprint(f'Sample {0} - True Label: {y_test[0]} - Reconstruction Error: {error}')\r\n\r\nerror = np.mean(np.abs(x_test[1] - decoded_imgs[1]))\r\nprint(f'Sample {1} - True Label: {y_test[1]} - Reconstruction Error: {error}')\r\n\r\nerror = np.mean(np.abs(x_test[7] - decoded_imgs[7]))\r\nprint(f'Sample {7} - True Label: {y_test[7]} - Reconstruction Error: {error}')<\/code><\/pre>\r\n<\/div>\r\n<p>\u518d\u69cb\u7bc9\u8aa4\u5dee\u3092\u7d76\u5bfe\u5024\u8aa4\u5dee\u3068\u3057\u3066\u8868\u73fe\u3057\u307e\u3057\u305f\u3002\u7d50\u679c\u306f<\/p>\r\n\r\n<div id=\"attachment_5258\" style=\"width: 310px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-5258\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/image-2-1-300x37.png\" alt=\"\u7d50\u679c\" width=\"300\" height=\"37\" class=\"wp-image-5258 size-medium\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/image-2-1-300x37.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/08\/image-2-1.png 527w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><p id=\"caption-attachment-5258\" class=\"wp-caption-text\">\u7d50\u679c<\/p><\/div>\r\n\r\n<p>\u3067\u3059\u3002<\/p>\r\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\uff12\u306f\u8aa4\u5dee\u304c\u5c0f\u3055\u3044\u306e\u306b\u5bfe\u3057\u3066\uff17\u3084\uff19\u306f\u8aa4\u5dee\u304c\u5927\u304d\u3044\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u3053\u3053\u3067\u95be\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u7570\u5e38\u304b\u6b63\u5e38\u5316\u3092\u5206\u3051\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u306e\u3067\u3059\u3002<\/p>\r\n<p><!-- notionvc: 5069037c-84bb-4e23-b996-edb00ef8bafe --><\/p>\n\n<h2>\u7d42\u308f\u308a\u306b<\/h2>\n<p>\u4eca\u56de\u306fautoencoder\u306b\u3064\u3044\u3066\u89e3\u8aac\u3092\u884c\u3044\u307e\u3057\u305f\u3002\u3053\u306e\u30e2\u30c7\u30eb\u306f\u69d8\u3005\u306a\u65b9\u5411\u306b\u62e1\u5f35\u3055\u308c\u3066\u304a\u308a\u5fdc\u7528\u7cfb\u306e\u5f62\u3082\u5b58\u5728\u3057\u307e\u3059\u3002\u6b21\u56de\u306e\u30d6\u30ed\u30b0\u3067\u306f\u4ed6\u306e\u30e2\u30c7\u30eb\u306b\u3064\u3044\u3066\u3082\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u6a5f\u68b0\u5b66\u7fd2\u624b\u6cd5\u306e\u4e00\u3064\u3067\u3042\u308bAutoencoder\u3001\u304a\u3088\u3073\u305d\u306e\u7570\u5e38\u691c\u77e5\u3078\u306e\u5fdc\u7528\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u306f\u3058\u3081\u306b \u6a5f\u68b0\u5b66\u7fd2\u624b\u6cd5\u306e\u4e00\u3064\u3067\u3042\u308bAutoencoder\u3001\u304a\u3088\u3073\u305d\u306e\u7570\u5e38\u691c\u77e5\u3078\u306e\u5fdc\u7528\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002  [&hellip;]<\/p>\n","protected":false},"author":44,"featured_media":2525,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","swell_btn_cv_data":"","footnotes":"","_wp_rev_ctl_limit":""},"categories":[1249],"tags":[96,419,675],"class_list":["post-5254","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge","tag-ai","tag-419","tag-675"],"_links":{"self":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/5254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/comments?post=5254"}],"version-history":[{"count":0,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/5254\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media\/2525"}],"wp:attachment":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media?parent=5254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/categories?post=5254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/tags?post=5254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}