Drkcore

15 08 2009 Python matplotlib PRML Tweet

Box-MullerをPythonで

PRML11章。一様乱数から正規乱数を発生させる。

from math import sin,cos,pi,log,sqrt
from random import random

def box_muller():
    z1 = random()
    z2 = random()
    return sqrt(-2*log(z2)) * sin(2*pi*z1)

if __name__ == "__main__":
    from pylab import *
    x = [box_muller() for i in range(10000)]
    hist(x,20)
    savefig("box_muller.png")

box_muller

ProductName パターン認識と機械学習 下 - ベイズ理論による統計的予測
C. M. ビショップ
シュプリンガー・ジャパン株式会社 / ¥ 8,190 ()
在庫あり。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021