LoginSignup
0
0

More than 1 year has passed since last update.

EDA-累積分布関数(CDF: Cumulative Distribution Function)

Posted at

累積分布関数(CDF: Cumulative Distribution Function)とは

確率変数Xがある値x以下(X <= x)の値となる確率です。
例えばサイコロを投げたときに「出る目が4以下となる確率」や「出る目が4から6の目が出る確率」といった、ある範囲の確率を求めるときに使用します。

確率質量関数(PMF: Probability Mass Function)との区別:

  • PMFはある値xを得る確率
  • CDFはある値x以下の値を得る確率

CDFプロット

import numpy as np
import seaborn as sns

pmf = df['col'].value_counts(normalize=True).sort_index()
cdf = np.cumsum(pmf)

fig, ax = plt.subplots()

ax.plot(pmf.index, pmf.values, label='PMF')
ax.plot(cdf.index, cdf.values, label='CDF')

ax.legend()
plt.show()

image.png

0
0
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
0