Skip to content

Statistical Summary


🎯 Purpose

This reference provides statistical evaluation tools and interpretation guidelines for logistic regression models. It supports binary and multiclass classification workflows with model fit diagnostics, threshold-aware metrics, and probability-based summaries.


πŸ“ 1. Core Classification Metrics

βœ… Accuracy

Proportion of correct predictions.

from sklearn.metrics import accuracy_score
accuracy_score(y_true, y_pred)

βœ… Precision, Recall, and F1 Score

Evaluate class-specific predictive performance.

from sklearn.metrics import precision_score, recall_score, f1_score
  • average='binary', 'macro', 'weighted' as needed

βœ… Confusion Matrix

Compare predicted vs actual labels.

from sklearn.metrics import confusion_matrix
confusion_matrix(y_true, y_pred)
  • Ideal for visual + text reporting

βœ… ROC AUC (Area Under Curve)

Evaluates probability-based ranking ability.

from sklearn.metrics import roc_auc_score
roc_auc_score(y_true, y_proba)
  • Best for binary or OvR for multiclass

βœ… Log Loss (Cross-Entropy)

Measures penalty for incorrect/confident predictions.

from sklearn.metrics import log_loss
log_loss(y_true, y_proba)
  • Lower is better

βœ… Brier Score

Mean squared error of predicted probabilities.

from sklearn.metrics import brier_score_loss
brier_score_loss(y_true, y_proba)
  • Lower = better-calibrated model

πŸ“Š 2. Logistic Regression Fit & Diagnostics

βœ… McFadden’s Pseudo RΒ²

Compares log-likelihoods against null model.

1 - (model.llf / model.llnull)  # statsmodels
  • Values closer to 1 are better (but lower than OLS RΒ²)

βœ… AIC / BIC (Model Selection Criteria)

Used to compare fit with complexity penalty.

model.aic, model.bic  # statsmodels
  • Lower = better fit

βœ… Classification Report

One-line summary of precision, recall, F1, and support per class.

from sklearn.metrics import classification_report
print(classification_report(y_true, y_pred))

πŸ“ˆ 3. Threshold + Probability Analysis

βœ… Threshold Evaluation (beyond 0.5)

from sklearn.metrics import precision_recall_curve
precision, recall, thresholds = precision_recall_curve(y_true, y_proba)

βœ… Calibration Curve

Compare predicted proba vs true class probability.

from sklearn.calibration import calibration_curve
prob_true, prob_pred = calibration_curve(y_true, y_proba, n_bins=10)

🧾 4. Suggested Report Summary Table

Field Description
Model Type Logistic / Multinomial / Regularized
Accuracy / F1 Basic classifier summary
ROC AUC / Log Loss Probability performance
Pseudo RΒ² (McFadden) Model fit (statsmodels only)
AIC / BIC Fit vs complexity
Confusion Matrix Class-level correctness
Calibration Status Raw vs Platt/Isotonic
Threshold Logic Used 0.5 default or custom cutoff

🧠 Final Tip

β€œLogistic regression is interpretable, but not assumption-free. Combine statistical fit, threshold diagnostics, and class-level metrics to verify performance.”

Use with: ROC/PR Visual Guide, Evaluation Checklist, and Model Diagnostics Runner.