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()
评论列表
文章目录