Visual Interpretation (Multi/Ordinal)
π― Purpose
Use this visual guide to understand, validate, and communicate results from Multiclass (Nominal) and Ordinal Logistic Regression models. Each plot helps assess model behavior, class probability structure, and assumption alignment.
1οΈβ£ Multiclass (Multinomial Logistic Regression)¶
π A. Class Probability Distributions¶
What it shows: Predicted probability for each class per observation
import matplotlib.pyplot as plt
probs = model.predict_proba(X_test)
plt.plot(probs)
plt.title("Predicted Class Probabilities")
βοΈ Helps detect low-confidence predictions or class overlap
π B. Softmax Score Trends¶
What it shows: Influence of features on class probability scores
# Use partial dependence or coefficient plots per class
βοΈ Visualizes how specific features shift class predictions
π C. Confusion Matrix (Multiclass)¶
from sklearn.metrics import ConfusionMatrixDisplay
ConfusionMatrixDisplay.from_predictions(y_true, y_pred)
βοΈ Detects which classes are often confused
2οΈβ£ Ordinal Logistic Regression¶
π A. Predicted Score Distributions by Class¶
What it shows: Where the model places predicted scores relative to ordinal thresholds
# After fitting ordinal model, visualize raw prediction scores by actual class
sns.violinplot(x=y_true, y=model.decision_function(X))
βοΈ Look for monotonic separation between categories
π B. Threshold Cutoffs¶
What it shows: Estimated logit cut points between ordinal levels
# Ordinal models like mord expose thresholds (intercepts)
print(model.intercept_) # ΞΈ_j values
βοΈ Check if spacing between cut points makes sense (e.g., large jump from βmediumβ to βhighβ)
π§ͺ C. Proportional Odds Diagnostic (Optional)¶
What it shows: If slopes are consistent across class splits
- Fit parallel regressions across class thresholds
- Plot coefficients or marginal effects by threshold group
βοΈ If slopes differ greatly, PO assumption may be violated
β Visual Interpretation Checklist¶
- [ ] Class probabilities or scores plotted
- [ ] Confusion matrix reviewed
- [ ] Thresholds and score separations visualized (ordinal only)
- [ ] Softmax/logit outputs mapped to interpretable odds
- [ ] Assumptions flagged visually if violated
π‘ Tip¶
βIf your classes are confused or your thresholds overlap β itβs your visuals, not your coefficients, that will tell the truth.β