{"id":92,"date":"2025-08-22T18:51:55","date_gmt":"2025-08-22T09:51:55","guid":{"rendered":"https:\/\/ik1-221-80670.vs.sakura.ne.jp\/wordpress\/archives\/92"},"modified":"2025-08-22T19:04:26","modified_gmt":"2025-08-22T10:04:26","slug":"ai%e3%81%a7%e3%82%88%e3%81%8f%e4%bd%bf%e3%82%8f%e3%82%8c%e3%82%8bsoftmax%e9%96%a2%e6%95%b0%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6-3","status":"publish","type":"post","link":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/92","title":{"rendered":"AI\u3067\u3088\u304f\u4f7f\u308f\u308c\u308bSoftmax\u95a2\u6570\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p><strong>Softmax\u95a2\u6570\u3068\u306f\uff1f<\/strong><br \/>\nSoftmax\u95a2\u6570\u306f\u3001\u6a5f\u68b0\u5b66\u7fd2\u3084\u6df1\u5c64\u5b66\u7fd2\u306e\u5206\u91ce\u3067\u3088\u304f\u5229\u7528\u3055\u308c\u308b\u95a2\u6570\u306e\u3072\u3068\u3064\u3067\u3059\u3002\u7279\u306b\u300c\u5206\u985e\u554f\u984c\u300d\u306b\u304a\u3044\u3066\u3001\u30e2\u30c7\u30eb\u306e\u51fa\u529b\u3092\u78ba\u7387\u5206\u5e03\u306b\u5909\u63db\u3059\u308b\u5f79\u5272\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u6570\u5f0f\u3067\u8868\u3059\u3068<\/strong><br \/>\n\u5165\u529b\u30d9\u30af\u30c8\u30eb\u3092 $$ \\mathbf{z} = (z_1, z_2, &#8230;, z_n)$$ \u3068\u3057\u305f\u3068\u304d\u3001Softmax\u95a2\u6570\u306f\u6b21\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3055\u308c\u307e\u3059\uff1a<\/p>\n<p>$$<br \/>\n\\mathrm{Softmax}(z_i) = \\frac{e^{z_i}}{\\sum_{j=1}^n e^{z_j}}<br \/>\n$$<\/p>\n<p>\u3053\u306e\u5f0f\u306b\u3088\u3063\u3066\u3001\u5404\u51fa\u529b\u306f <strong>0\u304b\u30891\u306e\u7bc4\u56f2<\/strong> \u306b\u6b63\u898f\u5316\u3055\u308c\u3001\u3055\u3089\u306b <strong>\u5168\u3066\u306e\u51fa\u529b\u306e\u7dcf\u548c\u306f1<\/strong> \u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u300c\u78ba\u7387\u300d\u3068\u3057\u3066\u89e3\u91c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\u4e3b\u306a\u7528\u9014<\/strong><br \/>\n&#8211; <strong>\u5206\u985e\u554f\u984c<\/strong>\uff1a\u591a\u30af\u30e9\u30b9\u5206\u985e\u306e\u51fa\u529b\u5c64\u3067\u4f7f\u7528\u3055\u308c\u3001\u5404\u30af\u30e9\u30b9\u306b\u5c5e\u3059\u308b\u78ba\u7387\u3092\u7b97\u51fa\u3057\u307e\u3059\u3002<br \/>\n&#8211; <strong>\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af<\/strong>\uff1a\u51fa\u529b\u5c64\u3067\u6d3b\u6027\u5316\u95a2\u6570\u3068\u3057\u3066\u7528\u3044\u3089\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<br \/>\n&#8211; <strong>\u610f\u601d\u6c7a\u5b9a<\/strong>\uff1a\u5f37\u5316\u5b66\u7fd2\u306a\u3069\u3067\u3001\u884c\u52d5\u306e\u9078\u629e\u78ba\u7387\u3092\u6c7a\u3081\u308b\u306e\u306b\u5229\u7528\u3055\u308c\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u6ce8\u610f\u70b9<\/strong><br \/>\n&#8211; \u5165\u529b\u5024\u304c\u5927\u304d\u3059\u304e\u308b\u3068\u30aa\u30fc\u30d0\u30fc\u30d5\u30ed\u30fc\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001\u5b9f\u88c5\u6642\u306b\u306f\u6570\u5024\u5b89\u5b9a\u5316\u306e\u5de5\u592b\uff08\u4f8b\uff1a\u6700\u5927\u5024\u3092\u5f15\u3044\u3066\u8a08\u7b97\u3059\u308b\uff09\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>\n&#8211; \u51fa\u529b\u78ba\u7387\u304c\u300c\u4fe1\u983c\u5ea6\u300d\u3068\u5b8c\u5168\u306b\u4e00\u81f4\u3059\u308b\u3068\u306f\u9650\u3089\u306a\u3044\u305f\u3081\u3001\u904e\u4fe1\u3057\u306a\u3044\u3088\u3046\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<hr \/>\n<h3>\u56f3\u89e3\u30a4\u30e1\u30fc\u30b8\uff08Softmax\u306e\u52d5\u4f5c\uff09<\/h3>\n<p>\u4f8b\u3048\u30703\u30af\u30e9\u30b9\u5206\u985e\u3092\u8003\u3048\u3001\u30e2\u30c7\u30eb\u306e\u51fa\u529b\uff08\u30b9\u30b3\u30a2\uff09\u304c\u6b21\u306e\u3088\u3046\u3060\u3063\u305f\u3068\u3057\u307e\u3059\uff1a<\/p>\n<ul>\n<li>\u30af\u30e9\u30b9A\uff1a2.0<\/li>\n<li>\u30af\u30e9\u30b9B\uff1a1.0<\/li>\n<li>\u30af\u30e9\u30b9C\uff1a0.1<\/li>\n<\/ul>\n<p>Softmax\u3092\u9069\u7528\u3059\u308b\u3068\u3001\u305d\u308c\u305e\u308c\u3092\u6307\u6570\u95a2\u6570\u306b\u901a\u3057\u305f\u5f8c\u306b\u6b63\u898f\u5316\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u78ba\u7387\u306b\u5909\u63db\u3055\u308c\u307e\u3059\uff1a<\/p>\n<ul>\n<li>\u30af\u30e9\u30b9A\uff1a\u7d040.65<\/li>\n<li>\u30af\u30e9\u30b9B\uff1a\u7d040.24<\/li>\n<li>\u30af\u30e9\u30b9C\uff1a\u7d040.11<\/li>\n<\/ul>\n<p>\u3053\u308c\u306b\u3088\u308a\u300c\u30af\u30e9\u30b9A\u304c\u4e00\u756a\u53ef\u80fd\u6027\u304c\u9ad8\u3044\u300d\u3068\u89e3\u91c8\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\uff08\u3053\u3053\u306b\u68d2\u30b0\u30e9\u30d5\u98a8\u306e\u56f3\u3092\u5165\u308c\u308b\u3068\u3055\u3089\u306b\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\uff09<\/p>\n<hr \/>\n<h3>Python\u306b\u3088\u308b\u5b9f\u88c5\u4f8b<\/h3>\n<pre><code class=\"language-python\">import numpy as np\n\ndef softmax(x):\n    # \u6570\u5024\u5b89\u5b9a\u5316\u306e\u305f\u3081\u6700\u5927\u5024\u3092\u5f15\u304f\n    x = x - np.max(x)\n    exp_x = np.exp(x)\n    return exp_x \/ np.sum(exp_x)\n\n# \u30b5\u30f3\u30d7\u30eb\u5165\u529b\nscores = np.array([2.0, 1.0, 0.1])\nprobs = softmax(scores)\n\nprint(\"\u5165\u529b\u30b9\u30b3\u30a2:\", scores)\nprint(\"Softmax\u51fa\u529b:\", probs)\nprint(\"\u5408\u8a08:\", np.sum(probs))\n<\/code><\/pre>\n<p><strong>\u51fa\u529b\u4f8b\uff1a<\/strong><\/p>\n<pre><code>\u5165\u529b\u30b9\u30b3\u30a2: [2.  1.  0.1]\nSoftmax\u51fa\u529b: [0.65900114 0.24243297 0.09856589]\n\u5408\u8a08: 1.0\n<\/code><\/pre>\n<p>\u3053\u306e\u3088\u3046\u306bSoftmax\u3092\u4f7f\u3046\u3068\u3001\u51fa\u529b\u3092\u78ba\u7387\u5206\u5e03\u3068\u3057\u3066\u6271\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Softmax\u95a2\u6570\u3068\u306f\uff1f Softmax\u95a2\u6570\u306f\u3001\u6a5f\u68b0\u5b66\u7fd2\u3084\u6df1\u5c64\u5b66\u7fd2\u306e\u5206\u91ce\u3067\u3088\u304f\u5229\u7528\u3055\u308c\u308b\u95a2\u6570\u306e\u3072\u3068\u3064\u3067\u3059\u3002\u7279\u306b\u300c\u5206\u985e\u554f\u984c\u300d\u306b\u304a\u3044\u3066\u3001\u30e2\u30c7\u30eb\u306e\u51fa\u529b\u3092\u78ba\u7387\u5206\u5e03\u306b\u5909\u63db\u3059\u308b\u5f79\u5272\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002 \u6570\u5f0f\u3067\u8868\u3059\u3068 \u5165\u529b\u30d9\u30af\u30c8\u30eb\u3092 $$ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":3,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/92\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}