def visualize_feature_boxplot(X,y,selected_feature,features):
"""
Visualize the boxplot of a feature
Keyword arguments:
X -- The feature vectors
y -- The target vector
selected_feature -- The desired feature to obtain the histogram
features -- Vector of feature names (X1 to XN)
"""
#create data
joint_data=np.column_stack((X,y))
column_names=features
#create dataframe
df=pd.DataFrame(data=joint_data,columns=column_names)
# palette = sea.hls_palette()
splot=sea.boxplot(data=df,x='Y',y=selected_feature,hue="Y",palette="husl")
plt.title('BoxPlot Distribution of '+selected_feature)
#save fig
output_dir = "img"
save_fig(output_dir,'{}/{}_boxplot.png'.format(output_dir,selected_feature))
# plt.show()
visualization.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录