{"id":261,"date":"2020-01-24T15:42:50","date_gmt":"2020-01-24T06:42:50","guid":{"rendered":"http:\/\/aiacademy.jp\/media\/?p=261"},"modified":"2021-12-09T11:15:03","modified_gmt":"2021-12-09T02:15:03","slug":"%e6%a9%9f%e6%a2%b0%e5%ad%a6%e7%bf%92%e3%81%ae%e5%9b%9e%e5%b8%b0%e3%81%ab%e9%96%a2%e3%81%99%e3%82%8b%e8%a9%95%e4%be%a1%e6%8c%87%e6%a8%99%e3%82%92%e5%ad%a6%e3%81%bc%e3%81%86%ef%bc%81","status":"publish","type":"post","link":"https:\/\/aiacademy.jp\/media\/?p=261","title":{"rendered":"\u6a5f\u68b0\u5b66\u7fd2\u306e\u56de\u5e30\u306b\u304a\u3051\u308b\u8a55\u4fa1\u6307\u6a19\u306b\u95a2\u3057\u3066\u5b66\u307c\u3046\uff01"},"content":{"rendered":"<div class=\"toc\">    <div id=\"toc_container\" class=\"sgb-toc--no-bullets js-smooth-scroll\" data-dialog-title=\"Table of Contents\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">\u56de\u5e30\u3067\u306e\u8a55\u4fa1\u65b9\u6cd5<\/a>  <\/li>  <li>    <a href=\"#i-1\">\u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee (MSE)<\/a>  <\/li>  <li>    <a href=\"#i-2\">\u4e8c\u4e57\u5e73\u5747\u5e73\u65b9\u6839\u8aa4\u5dee(RMSE)<\/a>  <\/li>  <li>    <a href=\"#i-3\">\u6c7a\u5b9a\u4fc2\u6570<\/a>  <\/li>  <li class=\"last\">    <a href=\"#i-4\">\u307e\u3068\u3081<\/a>  <\/li><\/ul>\n      \n    <\/div><\/div><div class=\"toc\"><p><\/p>\n<\/div><h2 id=\"i-0\">\u56de\u5e30\u3067\u306e\u8a55\u4fa1\u65b9\u6cd5<\/h2>\n<p>\u8a55\u4fa1\u6307\u6a19\u306f\u3001\u5206\u985e\u3060\u3051\u3067\u306a\u304f\u56de\u5e30\u306b\u3082\u9069\u7528\u3067\u304d\u307e\u3059\u3002<br>\u56de\u5e30\u3067\u4f7f\u308f\u308c\u308b\u8a55\u4fa1\u6307\u6a19\u3067\u30e1\u30b8\u30e3\u30fc\u306a\u3082\u306e\u306f\u4ee5\u4e0b\u306e3\u3064\u306b\u306a\u308a\u307e\u3059\u3002<br><strong>\u30fb\u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee (MSE)<\/strong><br><strong>\u30fb\u4e8c\u4e57\u5e73\u5747\u5e73\u65b9\u6839\u8aa4\u5dee(RMSE)<\/strong><br><strong>\u30fb\u6c7a\u5b9a\u4fc2\u6570 (R2)<\/strong><br>\u4e00\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"i-1\">\u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee (MSE)<\/h2>\n<p><strong>\u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee (MSE)\u3068\u306f\u3001\u5b9f\u969b\u306e\u5024\u3068\u4e88\u6e2c\u5024\u306e\u7d76\u5bfe\u5024\u306e 2 \u4e57\u3092\u5e73\u5747\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/strong><br>\u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee (MSE)\u3067\u306f\u3001\u5024\u304c\u5c0f\u3055\u3044\u307b\u3069\u8aa4\u5dee\u306e\u5c11\u306a\u3044\u30e2\u30c7\u30eb\u3068\u8a00\u3048\u307e\u3059\u3002<br>\u3061\u306a\u307f\u306bMSE\u306f\u201dMean Squared Error\u201d\u306e\u7565\u3067\u3059\u3002<br><code class=\"python:\">from sklearn.metrics import mean_squared_error\nfrom math import sqrt\n\n# \u203b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u305d\u306e\u307e\u307e\u3067\u306f\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3002\n# \u5b9f\u969b\u306e\u5024\u3068\u4e88\u6e2c\u3057\u305f\u5024\u306b\u306f\u4f55\u3089\u304b\u306e\u6570\u5024\u306e\u30ea\u30b9\u30c8\u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\u3002\nmse = mean_squared_error(\u5b9f\u969b\u306e\u5024, \u4e88\u6e2c\u3057\u305f\u5024)\n<\/code><\/p>\n<h2 id=\"i-2\">\u4e8c\u4e57\u5e73\u5747\u5e73\u65b9\u6839\u8aa4\u5dee(RMSE)<\/h2>\n<p><strong>\u4e8c\u4e57\u5e73\u5747\u5e73\u65b9\u6839\u8aa4\u5dee(RMSE) \u3068\u306f\u3001\u4e0a\u8a18\u306eMSE\u306b\u5e73\u65b9\u6839\u3092\u3068\u308b\u3053\u3068\u3067\u8a08\u7b97\u3055\u308c\u308b\u3082\u306e\u3067\u3059\u3002<\/strong><br>\u203b\u5e73\u5747\u5e73\u65b9\u6839\u4e8c\u4e57\u8aa4\u5dee\u3068\u547c\u3093\u3060\u308a\u3082\u3057\u307e\u3059\u3002<br><strong><em>\u4e8c\u4e57\u3057\u305f\u3053\u3068\u306e\u5f71\u97ff\u3092\u3001\u5e73\u65b9\u6839\u3067\u88dc\u6b63\u3057\u3066\u3044\u307e\u3059\u3002<\/em><\/strong><br>\u3061\u306a\u307f\u306bRMSE\u306f\u201dRoot Mean Squared Error\u201d\u306e\u7565\u3067\u3059\u3002<br><strong>\u3053\u306e\u5024\u304c\u5c0f\u3055\u3051\u308c\u3070\u5c0f\u3055\u3044\u307b\u3069\u3001\u8aa4\u5dee\u306e\u5c0f\u3055\u3044\u30e2\u30c7\u30eb\u3067\u3042\u308b\u3068\u8a00\u3048\u307e\u3059\u3002<\/strong><\/p>\n<pre><code class=\"python:\">from sklearn.metrics import mean_squared_error\nfrom math import sqrt\n\n# \u203b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u305d\u306e\u307e\u307e\u3067\u306f\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3002\n# \u5b9f\u969b\u306e\u5024\u3068\u4e88\u6e2c\u3057\u305f\u5024\u306b\u306f\u4f55\u3089\u304b\u306e\u6570\u5024\u306e\u30ea\u30b9\u30c8\u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\u3002\nrmse = sqrt(mean_squared_error(\u5b9f\u969b\u306e\u5024, \u4e88\u6e2c\u3057\u305f\u5024))\n<\/code><\/pre>\n<h2 id=\"i-3\">\u6c7a\u5b9a\u4fc2\u6570<\/h2>\n<p><strong>\u6c7a\u5b9a\u4fc2\u6570(R2)\u3068\u306f\u3001\u63a8\u5b9a\u3055\u308c\u305f\u56de\u5e30\u5f0f\u306e\u5f53\u3066\u306f\u307e\u308a\u306e\u826f\u3055\uff08\u5ea6\u5408\u3044\uff09\u3092\u8868\u3057\u307e\u3059\u3002<\/strong><br>0\u304b\u30891\u307e\u3067\u306e\u5024\u3092\u53d6\u308a\u30011\u306b\u8fd1\u3044\u307b\u3069\u3001\u56de\u5e30\u5f0f\u304c\u5b9f\u969b\u306e\u30c7\u30fc\u30bf\u306b\u5f53\u3066\u306f\u307e\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u8868\u3057\u3066\u304a\u308a\u3001\u8aac\u660e\u5909\u6570\u304c\u76ee\u7684\u5909\u6570\u3092\u8aac\u660e\u3057\u3066\u3044\u308b\u3068\u8a00\u3048\u307e\u3059\u3002<br>\u9006\u306b0\u306b\u8fd1\u3051\u308c\u3070\u3042\u307e\u308a\u826f\u304f\u306a\u3044\u6027\u80fd\u3067\u3042\u308b\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"python:\">from sklearn.linear_model import LinearRegression\nfrom sklearn.metrics import r2_score\nmodel = LinearRegression\nmodel.fit(X, y)\nresult = model.score(X, y)\n<\/code><\/pre>\n<h2 id=\"i-4\">\u307e\u3068\u3081<\/h2>\n<p>\u3053\u306e\u30c6\u30ad\u30b9\u30c8\u3067\u306f\u3001\u56de\u5e30\u306e\u8a55\u4fa1\u65b9\u6cd5\u306b\u95a2\u3057\u3066\u5b66\u3073\u307e\u3057\u305f\u3002<br>\u3069\u308c\u3082\u3088\u304f\u5229\u7528\u3057\u307e\u3059\u306e\u3067\u3057\u3063\u304b\u308a\u3068\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u6570\u5f0f\u3068\u5408\u308f\u305b\u3066\u5b66\u3073\u305f\u3044\u65b9\u306f<a href=\"https:\/\/aiacademy.jp\/texts\/show\/?id=298&amp;context=subject-metrics\">\u8a55\u4fa1\u6307\u6a19(\u56de\u5e30)<\/a>\u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/aiacademy.jp\/bootcamp\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_banner2-1024x341.png\" alt=\"\" class=\"wp-image-587\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_banner2-1024x341.png 1024w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_banner2-300x100.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_banner2-768x256.png 768w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_banner2-940x313.png 940w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_banner2.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\"><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21 \u56de\u5e30\u3067\u306e\u8a55\u4fa1\u65b9\u6cd5 \u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee (MSE) \u4e8c\u4e57\u5e73\u5747\u5e73\u65b9\u6839\u8aa4\u5dee(RMSE) \u6c7a\u5b9a\u4fc2\u6570 \u307e\u3068\u3081 \u56de\u5e30\u3067\u306e\u8a55\u4fa1\u65b9\u6cd5 \u8a55\u4fa1\u6307\u6a19\u306f\u3001\u5206\u985e\u3060\u3051\u3067\u306a\u304f\u56de\u5e30\u306b\u3082\u9069\u7528\u3067\u304d\u307e\u3059\u3002\u56de\u5e30\u3067\u4f7f\u308f\u308c\u308b\u8a55\u4fa1\u6307\u6a19\u3067\u30e1\u30b8\u30e3\u30fc\u306a\u3082\u306e\u306f\u4ee5\u4e0b\u306e3\u3064\u306b\u306a &#8230; <\/p>\n","protected":false},"author":1,"featured_media":484,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85],"tags":[],"class_list":{"0":"post-261","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"_links":{"self":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=261"}],"version-history":[{"count":4,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":659,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/261\/revisions\/659"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/484"}],"wp:attachment":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}