{"id":790008,"date":"2026-11-20T03:54:20","date_gmt":"2026-11-20T03:54:20","guid":{"rendered":"https:\/\/www.europesays.com\/ie\/790008\/"},"modified":"2026-11-20T03:54:20","modified_gmt":"2026-11-20T03:54:20","slug":"roc-curve-in-python-step-by-step-plotting-guide-casrai","status":"publish","type":"post","link":"https:\/\/www.europesays.com\/ie\/790008\/","title":{"rendered":"ROC Curve in Python: Step-by-Step Plotting Guide \u2014 CASRAI"},"content":{"rendered":"<p>A Receiver Operating Characteristic (ROC) curve in Python is a graphical plot that displays the diagnostic ability of a binary classifier across all possible discrimination thresholds by plotting the True Positive Rate (sensitivity) against the False Positive Rate (1 \u2013 specificity). In Python, researchers construct and visualize ROC curves primarily using the scikit-learn library through either the low-level sklearn.metrics.roc_curve function or the high-level RocCurveDisplay visualizer combined with Matplotlib. The resulting curve illustrates the fundamental trade-off between sensitivity and specificity, allowing analysts to select an optimal decision threshold and calculate the Area Under the Curve (AUC) to summarize global discriminative performance independently of arbitrary classification cutoffs.<\/p>\n<p>What ROC curves in Python are used for in research<\/p>\n<p>In quantitative scientific research, binary classification models frequently generate continuous output scores\u2014such as posterior probabilities from <a href=\"https:\/\/casrai.org\/guides\/lasso-logistic-regression\" rel=\"nofollow noopener\" target=\"_blank\">lasso logistic regression models<\/a> or decision values from support vector machines\u2014rather than categorical labels. Evaluating these models using a single arbitrary cutoff (such as 0.50) obscures whether classification errors stem from inherently poor discrimination or merely a suboptimal threshold. The Receiver Operating Characteristic curve resolves this limitation by mapping performance across the full continuum of decision thresholds.<\/p>\n<p>Historically developed during World War II for radar signal detection in the presence of noise, ROC analysis has become a foundational standard across clinical diagnostics, epidemiology, bioinformatics, and machine learning research. A researcher evaluating a diagnostic biomarker for disease detection uses the ROC curve to observe how many true disease cases are captured (sensitivity) for every false alarm generated among healthy controls (1 \u2013 specificity) as the detection threshold shifts.<\/p>\n<p>What does the ROC\/AUC curve show?<\/p>\n<p>The ROC curve shows the parametric trajectory of the True Positive Rate (TPR) on the vertical axis against the False Positive Rate (FPR) on the horizontal axis across every threshold in the dataset. The True Positive Rate, also termed sensitivity or recall, represents the proportion of actual positive cases correctly identified by the classifier. The False Positive Rate represents the proportion of actual negative cases incorrectly flagged as positive, mathematically equivalent to 1 minus specificity.<\/p>\n<p>The Area Under the Receiver Operating Characteristic Curve (AUROC or AUC) quantifies the overall ability of the model to discriminate between positive and negative classes. Geometrically, AUC corresponds to the entire area beneath the plotted curve, bounded between 0.0 and 1.0. Statistically, the AUC is equivalent to the Mann-Whitney U statistic (or Wilcoxon rank-sum test): it equals the exact probability that the model will rank a randomly chosen positive instance higher than a randomly chosen negative instance. A completely random guesser generates a diagonal line from (0, 0) to (1, 1) with an AUC of 0.50, whereas a flawless classifier traces a curve through the top-left corner (0, 1) with an AUC of 1.0.<\/p>\n<p>For detailed coverage of scalar metric calculations and mathematical foundations, researchers can consult our dedicated <a href=\"https:\/\/casrai.org\/guides\/sklearn-auroc\" rel=\"nofollow noopener\" target=\"_blank\">scikit-learn roc_auc_score guide<\/a> and our comprehensive review of <a href=\"https:\/\/casrai.org\/guides\/how-to-calculate-auc\" rel=\"nofollow noopener\" target=\"_blank\">calculating AUC manually and across software packages<\/a>.<\/p>\n<p>To plot ROC curves in Python, researchers require Python 3.9 or newer along with four standard scientific libraries: scikit-learn for statistical computation, Matplotlib for graphical visualization, NumPy for array manipulation, and Pandas for tabular data handling. Installation should always occur within an isolated virtual environment to preserve reproducible dependency trees across research projects.<\/p>\n<p>Execute the following shell commands in your terminal to initialize a virtual environment and install the verified packages from the official Python Package Index (PyPI):<\/p>\n<p>python3 -m venv .venv<br \/>\nsource .venv\/bin\/activate<br \/>\npython3 -m pip install &#8211;upgrade pip<br \/>\npython3 -m pip install scikit-learn matplotlib numpy pandas<\/p>\n<p>After installation completes, verify the installed software versions in a Python session to ensure that the visualization API is available:<\/p>\n<p>import sklearn<br \/>\nimport matplotlib<\/p>\n<p>print(&#8220;scikit-learn version:&#8221;, sklearn.__version__)<br \/>\nprint(&#8220;matplotlib version:&#8221;, matplotlib.__version__)<\/p>\n<p>The high-level visualizer class RocCurveDisplay requires scikit-learn version 0.22 or higher. Modern releases (version 1.0 and later) provide the full convenience class methods from_estimator and from_predictions.<\/p>\n<p>How to plot a ROC curve in Python step by step<\/p>\n<p>Generating a publication-quality ROC curve involves extracting continuous decision scores from a fitted statistical model, passing those scores to scikit-learn evaluation routines, and rendering the graphical display. The following numbered procedure demonstrates both the low-level calculation method and the streamlined object-oriented visualizer.<\/p>\n<p>How do I plot a curve in Python?<\/p>\n<p>To plot a curve in Python, you train a classification model on training data, extract predicted continuous probabilities on unseen test data using predict_proba, pass the true test labels and positive-class probabilities into sklearn.metrics.roc_curve, and plot the resulting arrays with matplotlib.pyplot.plot. Alternatively, calling RocCurveDisplay.from_estimator(model, X_test, y_test) performs probability extraction, threshold computation, and figure rendering in a single command.<\/p>\n<p>How to draw a ROC curve?<\/p>\n<p>Drawing a ROC curve requires following a rigorous analytical workflow from data partitioning to graphical styling. Follow these seven sequential steps:<\/p>\n<ol>\n<li><strong>Step 1: Import modules and configure plotting style.<\/strong> Import NumPy, Matplotlib, and scikit-learn modules for modeling, metrics, and dataset handling:<br \/>\nimport matplotlib.pyplot as plt<br \/>\nimport numpy as np<br \/>\nfrom sklearn.datasets import make_classification<br \/>\nfrom sklearn.linear_model import LogisticRegression<br \/>\nfrom sklearn.ensemble import RandomForestClassifier<br \/>\nfrom sklearn.metrics import roc_curve, auc, RocCurveDisplay<br \/>\nfrom sklearn.model_selection import train_test_split\n<\/li>\n<li><strong>Step 2: Prepare stratified experimental data.<\/strong> Partition the dataset into training and testing subsets using stratification so that class prevalence remains identical across splits:<br \/>\nX, y = make_classification(<br \/>\n    n_samples=1000,<br \/>\n    n_features=20,<br \/>\n    n_informative=10,<br \/>\n    n_classes=2,<br \/>\n    weights=[0.7, 0.3],<br \/>\n    random_state=42<br \/>\n)<\/p>\n<p>X_train, X_test, y_train, y_test = train_test_split(<br \/>\n    X, y, test_size=0.30, stratify=y, random_state=42<br \/>\n)\n<\/li>\n<li><strong>Step 3: Fit the predictive classifier.<\/strong> Train the classification estimator on the training partition:<br \/>\nclassifier = LogisticRegression(random_state=42)<br \/>\nclassifier.fit(X_train, y_train)\n<\/li>\n<li><strong>Step 4: Extract continuous prediction probabilities.<\/strong> Never use discrete class labels from predict(). Instead, obtain continuous probability estimates for the positive class (column index 1):<br \/>\ny_scores = classifier.predict_proba(X_test)[:, 1]\n<\/li>\n<li><strong>Step 5: Calculate operating points using roc_curve.<\/strong> Pass true labels and continuous scores to compute False Positive Rates, True Positive Rates, and decision thresholds:<br \/>\nfpr, tpr, thresholds = roc_curve(y_test, y_scores)<br \/>\nroc_auc = auc(fpr, tpr)<\/p>\n<p>print(&#8220;Computed&#8221;, len(thresholds), &#8220;operating thresholds.&#8221;)<br \/>\nprint(&#8220;ROC AUC score:&#8221;, round(roc_auc, 4))\n<\/li>\n<li><strong>Step 6: Render the plot using Matplotlib.<\/strong> Plot the empirical curve alongside the non-discriminative chance diagonal line:<br \/>\nplt.figure(figsize=(8, 6), dpi=300)<br \/>\nplt.plot(fpr, tpr, color=&#8221;#1f77b4&#8243;, lw=2, label=f&#8221;Logistic Regression (AUC = {roc_auc:.3f})&#8221;)<br \/>\nplt.plot([0, 1], [0, 1], color=&#8221;#7f7f7f&#8221;, lw=1.5, linestyle=&#8221;&#8211;&#8220;, label=&#8221;Chance (AUC = 0.500)&#8221;)<br \/>\nplt.xlim([0.0, 1.0])<br \/>\nplt.ylim([0.0, 1.05])<br \/>\nplt.xlabel(&#8220;False Positive Rate (1 \u2013 Specificity)&#8221;, fontsize=12)<br \/>\nplt.ylabel(&#8220;True Positive Rate (Sensitivity)&#8221;, fontsize=12)<br \/>\nplt.title(&#8220;Receiver Operating Characteristic Curve&#8221;, fontsize=14)<br \/>\nplt.legend(loc=&#8221;lower right&#8221;, fontsize=11)<br \/>\nplt.grid(alpha=0.3)<br \/>\nplt.tight_layout()<br \/>\nplt.show()\n<\/li>\n<li><strong>Step 7: Benchmark multiple classifiers on a shared axis.<\/strong> In comparative research, plot competing models on the same figure using RocCurveDisplay:<br \/>\nrf_model = RandomForestClassifier(random_state=42)<br \/>\nrf_model.fit(X_train, y_train)<\/p>\n<p>fig, ax = plt.subplots(figsize=(8, 6), dpi=300)<\/p>\n<p>RocCurveDisplay.from_estimator(<br \/>\n    classifier, X_test, y_test,<br \/>\n    name=&#8221;Logistic Regression&#8221;,<br \/>\n    ax=ax,<br \/>\n    color=&#8221;#1f77b4&#8243;,<br \/>\n    lw=2<br \/>\n)<\/p>\n<p>RocCurveDisplay.from_estimator(<br \/>\n    rf_model, X_test, y_test,<br \/>\n    name=&#8221;Random Forest&#8221;,<br \/>\n    ax=ax,<br \/>\n    color=&#8221;#2ca02c&#8221;,<br \/>\n    lw=2<br \/>\n)<\/p>\n<p>ax.plot([0, 1], [0, 1], color=&#8221;#7f7f7f&#8221;, lw=1.5, linestyle=&#8221;&#8211;&#8220;, label=&#8221;Chance (AUC = 0.500)&#8221;)<br \/>\nax.set_xlim([0.0, 1.0])<br \/>\nax.set_ylim([0.0, 1.05])<br \/>\nax.set_xlabel(&#8220;False Positive Rate (1 \u2013 Specificity)&#8221;, fontsize=12)<br \/>\nax.set_ylabel(&#8220;True Positive Rate (Sensitivity)&#8221;, fontsize=12)<br \/>\nax.set_title(&#8220;Multi-Model ROC Comparison&#8221;, fontsize=14)<br \/>\nax.legend(loc=&#8221;lower right&#8221;, fontsize=11)<br \/>\nax.grid(alpha=0.3)<br \/>\nplt.tight_layout()<br \/>\nplt.show()\n<\/li>\n<\/ol>\n<p>How to read the output<\/p>\n<p>Interpreting a ROC curve requires examining both the geometric trajectory of the curve and the numerical distribution of operating thresholds returned by scikit-learn. The returned arrays provide the raw quantitative data required for evidence-based decision making:<\/p>\n<ul>\n<li><strong>False Positive Rate array (fpr):<\/strong> Monotonically increasing values ranging from 0.0 to 1.0, representing the probability of a false alarm at each threshold.<\/li>\n<li><strong>True Positive Rate array (tpr):<\/strong> Monotonically increasing values from 0.0 to 1.0, representing statistical power or sensitivity at each threshold.<\/li>\n<li><strong>Thresholds array (thresholds):<\/strong> Decreasing decision values corresponding to each point on the curve. In scikit-learn, thresholds[0] is set to an arbitrary value strictly greater than 1.0 (specifically max(y_score) + 1) to anchor the curve at the origin (0, 0) where no instances are classified as positive.<\/li>\n<\/ul>\n<p>Is 0.95 AUC good?<\/p>\n<p>An AUC of 0.95 represents outstanding discriminative power in almost every scientific domain, but whether it is truly good depends entirely on clinical context, validation protocol, and class distribution. In general diagnostic research, an AUC between 0.50 and 0.70 denotes poor discrimination, 0.70 to 0.80 acceptable discrimination, 0.80 to 0.90 excellent discrimination, and above 0.90 outstanding discrimination.<\/p>\n<p>However, when a model achieves an AUC of 0.95, researchers must investigate three potential methodological pitfalls before declaring success:<\/p>\n<ol>\n<li><strong>Data leakage and feature contamination:<\/strong> High AUC values often indicate that a predictor variable contains direct or indirect knowledge of the target outcome (such as a laboratory measurement taken after clinical intervention).<\/li>\n<li><strong>Overfitting on small test samples:<\/strong> An AUC evaluated on an unstratified or tiny validation set may reflect sample variance rather than genuine generalizability. Always confirm stability using k-fold cross-validation.<\/li>\n<li><strong>Severe class imbalance:<\/strong> If the positive class represents only 0.1% of the population, an AUC of 0.95 can still correspond to a classifier with unacceptable clinical precision, generating hundreds of false positives for each true case. Pair ROC analysis with our <a href=\"https:\/\/casrai.org\/guides\/sklearn-precision-recall-curve\" rel=\"nofollow noopener\" target=\"_blank\">scikit-learn precision-recall curve walkthrough<\/a> when working with skewed outcome distributions.<\/li>\n<\/ol>\n<p>Selecting the optimal decision threshold<\/p>\n<p>The ROC curve visualizes all possible thresholds, but operational deployment requires selecting a single threshold. Two common statistical methods automate this selection:<\/p>\n<p><strong>1. Youden\u2019s J Statistic:<\/strong> Youden\u2019s index maximizes the vertical distance between the ROC curve and the chance line, giving equal weight to sensitivity and specificity: J = Sensitivity + Specificity \u2013 1 = TPR \u2013 FPR. In Python, you identify the optimal threshold with NumPy:<\/p>\n<p>j_scores = tpr &#8211; fpr<br \/>\noptimal_idx = np.argmax(j_scores)<br \/>\noptimal_threshold = thresholds[optimal_idx]<\/p>\n<p>print(f&#8221;Optimal Threshold (Youden J): {optimal_threshold:.4f}&#8221;)<br \/>\nprint(f&#8221;Sensitivity at Optimal Cutoff: {tpr[optimal_idx]:.4f}&#8221;)<br \/>\nprint(f&#8221;Specificity at Optimal Cutoff: {1 &#8211; fpr[optimal_idx]:.4f}&#8221;)<\/p>\n<p><strong>2. Cost-Weighted Thresholding:<\/strong> When false negatives carry more severe consequences than false positives (such as missing a lethal malignancy versus ordering a confirmatory blood test), researchers minimize an asymmetric expected loss function: Loss = Cost_FN \u00d7 (1 \u2013 TPR) \u00d7 Prevalence + Cost_FP \u00d7 FPR \u00d7 (1 \u2013 Prevalence). Selecting the operating threshold that minimizes this expected cost ensures the model aligns with real-world clinical priorities.<\/p>\n<p>Reporting ROC curves in academic publications<\/p>\n<p>When reporting ROC analysis in peer-reviewed journals, best-practice standards (such as the TRIPOD and STARD guidelines) require stating the point estimate of the AUC alongside a 95% confidence interval computed via non-parametric bootstrapping or DeLong\u2019s method. In addition, authors should report the specific operating sensitivity and specificity at the chosen clinical cutoff alongside a full <a href=\"https:\/\/casrai.org\/guides\/sklearn-confusion-matrix\" rel=\"nofollow noopener\" target=\"_blank\">evaluating classification confusion matrices<\/a> breakdown and <a href=\"https:\/\/casrai.org\/guides\/sklearn-classification-report\" rel=\"nofollow noopener\" target=\"_blank\">scikit-learn classification report metrics<\/a>.<\/p>\n<p>Here is standard Python code for computing 95% bootstrap confidence intervals for the AUC score:<\/p>\n<p>n_bootstraps = 1000<br \/>\nrng = np.random.RandomState(42)<br \/>\nbootstrapped_scores = []<\/p>\n<p>for _ in range(n_bootstraps):<br \/>\n    indices = rng.randint(0, len(y_test), len(y_test))<br \/>\n    if len(np.unique(y_test[indices])) &lt; 2:<br \/>\n        continue<br \/>\n    score = auc(*roc_curve(y_test[indices], y_scores[indices])[:2])<br \/>\n    bootstrapped_scores.append(score)<\/p>\n<p>ci_lower = np.percentile(bootstrapped_scores, 2.5)<br \/>\nci_upper = np.percentile(bootstrapped_scores, 97.5)<br \/>\nprint(f&#8221;AUC: {roc_auc:.3f} (95% CI: {ci_lower:.3f}\u2013{ci_upper:.3f})&#8221;)<br \/>\nTroubleshooting ROC curves in Python<\/p>\n<p>When implementing ROC analysis in Python, researchers commonly encounter several recurring technical and conceptual issues. The following solutions address these failure modes directly:<\/p>\n<p>Curve appears as a crude three-point step<\/p>\n<p>If your ROC curve consists of only three connected points\u2014origin (0, 0), an intermediate operating point, and (1, 1)\u2014you passed binary predicted classes from model.predict(X_test) into roc_curve() instead of continuous decision values. Passing binary labels evaluates only a single default threshold (typically 0.50), eliminating the continuous threshold spectrum. To resolve this, always pass continuous probabilities using model.predict_proba(X_test)[:, 1] or uncalibrated decision scores from model.decision_function(X_test).<\/p>\n<p>Inverted curve with AUC below 0.50<\/p>\n<p>An empirical ROC curve that dips substantially below the diagonal chance line, yielding an AUC score below 0.50, indicates that the positive class label was inverted. By default, roc_curve assumes that the higher numerical value corresponds to the positive class. If your outcome array uses string labels (such as benign and malignant) or custom numeric encodings, explicitly specify the positive class using the pos_label parameter:<\/p>\n<p>fpr, tpr, thresholds = roc_curve(y_test, y_scores, pos_label=&#8221;malignant&#8221;)<br \/>\nOverly optimistic curves under extreme class imbalance<\/p>\n<p>The False Positive Rate formula includes True Negatives in its denominator: FPR = FP \/ (FP + TN). In datasets with extreme class imbalance\u2014where negative cases outnumber positive cases by 100 to 1\u2014a massive surge in absolute false positive predictions will still yield a small FPR because the denominator (TN) is enormous. As a result, the ROC curve appears deceptively high even when the model generates hundreds of false alarms per true detection. In skewed research settings (such as rare disease screening), complement the ROC curve with a Precision-Recall curve.<\/p>\n<p>Multiclass classification errors<\/p>\n<p>Attempting to pass a multiclass target array directly to roc_curve() raises a ValueError: multiclass format is not supported. ROC analysis is strictly binary. To evaluate multiclass problems in Python, researchers must decompose the task into multiple binary evaluations using either a One-vs-Rest (OvR) or One-vs-One (OvO) strategy, computing separate ROC curves for each distinct class and optionally calculating macro-averaged or micro-averaged summary curves.<\/p>\n<p>Free alternatives to scikit-learn for ROC curves<\/p>\n<p>While scikit-learn is the standard machine learning library in Python, researchers frequently utilize alternative open-source software libraries depending on programming language, statistical requirements, and visualization needs. The table below compares the primary free tools available for ROC analysis in scientific research.<\/p>\n<tr>\nSoftware Tool<br \/>\nLanguage \/ Environment<br \/>\nPrimary Statistical Capabilities<br \/>\nBest Suited For<br \/>\n<\/tr>\n<tr>\n<td><strong>pROC<\/strong><\/td>\n<td>R<\/td>\n<td>Comprehensive ROC analysis, DeLong test, bootstrap confidence intervals, smoothed curves, partial AUC<\/td>\n<td>Biostatistical and clinical biomarker research requiring formal hypothesis testing between ROC curves<\/td>\n<\/tr>\n<tr>\n<td><strong>ROCR<\/strong><\/td>\n<td>R<\/td>\n<td>Modular performance scoring, cross-validated averaging, ROC and PR curve visualization<\/td>\n<td>Comparative model benchmarking across repeated resampling folds in R workflows<\/td>\n<\/tr>\n<tr>\n<td><strong>statsmodels<\/strong><\/td>\n<td>Python<\/td>\n<td>Econometric and classical statistical modeling, GLM diagnostics, prediction tables<\/td>\n<td>Epidemiological and social science research focused on inference rather than pure machine learning<\/td>\n<\/tr>\n<tr>\n<td><strong>Yellowbrick<\/strong><\/td>\n<td>Python<\/td>\n<td>Visual steering API extending scikit-learn, ROCAUC visualizer with automatic multiclass decomposition<\/td>\n<td>Rapid visual diagnostics and automated hyperparameter tuning evaluation<\/td>\n<\/tr>\n<tr>\n<td><strong>SciPy<\/strong><\/td>\n<td>Python<\/td>\n<td>Low-level numerical integration routines (trapezoid, simpson)<\/td>\n<td>Custom non-parametric integration and proprietary curve modeling workflows<\/td>\n<\/tr>\n<tr>\n<td><strong>ROCAnalysis.jl<\/strong><\/td>\n<td>Julia<\/td>\n<td>High-performance ROC curve generation, threshold optimization, metric calculation<\/td>\n<td>Large-scale computational simulation and high-throughput genomic data processing<\/td>\n<\/tr>\n<p>The dataset table below summarizes the key evaluation functions and visualizer classes available in scikit-learn for binary classification analysis.<\/p>\n<p>Frequently asked questions<br \/>\nWhat does the ROC\/AUC curve show?<\/p>\n<p>The ROC curve shows the trade-off between sensitivity (True Positive Rate) and 1 minus specificity (False Positive Rate) across all possible classification cutoffs. The Area Under the Curve (AUC) summarizes this diagnostic capability in a single metric ranging from 0.50 (chance discrimination) to 1.0 (flawless discrimination), representing the probability that a randomly selected positive case receives a higher risk score than a randomly selected negative case.<\/p>\n<p>How do I plot a curve in Python?<\/p>\n<p>In Python, you plot a ROC curve by obtaining continuous prediction probabilities from a trained model using predict_proba(X_test)[:, 1], passing the true test labels and probabilities into sklearn.metrics.roc_curve to derive false positive rates and true positive rates, and plotting those coordinates with Matplotlib. Alternatively, calling RocCurveDisplay.from_estimator(model, X_test, y_test) generates the complete plot with AUC in a single command.<\/p>\n<p>Is 0.95 AUC good?<\/p>\n<p>An AUC of 0.95 indicates outstanding overall discriminative capability, but researchers must verify that the score is not inflated by data leakage, inadequate validation sample size, or severe class imbalance. In highly imbalanced datasets, high AUC values can mask poor positive predictive value, making precision-recall evaluation essential.<\/p>\n<p>How to draw a ROC curve?<\/p>\n<p>To draw a ROC curve, partition your data with stratification, train an estimator, generate continuous probability scores on test instances, compute the true positive and false positive rates across all thresholds, plot the curve against a dashed chance line from (0, 0) to (1, 1), and report the resulting AUC with 95% bootstrap confidence intervals.<\/p>\n<p>What is the difference between ROC AUC and PR AUC in imbalanced data?<\/p>\n<p>ROC AUC evaluates sensitivity against the False Positive Rate, which includes true negatives in the denominator and remains stable regardless of class prevalence. In contrast, Precision-Recall (PR) AUC evaluates positive predictive value (precision) against sensitivity (recall), directly reflecting false alarms relative to the minority positive class. When positive instances are rare, PR curves reveal performance deficits that ROC curves conceal.<\/p>\n<p>Why does my ROC curve look like a staircase with only three points?<\/p>\n<p>A three-point staircase curve occurs when binary class predictions from predict() (0 or 1) are passed to roc_curve() instead of continuous prediction probabilities from predict_proba() or decision scores from decision_function(). Binary predictions collapse the curve to a single operational threshold.<\/p>\n<p>Sources<\/p>\n","protected":false},"excerpt":{"rendered":"A Receiver Operating Characteristic (ROC) curve in Python is a graphical plot that displays the diagnostic ability of&hellip;\n","protected":false},"author":2,"featured_media":790009,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_share_on_mastodon":"0"},"categories":[74],"tags":[68602,329042,18,19,17,276488,329041,329040,82],"class_list":["post-790008","post","type-post","status-publish","format-standard","has-post-thumbnail","category-technology","tag-auc","tag-classification-metrics","tag-eire","tag-ie","tag-ireland","tag-model-evaluation","tag-roc-curve","tag-scikit-learn","tag-technology"],"share_on_mastodon":{"url":"https:\/\/pubeurope.com\/@ie\/117646751428959258","error":""},"_links":{"self":[{"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/posts\/790008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/comments?post=790008"}],"version-history":[{"count":0,"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/posts\/790008\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/media\/790009"}],"wp:attachment":[{"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/media?parent=790008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/categories?post=790008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.europesays.com\/ie\/wp-json\/wp\/v2\/tags?post=790008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}