{"id":86,"date":"2014-07-01T23:39:42","date_gmt":"2014-07-01T14:39:42","guid":{"rendered":"https:\/\/www.dogrow.net\/python\/?p=86"},"modified":"2019-10-19T06:42:38","modified_gmt":"2019-10-18T21:42:38","slug":"blog25","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/python\/blog25\/","title":{"rendered":"(25) numpy\u3067\u4e71\u6570\u3092\u751f\u6210"},"content":{"rendered":"<p><span class=\"my_fc_deeppinkB\">numpy.random.rand<\/span> \u3092\u4f7f\u7528\u3057\u3066<span class=\"my_fc_blueB\">\u5b9f\u6570<\/span>\u306e\u4e71\u6570\u914d\u5217\u3092\u751f\u6210\u3059\u308b\u3002<br \/>\n<span class=\"my_fc_deeppinkB\">numpy.random.randint<\/span> \u3092\u4f7f\u7528\u3057\u3066<span class=\"my_fc_blueB\">\u6574\u6570<\/span>\u306e\u4e71\u6570\u914d\u5217\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; import numpy as np\r\n&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.rand(10)<\/span>\r\narray([ 0.36231987,  0.26958951,  0.91354098,  0.66874027,  0.704188  ,\r\n        0.3669771 ,  0.9351947 ,  0.97054988,  0.05415556,  0.0120051 ])\r\n<\/pre>\n<p>2\u6b21\u5143\u914d\u5217\u3082\u4f5c\u308c\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.rand(10,5)<\/span>\r\narray([[ 0.18057302,  0.732112  ,  0.73570813,  0.31276078,  0.74386724],\r\n       [ 0.34098013,  0.57740663,  0.38940087,  0.75841537,  0.48696981],\r\n       [ 0.55155841,  0.07432334,  0.64554935,  0.75573921,  0.72851735],\r\n       [ 0.67891244,  0.50691657,  0.67023707,  0.68459258,  0.59727912],\r\n       [ 0.52673635,  0.38148081,  0.38091377,  0.77393508,  0.23767506],\r\n       [ 0.9007612 ,  0.459175  ,  0.61066911,  0.74963848,  0.41388143],\r\n       [ 0.8425936 ,  0.65534958,  0.04201763,  0.2361347 ,  0.90097734],\r\n       [ 0.5658974 ,  0.65926714,  0.8321856 ,  0.86968125,  0.99100652],\r\n       [ 0.27978176,  0.09986267,  0.32118296,  0.13473018,  0.34219306],\r\n       [ 0.21003417,  0.57915006,  0.20604767,  0.78571055,  0.08694739]])\r\n<\/pre>\n<p>3\u6b21\u5143\u914d\u5217\u3082\u4f5c\u308c\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.rand(4,3,2)<\/span>\r\narray([[[ 0.78210148,  0.52274031],\r\n        [ 0.91981503,  0.76674411],\r\n        [ 0.61590378,  0.68904415]],\r\n\r\n       [[ 0.35814928,  0.95472689],\r\n        [ 0.9389849 ,  0.75284964],\r\n        [ 0.43892884,  0.68375844]],\r\n\r\n       [[ 0.33013363,  0.93588433],\r\n        [ 0.81682107,  0.26105761],\r\n        [ 0.45356643,  0.14149969]],\r\n\r\n       [[ 0.67429765,  0.15207684],\r\n        [ 0.31640331,  0.7342912 ],\r\n        [ 0.90368026,  0.04494939]]])\r\n<\/pre>\n<p>0\uff5e10\u306e\u7bc4\u56f2\u306e<span class=\"my_fc_blueB\">\u6574\u6570<\/span>\u4e71\u65701\u500b\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.randint(10)<\/span>\r\n1\r\n&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.randint(0,10)<\/span>\r\n7\r\n<\/pre>\n<p>3\uff5e10\u306e\u7bc4\u56f2\u306e<span class=\"my_fc_blueB\">\u6574\u6570<\/span>\u4e71\u65701\u500b\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.randint(3,10)<\/span>\r\n6\r\n<\/pre>\n<p>3\uff5e10\u306e\u7bc4\u56f2\u304b\u3064\u8981\u7d20\u65704\u306e<span class=\"my_fc_blueB\">\u6574\u6570<\/span>\u4e71\u6570\u914d\u5217\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.randint(3,10,4)<\/span>\r\narray([9, 5, 8, 9])\r\n<\/pre>\n<p>3\uff5e10\u306e\u7bc4\u56f2\u304b\u3064\u8981\u7d20\u65704&#215;3\u306e<span class=\"my_fc_blueB\">\u6574\u6570<\/span>\u4e71\u6570\u914d\u5217\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<pre>&gt;&gt;&gt; np.<span class=\"my_fc_deeppinkB\">random.randint(3,10,(4,3))<\/span>\r\narray([[7, 6, 3],\r\n       [4, 5, 3],\r\n       [3, 8, 3],\r\n       [8, 7, 9]])\r\n<\/pre>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>numpy.random.rand \u3092\u4f7f\u7528\u3057\u3066\u5b9f\u6570\u306e\u4e71\u6570\u914d\u5217\u3092\u751f\u6210\u3059\u308b\u3002 numpy.random.randint \u3092\u4f7f\u7528\u3057\u3066\u6574\u6570\u306e\u4e71\u6570\u914d\u5217\u3092\u751f\u6210\u3059\u308b\u3002 &gt;&gt;&gt; import numpy as np &#038;\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/python\/blog25\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,13],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-numpy","category-13"],"views":3843,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":13,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":2614,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/86\/revisions\/2614"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}