0
1

More than 3 years have passed since last update.

EDA-確率質量関数(PMF: Probability Mass Function)

Posted at

確率質量関数(PMF: Probability Mass Function)とは

離散型確率変数:離散型変数Xの取りうる値(x1,x2,...xn)のそれぞれに対応する確率pが存在する場合、Pを離散型確率変数といいます。

X x1 x2 ... xn
P(X) p1 p2 ... pn

確率質量関数は、離散型確率変数にその値をとる確率を対応させる関数です。
離散型確率変数Xがある値xをとる確率を関数f(x)とした場合、f(x)が確率質量関数です。

f(x) = P(X=x)

全事象が起こる確率は1です。

\sum_{i=1}^{n}P(X=x_i) = P(X=x_1) + P(X=x_2) + ... + P(X=x_n) = 1 

PMFプロット

import seaborn as sns

probabilities = df['col'].value_counts(normalize=True)    
sns.barplot(probabilities.index, probabilities.values)

plt.xlabel('Col')
plt.ylabel('PMF')
plt.show()

image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1