<jupyter_start><jupyter_text>测试集ROC曲线<jupyter_code>plt.figure()
lw = 2
plt.plot(fpr, tpr, color='darkorange',
         lw=lw, label='ROC curve (area = %0.2f)' % roc_auc_score(y_test, test_preds.mean(axis=1)))
plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver operating characteristic example')
plt.legend(loc="lower right")
plt.savefig('roc.png')
plt.show()<jupyter_output><empty_output><jupyter_text>特征重要性<jupyter_code>plt.figure(figsize=[60,20])
ax = lgb.plot_importance(gbm,max_num_features=25)
plt.savefig('feature_importance.png')
plt.show()
plt.figure()
feat_imp[['feature','gain']].head(25).plot(kind='barh', x='feature', y='gain', legend=False, figsize=(10, 20))
plt.gcf().savefig('features_importance.png')
plt.show()<jupyter_output><empty_output><jupyter_text>树<jupyter_code>import matplotlib.pyplot as plt
ax = lgb.plot_tree(gbm, tree_index=83, figsize=(20, 8), show_info=['split_gain'])
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1998149861239593, 'fraction_numerical': 0.03145235892691952, 'mean_word_length': 8.836363636363636, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '255526', 'license': 'MIT', 'n_tokens_mistral': 491, 'n_tokens_neox': 459, 'n_words': 61, 'path': 'notebookcode/.ipynb_checkpoints/lgb-checkpoint.ipynb', 'repo_name': 'Yuyoo/Oliguria', 'size': '1081'}