๊ด€๋ฆฌ ๋ฉ”๋‰ด

๐Ÿฆ• ๊ณต๋ฃก์ด ๋˜์ž!

Dacon ์™€์ธ ํ’ˆ์งˆ ๊ฒฝ์ง„๋Œ€ํšŒ...3 ๋ณธ๋ฌธ

Data/Dacon

Dacon ์™€์ธ ํ’ˆ์งˆ ๊ฒฝ์ง„๋Œ€ํšŒ...3

Kirok Kim 2021. 12. 10. 00:41
fig, axes = plt.subplots(4, 3, figsize=(25, 15))

fig.suptitle('feature distributions per quality', fontsize= 40)
for ax, col in zip(axes.flat, train.columns[1:]):
    sns.violinplot(x= 'quality', y= col, ax=ax, data=train)
    ax.set_title(col, fontsize=20)
plt.tight_layout()
plt.show()

sns.color_palette("Set2")
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize = (30, 9))


scatter_fix = sns.histplot(data=train, x='pH', y='fixed acidity', bins=50, ax= ax1)
scatter_volatile =  sns.histplot(data=train, x='pH', y='volatile acidity', bins=50, ax= ax2, hue='quality')
scatter_citric = sns.histplot(data=train, x='pH', y='citric acid', bins=50, ax=ax3, hue='quality')
scatter_fix.set_xlabel('pH', fontsize=20)

ax1.settitle()
fig.suptitle('pH & acid hist plot', fontsize = 40)

plt.show()

 

์ƒ๊ด€๊ด€๊ณ„
plt.figure(figsize=(20,10))

heat_table = train.drop(['id'], axis=1).corr()
heatmap_ax = sns.heatmap(heat_table, annot=True, cmap='coolwarm')
heatmap_ax.set_xticklabels(heatmap_ax.get_xticklabels(), fontsize=15, rotation=45)
heatmap_ax.set_yticklabels(heatmap_ax.get_yticklabels(), fontsize=15)
plt.title('correlation between Wine features', fontsize=40)
plt.show()

fig, axes = plt.subplots(1, 2, figsize=(2.33 * 10, 1 * 10))

for i, ax in enumerate(axes):
    if i == 0:
        sns.histplot(x= 'free sulfur dioxide', y= 'total sulfur dioxide', ax= ax, hue= 'quality',data= train)
    else:
        sns.histplot(x= 'free sulfur dioxide', y= 'total sulfur dioxide', ax= ax, hue= 'type',data= train)
        
axes[0].set_title('divided with quality', fontsize=20)
axes[1].set_title('divided with type', fontsize=20)
fig.suptitle('total & free sulfur dioxide hist plot', fontsize= 40)
plt.show()

fig, axes = plt.subplots(1, 2, figsize=(2.33 * 10, 1 * 10))

for i, ax in enumerate(axes):
    if i == 0:
        sns.histplot(x= 'density', y= 'alcohol', ax= ax, hue= 'quality',data= train)
    else:
        sns.histplot(x= 'density', y= 'alcohol', ax= ax, hue= 'type',data= train)
        
axes[0].set_title('divided with quality', fontsize=20)
axes[1].set_title('divided with type', fontsize=20)
fig.suptitle('density & alcohol hist plot', fontsize= 40)
plt.show()

fig, axes = plt.subplots(1, 2, figsize=(2.33 * 10, 1 * 10))

for i, ax in enumerate(axes):
    if i == 0:
        sns.histplot(x= 'density', y= 'alcohol', bins=50, ax= ax, hue= 'quality',data= train)
        ax.add_patch(patches.Ellipse((1.0385, 11.7), .001, .5, color='r', fill=False))
    else:
        sns.histplot(x= 'density', y= 'alcohol', bins=50, ax= ax, hue= 'type',data= train)
        ax.add_patch(patches.Ellipse((1.0385, 11.7), .001, .5, color='r', fill=False))
        
axes[0].set_title('divided with quality', fontsize=20)
axes[1].set_title('divided with type', fontsize=20)
fig.suptitle('density & alcohol hist plot', fontsize= 40)
plt.show()

๋ฐ˜์‘ํ˜•
Comments