nf1_classifier.py 文件源码

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

项目:nf1_inactivation 作者: greenelab 项目源码 文件源码
def plot_decision_function(score_df, partition, output_file):
    """
    Plots the decision function for a given partition (either 'train' or
    'test') and saves a figure to file.

    Arguments:
    :param score_df: a specific folds decision scores and status
    :param partition: either 'train' or 'test' will plot performance
    :param output_file: file to output the figure
    """
    ax = sns.kdeplot(score_df.ix[(score_df.status == 1) &
                                 (score_df.partition == partition), :]
                     .decision, color='red', label='Deficient',
                     shade=True)
    ax = sns.kdeplot(score_df.ix[(score_df.status == 0) &
                                 (score_df.partition == partition), :]
                     .decision, color='blue', label='Wild-Type',
                     shade=True)
    ax.set(xlabel='Decision Function', ylabel='Density')
    ax.set_title('Classifier Decision Function')
    sns.despine()
    plt.tight_layout()
    plt.savefig(output_file)
    plt.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号