📊 SUB PLOTS
f, ax = plt.subplots(2,2, figsize=(7,7))
ax[0][0].plot(range(len(Y)), Y.values)
ax[0][1].boxplot(Y.values)
sns.kdeplot(Y.values, ax=ax[1][0])
sns.distplot(Y.values,
hist_kws=dict(cumulative=True),
kde_kws=dict(cumulative=True),
ax=ax[1][1])
ax[0][0].set_title("revenue by index")
ax[0][0].set_title("cdf by index")
🦜 Seaborn Set Palette
sns.set_palette(sns.color_palette("husl", 8))
📊 KDE
ax = sns.distplot(X['MPAA'].values, rug=True, rug_kws={"color": "r"},
kde_kws={"color": "blue", "lw": 2, "label": "KDE"},
hist_kws={"histtype": "step", "linewidth": 4,
"alpha": 1, "color": "pink"})
ax.set_title("MPAA")
plt.show()
ax = sns.kdeplot(X['raters'], shade=True)
ax.set_title("Raters")
plt.show()
X['raters'].describe()
📈 Log Transformation
label = 'raters'
Z =X[label].apply(lambda x:np.log(1+x))
f, ax = plt.subplots(1,2, figsize=(5,3))
sns.kdeplot(X[label], shade=True, ax=ax[0])
sns.kdeplot(Z.ravel(), shade=True, ax=ax[1])
ax[0].set_title(label)
ax[1].set_title(label + " + Log")
plt.tight_layout(True)
plt.show()
pd.concat([X[label].describe(), Z.describe()], axis=1)
🦜 Legend Location
ax[0].legend(bbox_to_anchor=(0, -1, 0.5, 0.5))
🦜 Remove Legend
ax.get_legend().remove()
'데이터분석' 카테고리의 다른 글
Feature Importance by Boruta (0) | 2020.08.23 |
---|---|
다중공선성은 모델에 어떤 영향을 미치는가? (0) | 2020.08.12 |
Biased Estimation, Unbiased Estimation (0) | 2020.08.04 |
Frequentist vs Bayesian (0) | 2020.08.03 |
Spark 기본 설명 (0) | 2020.07.30 |