numpy.random.randn を使ってみる
Python
Published: 2019-09-09

やったこと

numpy.random.randn を使ってみます。

確認環境

$ python
Python 3.6.2 |Anaconda custom (64-bit)| (default, Sep 21 2017, 18:29:43)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.16.4'

調査

numpy.random.randn は、標準正規分布を返すとあります。

Return a sample (or samples) from the “standard normal” distribution

標準正規分布とは、平均0、標準偏差1の正規分布のことです。

>>> np.random.rand(2,3)
array([[0.60826951, 0.10515517, 0.69150681],
       [0.40838286, 0.34473871, 0.09018369]])
>>> np.random.rand(2,3)
array([[0.31227934, 0.93830731, 0.42201233],
       [0.54689324, 0.99169398, 0.89075624]])
>>> np.random.rand(2,3)
array([[0.01817165, 0.78406566, 0.6051451 ],
       [0.43414395, 0.94710879, 0.75136773]])
>>> np.random.rand(2,3)
array([[0.22214423, 0.68967167, 0.25798399],
       [0.17294866, 0.62487288, 0.46928062]])

参考