[キャンプAI技術を導く]3週目Day 2
16892 ワード
今日の勉強内容
1. Seaborn
1. Seaborn
Matplotlibベースの統計的可視化ライブラリは、複数のカスタマイズと簡単な構文と簡潔な設計を備えています.
可視化の目的と方法に基づいてAPIを分類する
Categorical API
Countplot
sns.countplot(x='column', data = datas, hue='split_column', order=sorted())
統計量
Count:データ量
Mean:平均値
Std:標準偏差
四分位数:データの四等分観測値(25%,50%75%)
Box Plot
fig, ax = plt.subplots(1,1, figsize=(10, 5))
sns.boxplot(x='column1', y='column2', data=datas,
hue='split_column',
order=sorted(),
width=0.3,
linewidth=2,
fliersize=10, #outlier 점의 크기
ax=ax)
plt.show()
Violin Plot
fig, ax = plt.subplots(1,1, figsize=(12, 5))
sns.violinplot(x='column1', data=datas, ax=ax,
bw=0.1,
cut=0,
inner='quartile'
)
plt.show()
Distribution API
fig, axes = plt.subplots(2,2, figsize=(12, 10))
axes = axes.flatten()
sns.histplot(x='math score', data=student, ax=axes[0])
sns.kdeplot(x='math score', data=student, ax=axes[1]) #곡선 보간
sns.ecdfplot(x='math score', data=student, ax=axes[2])
sns.rugplot(x='math score', data=student, ax=axes[3])
Relation & Regression
Scatter Plot
fig, ax = plt.subplots(figsize=(7, 7))
sns.scatterplot(x='column1', y='column2', data=data,
hue='race/ethnicity')
Line Plot
fig, ax = plt.subplots(1, 1,figsize=(12, 7))
sns.lineplot(x='year', y='Jan',data=flights_wide, ax=ax)
Regplot
fig, ax = plt.subplots(figsize=(7, 7))
sns.regplot(x='math score', y='reading score', data=student)
fig, ax = plt.subplots(figsize=(7, 7))
sns.regplot(x='reading score', y='writing score', data=student,
logx=True)
Matrix Plots
Heatmap
fig, ax = plt.subplots(1,1 ,figsize=(7, 6))
sns.heatmap(heart.corr(), ax=ax,
vmin=-1, vmax=1)
fig, ax = plt.subplots(1,1 ,figsize=(10, 9))
sns.heatmap(heart.corr(), ax=ax,
vmin=-1, vmax=1, center=0,
cmap='coolwarm',
annot=True, fmt='.2f')
Reference
この問題について([キャンプAI技術を導く]3週目Day 2), 我々は、より多くの情報をここで見つけました https://velog.io/@mimsu1139/부스트캠프-AI-Tech-3주차-Day-2テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol