该
数据
集
与
酸
度
相
关
的
特
征
有
’fixed acidity’, ‘volatile acidity’, ‘citric acid’,‘chlorides’, ‘free sulfur dioxide’, ‘total sulfur dioxide’,‘PH’
。
其
中
前
6
中
酸
度
特
征
都
会
对
PH
产
⽣
影
响
。
PH
在
对
数
尺
度
,
然
后
对
6
中
酸
度
取
对
数
做
直
⽅
图
。
acidityfeat = ['fixed acidity',
'volatile acidity',
'citric acid',
'chlorides',
'free sulfur dioxide',
'total sulfur dioxide',]
fig = plt.figure(figsize = (10,6))
for i in range(6):
plt.subplot(2,3,i+1)
v = np.log10(np.clip(df[acidityfeat[i]].values,a_min = 0.001,a_max = None))
plt.hist(v,bins = 50,color = color[0])
plt.xlabel('log('+ acidityfeat[i] +')',fontsize = 12)
plt.ylabel('Frequency')
plt.tight_layout()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
plt.figure(figsize = (6,3))
bins = 10**(np.linspace(-2,2))
plt.hist(df['fixed acidity'],bins = bins, edgecolor = 'k',label = 'fixed acidity')
plt.hist(df['volatile acidity'],bins = bins, edgecolor = 'k',label = 'volatile acidity')
plt.hist(df['citric acid'],bins = bins, alpha = 0.8,edgecolor = 'k',label = 'citric acid')
plt.xscale('log')
plt.xlabel('Acid concentration(g/dm^3)')
plt.ylabel('Frequency')
plt.title('Historgram of Acid Concentration')
plt.legend()
plt.tight_layout()
1
2
3
4
5
6
7