Chapter 4: Multiclass Classification
Automated Ticket Routing: Multiclass Classification

Minermontโs emergency desk is overwhelmed, and Ethan partners with Claire to build multiclass triage support that assists nurses while keeping humans in control.
This chapter focuses on multiclass classification: extending classifiers beyond yes/no decisions, evaluating performance per class, and using ensemble methods to improve robustness.
4.2 Multiclass Strategies: One-vs-Rest (OvR) and One-vs-One (OvO): You'll discover how to extend binary classification algorithms to problems with multiple classes. You'll compare One-vs-Rest (OvR) and One-vs-One (OvO) strategies, understanding when to use each in more complex real-world settings.
4.2 K-Nearest Neighbors (K-NN): You'll explore an algorithm based on the wisdom of the crowd. You'll see how the simple idea of classifying a new case based on its closest neighbors can be surprisingly powerfulโand understand Marta and Luis's concerns about the choice of distance metric and the "curse of dimensionality."
4.2 Decision Trees: You'll build a model that mimics human reasoning. You'll discover why Teresa and Javier felt so aligned with this approach, which creates a set of explicit, easy-to-follow rulesโmuch like a troubleshooting flowchart.
4.2 Random Forests: You'll explore how multiple decision trees work together like a team of specialists. You'll see how combining independent predictions improves accuracy and reduces overfitting, making classifications more reliable.
4.3 Multiclass Confusion Matrix: You'll learn to evaluate multiclass classifiers using the confusion matrix. You'll interactively explore how to calculate True/False Positives/Negatives, Precision, Recall, and F1-Score for each class, and how to interpret these metrics when you're routing requests into multiple queues.
Algorithm Pseudocode
- ๐ K-Nearest Neighbors Pseudocode: Complete KNN algorithm with distance metrics, KD-tree optimization, and weighted voting.
- ๐ Naive Bayes Pseudocode: Gaussian, Multinomial, and Bernoulli variants with Laplace smoothing.
- ๐ Decision Trees Pseudocode: CART algorithm with Gini impurity, entropy criteria, and pruning techniques.
- ๐ Random Forests Pseudocode: Bagging, out-of-bag error estimation, and feature importance.
- ๐ Support Vector Machines Pseudocode: SMO algorithm, kernel functions, and the dual optimization problem.
Mathematical Foundations
- ๐ Evaluation Metrics Algebra: Formal derivations of confusion matrices, precision/recall variants, and multiclass ROC/AUC underpinning the evaluation dashboards discussed in the chapter.
- ๐ Naive Bayes Foundations: Bayesโ rule, smoothing strategies, and interpretability hooks that justify Almaโs confidence in the modelโs probabilistic reasoning.
Bibliography and Additional Resources
- ๐ K-NN and Decision Trees: Verified resources and references on classification algorithms, distance metrics, and interpretability.