{"id":767,"date":"2021-12-11T13:42:50","date_gmt":"2021-12-11T04:42:50","guid":{"rendered":"https:\/\/aiacademy.jp\/media\/?p=767"},"modified":"2023-03-31T16:44:32","modified_gmt":"2023-03-31T07:44:32","slug":"%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e5%90%91%e3%81%91%e3%80%91%e3%83%9d%e3%82%a2%e3%82%bd%e3%83%b3%e5%9b%9e%e5%b8%b0%e3%81%a8%e3%81%af%ef%bc%9f-python%e3%81%a7%e5%ad%a6%e3%81%b6%e4%b8%80%e8%88%ac","status":"publish","type":"post","link":"https:\/\/aiacademy.jp\/media\/?p=767","title":{"rendered":"\u3010\u521d\u5fc3\u8005\u5411\u3051\u3011\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f\uff1f Python\u3067\u5b66\u3076\u4e00\u822c\u5316\u7dda\u5f62\u30e2\u30c7\u30eb\uff08GLM\uff09"},"content":{"rendered":"\n<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\">    <span><\/span>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-0\">\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f<\/a>      <\/li>      <li>        <a href=\"#i-1\">\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u3068\u306f<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">Python\u3067\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u5206\u6790\u3092\u884c\u3046<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-3\">\u7d71\u8a08\u5b66\u3084\u6a5f\u68b0\u5b66\u7fd2\u3092\u52b9\u7387\u7684\u306b\u5b66\u3076\u306b\u306f<\/a>  <\/li><\/ul>\n      \n    <\/div><\/div><div class=\"toc\"><p><\/p>\n<\/div><h2 class=\"wp-block-heading\" id=\"i-0\">\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f<\/h2>\n\n\n\n<p>\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f\u3001<strong>\u78ba\u7387\u5206\u5e03<\/strong>\u306b<strong>\u30dd\u30a2\u30bd\u30f3\u5206\u5e03<\/strong>\u304b\u3064<strong>\u30ea\u30f3\u30af\u95a2\u6570<\/strong>\u306b<strong>\u5bfe\u6570\u30ea\u30f3\u30af\u95a2\u6570<\/strong>\u3092\u7528\u3044\u305f\u4e00\u822c\u5316\u7dda\u5f62\u30e2\u30c7\u30eb\uff08GML\uff09\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3092\u7528\u3044\u308b\u3068\u3001\u4f8b\u3048\u3070\u98f2\u6599\u6c34\u306e\u8ca9\u58f2\u500b\u6570\u3092\u4e88\u6e2c\u3059\u308b\u306a\u3069\u306e\u30ab\u30a6\u30f3\u30c8\u30c7\u30fc\u30bf\u3092\u5206\u6790\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<p><meta charset=\"utf-8\">\u78ba\u7387\u5206\u5e03\u306b\u306f\u3001\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u4ee5\u5916\u306b\u3001\u6b63\u898f\u5206\u5e03\u3084\u4e8c\u9805\u5206\u5e03\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u304c\u3001<meta charset=\"utf-8\">\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3067\u306f<meta charset=\"utf-8\">\u78ba\u7387\u5206\u5e03\u306b\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u3092\u7528\u3044\u3066\u3044\u307e\u3059\u3002\u8aac\u660e\u5909\u6570\u306f\u8907\u6570\u5229\u7528\u53ef\u80fd\u3067\u3001\u30ab\u30c6\u30b4\u30ea\u578b\u3084\u9023\u7d9a\u578b\u304c\u542b\u307e\u308c\u3066\u3044\u3066\u3082\u554f\u984c\u306a\u304f\u5229\u7528\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-1\"><meta charset=\"utf-8\">\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u3068\u306f<\/h2>\n\n\n\n<p>\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\uff08Poisson distribution\uff09\u3068\u306f\u7a00\u306b\u3057\u304b\u8d77\u3053\u3089\u306a\u3044\u4e8b\u67c4\u306e\u5206\u5e03\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u306b\u306f\u3001\u5730\u9707\u306a\u3069\u306e\u767a\u751f\u4ef6\u6570\u3084\u3001\u4ea4\u901a\u4e8b\u6545\u306e\u767a\u751f\u4ef6\u6570\u3001\u5de5\u5834\u306a\u3069\u3067\u767a\u751f\u3059\u308b\u4e0d\u826f\u54c1\u306e\u6570\u306a\u3069\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306f\u3001\u5e73\u5747\u56de\u6570\uff08mu\uff09\u306e\u6642\u306e\u30010~60\u307e\u3067\u306e\u78ba\u7387\u5bc6\u5ea6\u3092\u8a08\u7b97\u3057\u53ef\u8996\u5316\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from scipy.stats import poisson\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\nmu = 20\nk = np.arange(60)\npmf_pois = poisson.pmf(k, mu)\nplt.bar(k, pmf_pois)\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"378\" height=\"248\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/download.png\" alt=\"\" class=\"wp-image-783\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/download.png 378w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/download-300x197.png 300w\" sizes=\"auto, (max-width: 378px) 100vw, 378px\"><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-2\">Python\u3067\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u5206\u6790\u3092\u884c\u3046<\/h2>\n\n\n\n<p>Python\u3067\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3092\u6271\u3046\u306b\u306f\u5927\u304d\u304f\uff12\u7a2e\u985e\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\uff11\u3064\u306f\u300cstatsmodels\u300d\u3092\u7528\u3044\u308b\u65b9\u6cd5\u3002\u3082\u3046\u4e00\u3064\u306f\u3001\u300cscikit-learn\u300d\u3092\u7528\u3044\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n\n\n\n<p>statsmodels\u306e\u300c<a href=\"https:\/\/www.statsmodels.org\/stable\/generated\/statsmodels.genmod.generalized_linear_model.GLM.html\" rel=\"nofollow noopener\" target=\"_blank\">Generalized Linear Models<\/a>\u300d\u3092\u7528\u3044\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import statsmodels.formula.api as smf\nimport statsmodels.api as sm\n\nmodel = smf.glm(\"\u76ee\u7684\u5909\u6570 ~ \u8aac\u660e\u5909\u6570\", df, family=sm.families.Poisson()).fit()\nmodel.summary()<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u6b21\u306bscikit-learn\u3092\u7528\u3044\u305f\u5834\u5408\u3001\u300c<a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.linear_model.PoissonRegressor.html\" rel=\"nofollow noopener\" target=\"_blank\">from&nbsp;sklearn.linear_model&nbsp;import&nbsp;PoissonRegressor<\/a>\u300d\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u3001\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3092\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.linear_model import PoissonRegressor\nmodel = PoissonRegressor()<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"i-3\">\u7d71\u8a08\u5b66\u3084\u6a5f\u68b0\u5b66\u7fd2\u3092\u52b9\u7387\u7684\u306b\u5b66\u3076\u306b\u306f<\/h1>\n\n\n\n<p>\u7d71\u8a08\u5b66\u3084\u6a5f\u68b0\u5b66\u7fd2\u3092\u72ec\u5b66\u3067\u5b66\u3076\u306e\u306f\u5927\u5909\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u307e\u305a\u306f\u30aa\u30f3\u30e9\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5229\u7528\u3059\u308b\u306e\u304c\u826f\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>AI Academy Bootcamp\u3067\u306f6\u30f6\u6708\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30c6\u30a3\u30b9\u30c8\u3084\u6a5f\u68b0\u5b66\u7fd2\u30a8\u30f3\u30b8\u30cb\u30a2\u306b\u8cea\u554f\u3057\u653e\u984c\u304b\u3064\u3001\u4f53\u7cfb\u7684\u306b\u5b66\u3079\u308b\u52d5\u753b\u30b3\u30f3\u30c6\u30f3\u30c4\u3084440\u7a2e\u985e\u4ee5\u4e0a\u306e\u30c6\u30ad\u30b9\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u3067\u5b66\u3079\u306635,000\uff08\u7a0e\u8fbc\uff09\u3067\u53d7\u8b1b\u51fa\u6765\u307e\u3059\u3002<\/p>\n\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_ad_72ppi-1024x341.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png 1024w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-300x100.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-768x256.png 768w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-940x313.png 940w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\"><\/a><\/figure>\n\n\n\n<p>\u662f\u975e\u30b5\u30fc\u30d3\u30b9\u3092\u6d3b\u7528\u3057\u3001\u52b9\u7387\u3088\u304f\u3001\u7d71\u8a08\u5b66\u3084\u6a5f\u68b0\u5b66\u7fd2\u3092\u8eab\u306b\u3064\u3051\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21 \u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f \u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u3068\u306f Python\u3067\u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u5206\u6790\u3092\u884c\u3046 \u7d71\u8a08\u5b66\u3084\u6a5f\u68b0\u5b66\u7fd2\u3092\u52b9\u7387\u7684\u306b\u5b66\u3076\u306b\u306f \u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f \u30dd\u30a2\u30bd\u30f3\u56de\u5e30\u3068\u306f\u3001\u78ba\u7387\u5206\u5e03\u306b\u30dd\u30a2\u30bd\u30f3\u5206\u5e03\u304b\u3064\u30ea\u30f3\u30af\u95a2\u6570\u306b\u5bfe\u6570\u30ea\u30f3\u30af\u95a2\u6570\u3092\u7528\u3044\u305f\u4e00\u822c\u5316\u7dda &#8230; <\/p>\n","protected":false},"author":1,"featured_media":778,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105,131],"tags":[],"class_list":{"0":"post-767","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-105","8":"category-131"},"_links":{"self":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/767","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=767"}],"version-history":[{"count":13,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/767\/revisions"}],"predecessor-version":[{"id":3859,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/767\/revisions\/3859"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/778"}],"wp:attachment":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}