<jupyter_start><jupyter_text>Compute recall score<jupyter_code>precision, recall, _ = precision_recall_curve(y_true=y_true, probas_pred=y_score, sample_weight=sample_weight)
auc_score = auc(recall, precision)
nb_direct = data.total_direct_cause()
nb_samples = len(data)
no_skill = nb_direct / nb_samples
plt.plot([0, 1], [no_skill, no_skill], linestyle='--', label='No Skill')
plt.plot(recall, precision, marker='.', label='Logistic')
plt.xlabel('recall')
plt.ylabel('precision')<jupyter_output><empty_output><jupyter_text>Compute unweighted recall score<jupyter_code>precision_uw, recall_uw, _ = precision_recall_curve(y_true=y_true, probas_pred=y_score)
auc_score_uw = auc(recall_uw, precision_uw)
print('AUPR: \t\t  {:0.3f}'.format(auc_score)) 
print('Unweighted AUPR:  {:.3f}'.format(auc_score_uw))
from sklearn.metrics import roc_curve, roc_auc_score
fpr, tpr, _ = roc_curve(y_true=y_true, y_score=y_score, sample_weight=sample_weight)
plt.plot([0, 1], [0, 1], linestyle='--', label='No Skill')
plt.plot(fpr, tpr, marker='.', label='Logistic')
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
from cdt.metrics import precision_recall
aupr, curve = precision_recall(np.asarray(y_true), np.asarray(y_score))
aupr
nb_direct = data.total_direct_cause()
nb_samples = len(data)
no_skill = nb_direct / nb_samples
plt.plot(curve[1], curve[0], marker='.', label='Logistic')
plt.xlabel('recall')
plt.ylabel('precision')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1538987688098495, 'fraction_numerical': 0.007523939808481532, 'mean_word_length': 9.020547945205479, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '306800', 'license': 'MIT', 'n_tokens_mistral': 593, 'n_tokens_neox': 568, 'n_words': 94, 'path': 'benchmark/AU precision recall curve evaluation for data-set.ipynb', 'repo_name': 'Nacho114/bivariate-causal-inference', 'size': '1462'}