⚡ Naive Bayes for Emergency Triage

In chapter 4 the Minermont team wants a system that suggests the urgency level of each emergency patient, from 1 (red) to 5 (blue), always as a support for the triage nurse. This notebook follows Martha's notes (section 4.5) on the Naive Bayes classifier: it implements it by hand, compares it with scikit-learn and shows where its naive assumption helps and where it hurts.

The interactive notebook includes:

  • Bayes' theorem, the prior, the likelihood and the naive independence assumption.
  • A prediction worked out by hand from two symptoms.
  • Gaussian Naive Bayes by hand, with logarithms, and why a bell curve fails for yes/no symptoms.
  • Naive Bayes by counting frequencies, with vital signs cut into intervals and Laplace smoothing, checked against CategoricalNB.
  • What happens when the same evidence is counted several times: an overconfident model.
  • Final evaluation with the confusion matrix and per-class metrics.

Want to modify the code and experiment on your own?
Open the notebook in Google Colab

Bibliography