visualization.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Default-Credit-Card-Prediction 作者: AlexPnt 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号