{"id":535,"date":"2018-06-01T00:16:12","date_gmt":"2018-05-31T15:16:12","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2018\/06\/01\/python_1_1\/"},"modified":"2018-06-01T00:16:12","modified_gmt":"2018-05-31T15:16:12","slug":"python_1_1","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2018\/06\/01\/python_1_1\/","title":{"rendered":"Python \u6570\u5b66\u3001\u7d71\u8a08\u3001\u6a5f\u68b0\u5b66\u7fd2\uff1a\u6563\u5e03\u56f3\u3068\u76f8\u95a2\u5206\u6790(1)"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.co.jp\/Python%E3%81%AB%E3%82%88%E3%82%8B%E7%B5%B1%E8%A8%88%E5%88%86%E6%9E%90%E5%85%A5%E9%96%80-%E5%B1%B1%E5%86%85-%E9%95%B7%E6%89%BF\/dp\/4274222349\/ref=as_li_ss_il?ie=UTF8&amp;qid=1527608967&amp;sr=8-3&amp;keywords=python+%E7%B5%B1%E8%A8%88&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=4d3b50c2607cf0268aa34de7ec578cd4\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4274222349&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=4274222349\" border=\"0\"><\/p>\n<h2>1.\u76f8\u95a2\u5206\u6790<\/h2>\n<p><a href=\"http:\/\/www.koka.ac.jp\/morigiwa\/sjs\/les10801.htm\">\u76f8\u95a2\u5206\u6790<\/a>\u3068\u306f\u3001\u4e8c\u7a2e\u985e\u306e\u30c7\u30fc\u30bf\u306e\u95a2\u4fc2\u306e\u5f37\u3055\u3092\u76f8\u95a2\u4fc2\u6570\u3067\u8868\u73fe\u3059\u308b\u5206\u6790\u624b\u6cd5<\/p>\n<p>\u5206\u6790\u306e\u624b\u9806\u306f<\/p>\n<ol>\n<li>\u6563\u5e03\u56f3\u3092\u63cf\u304f<\/li>\n<li>\u6563\u5e03\u56f3\u3092\u307f\u3066\u95a2\u9023\u6027\u3092\u63a8\u6e2c<\/li>\n<\/ol>\n<p>\u76f8\u95a2\u4fc2\u6570\u3068\u306f\u3001<\/p>\n<ol>\n<li>2\u5909\u6570\u9593\u306e\u95a2\u9023\u6027\u306e\u5f37\u3055\u3092\u56f3\u308b<\/li>\n<li>\u4e00\u822c\u7684\u306b\u5c0f\u6587\u5b57\u306er (correlation) \u3067\u3042\u3089\u308f\u3059<\/li>\n<li>\u5e38\u306b -1 ~ 1 \u306e\u9593\u306e\u5024\u3092\u3068\u308b<\/li>\n<li>\u6b63\u306e\u5024\u306e\u5834\u5408\u3001\u6b63\u306e\u76f8\u95a2\u3001\u8ca0\u306e\u5024\u306e\u5834\u5408\u3001\u8ca0\u306e\u76f8\u95a2\u304c\u3042\u308b<\/li>\n<\/ol>\n<p>\u76f8\u95a2\u4fc2\u6570\u306e\u5f37\u5f31<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\">\u76f8\u95a2\u4fc2\u6570<\/td>\n<td valign=\"top\">\u76f8\u95a2\u306e\u5f37\u3055<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">~ 0.3\u672a\u6e80<\/td>\n<td valign=\"top\">\u307b\u307c\u7121\u76f8\u95a2<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">0.3 ~ 0.5\u672a\u6e80<\/td>\n<td valign=\"top\">\u975e\u5e38\u306b\u5f31\u3044\u76f8\u95a2<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">0.5 ~ 0.7\u672a\u6e80<\/td>\n<td valign=\"top\">\u76f8\u95a2\u304c\u3042\u308b<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">0.7 ~ 0.9\u672a\u6e80<\/td>\n<td valign=\"top\">\u5f37\u3044\u76f8\u95a2<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">0.9\u4ee5\u4e0a<\/td>\n<td valign=\"top\">\u975e\u5e38\u306b\u5f37\u3044\u76f8\u95a2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2.\u6563\u5e03\u56f3\u3092\u63cf\u304f<\/h2>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2018\/05\/18\/python_5\">\u57fa\u672c\u7d71\u8a08\u91cf\u3001\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3067\u4f7f\u7528\u3057\u305f\u30dc\u30b9\u30c8\u30f3\u306e\u4f4f\u5b85\u4fa1\u683c\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8<\/a>\u306e\u5404\u8aac\u660e\u5909\u6570(x) \u3068 \u4f4f\u5b85\u4fa1\u683c\u306e\u4e2d\u592e\u5024(y) \u306e\u6563\u5e03\u56f3\u3092\u63cf\u304f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u304b\u3089\u5f15\u7528<\/p>\n<p><a title=\"https:\/\/pythondatascience.plavox.info\/matplotlib\/%E6%95%A3%E5%B8%83%E5%9B%B3\" href=\"https:\/\/pythondatascience.plavox.info\/matplotlib\/%E6%95%A3%E5%B8%83%E5%9B%B3\">https:\/\/pythondatascience.plavox.info\/matplotlib\/%E6%95%A3%E5%B8%83%E5%9B%B3<\/a><\/p>\n<pre class=\"prettyprint linenums\">matplotlib.pyplot.scatter(x, y, s=20, c=None, marker='o', cmap=None, norm=None,\r\n                          vmin=None, vmax=None, alpha=None, linewidths=None,\r\n                          verts=None, edgecolors=None, hold=None, data=None,\r\n                          **kwargs)<\/pre>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\">\u30d1\u30e9\u30e1\u30fc\u30bf<\/td>\n<td valign=\"top\">\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">x.y<\/td>\n<td valign=\"top\">\u30b0\u30e9\u30d5\u306b\u51fa\u529b\u3059\u308b\u30c7\u30fc\u30bf<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">s<\/td>\n<td valign=\"top\">\u30b5\u30a4\u30ba (\u30c7\u30d5\u30a9\u30eb\u30c8\u5024: 20)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">c<\/td>\n<td valign=\"top\">\u8272\u3001\u307e\u305f\u306f\u3001\u9023\u7d9a\u3057\u305f\u8272\u306e\u5024<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">marker<\/td>\n<td valign=\"top\">\u30de\u30fc\u30ab\u30fc\u306e\u5f62 (\u30c7\u30d5\u30a9\u30eb\u30c8\u5024: \u2018o\u2019= \u5186)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">cmap<\/td>\n<td valign=\"top\">\u30ab\u30e9\u30fc\u30de\u30c3\u30d7\u3002c \u304c float \u578b\u306e\u5834\u5408\u306e\u307f\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">norm<\/td>\n<td valign=\"top\">c \u3092 float \u578b\u306e\u914d\u5217\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306e\u307f\u6709\u52b9\u3002\u6b63\u898f\u5316\u3092\u884c\u3046\u5834\u5408\u306e Normalize \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6307\u5b9a\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">vmin,vmax<\/td>\n<td valign=\"top\">\u6b63\u898f\u5316\u6642\u306e\u6700\u5927\u3001\u6700\u5c0f\u5024\u3002 \u6307\u5b9a\u3057\u306a\u3044\u5834\u5408\u3001\u30c7\u30fc\u30bf\u306e\u6700\u5927\u30fb\u6700\u5c0f\u5024\u3068\u306a\u308a\u307e\u3059\u3002norm \u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001vmin, vmax \u306e\u6307\u5b9a\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">alpha<\/td>\n<td valign=\"top\">\u900f\u660e\u5ea6\u30020(\u900f\u660e)\uff5e1(\u4e0d\u900f\u660e)\u306e\u9593\u306e\u6570\u5024\u3092\u6307\u5b9a\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">linewidths<\/td>\n<td valign=\"top\">\u7dda\u306e\u592a\u3055\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">edgecolors<\/td>\n<td valign=\"top\">\u7dda\u306e\u8272\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><pre class=\"prettyprint linenums\">from sklearn import datasets\r\nimport pandas as pd\r\nimport matplotlib.pyplot as plt\r\nimport math\r\n\r\ndef correl_sccater(*feature_index):\r\n    \"\"\"\r\n    https:\/\/pythondatascience.plavox.info\/matplotlib\/%E6%95%A3%E5%B8%83%E5%9B%B3\r\n    :return:\r\n    \"\"\"\r\n    boston = datasets.load_boston()\r\n\r\n    df_ex = pd.DataFrame(boston.data)\r\n    df_ex.columns = boston.feature_names\r\n    import pprint\r\n    print(pprint.pprint(df_ex))\r\n\r\n    df_res = pd.DataFrame(boston.target)\r\n    df_res.columns = ['Price']\r\n\r\n    y = df_res['Price']\r\n    fig = plt.figure()\r\n\r\n    cnt = len(feature_index)\r\n    cols = 1 if cnt == 1 else (2 if cnt &lt; 6 else 4)\r\n    rows = math.ceil(cnt \/ cols)\r\n    idx = 1\r\n    for feature in feature_index:\r\n\r\n        x = df_ex[feature]\r\n        ax = fig.add_subplot(rows, cols, idx)\r\n\r\n        ax.set_title(feature, fontdict={'fontsize': 10}, pad=2)\r\n        ax.scatter(x, y, s=0.5)\r\n        idx = idx + 1\r\n\r\n    plt.tight_layout()\r\n    plt.show()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    correl_sccater('CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT')\r\n    #correl_sccater('RM')<\/pre>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Python-_14A63\/scatter.png\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"392\" title=\"scatter\" style=\"display: inline; background-image: none;\" alt=\"scatter\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Python-_14A63\/scatter_thumb.png\" border=\"0\"><\/a><\/p>\n<p><a href=\"https:\/\/www.amazon.co.jp\/Python%E3%83%87%E3%83%BC%E3%82%BF%E3%82%B5%E3%82%A4%E3%82%A8%E3%83%B3%E3%82%B9-%E6%9D%9C%E4%B8%96%E6%A9%8B-ebook\/dp\/B01N9FNAQ0\/ref=as_li_ss_il?ie=UTF8&amp;qid=1527608967&amp;sr=8-8&amp;keywords=python+%E7%B5%B1%E8%A8%88&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=98383a2df5bba251680e61f4842396a0\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B01N9FNAQ0&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=B01N9FNAQ0\" border=\"0\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u76f8\u95a2\u5206\u6790 \u76f8\u95a2\u5206\u6790\u3068\u306f\u3001\u4e8c\u7a2e\u985e\u306e\u30c7\u30fc\u30bf\u306e\u95a2\u4fc2\u306e\u5f37\u3055\u3092\u76f8\u95a2\u4fc2\u6570\u3067\u8868\u73fe\u3059\u308b\u5206\u6790\u624b\u6cd5 \u5206\u6790\u306e\u624b\u9806\u306f \u6563\u5e03\u56f3\u3092\u63cf\u304f \u6563\u5e03\u56f3\u3092\u307f\u3066\u95a2\u9023\u6027\u3092\u63a8\u6e2c \u76f8\u95a2\u4fc2\u6570\u3068\u306f\u3001 2\u5909\u6570\u9593\u306e\u95a2\u9023\u6027\u306e\u5f37\u3055\u3092\u56f3\u308b \u4e00\u822c\u7684\u306b\u5c0f\u6587\u5b57\u306er (correla [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[35,86],"tags":[],"class_list":["post-535","post","type-post","status-publish","format-standard","hentry","category-math","category-statistics"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=535"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/535\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}