Designing a Bayesian Classifier for Case Analysis
Company: Amazon
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Onsite
# Designing a Bayesian Classifier for Case Analysis
The preserved interview report says only that a Bayesian classifier was implemented and then exercised on different cases. For this practice discussion, explicitly assume a binary decision with labeled historical examples, sometimes-missing evidence, changeable priors, and unequal error costs. These are working assumptions for the exercise, not facts supplied by the source. Explain how the classifier is estimated, how a posterior becomes a decision, and how you would detect failed assumptions.
### Constraints & Assumptions
- The practice target is binary and its labels may be imbalanced.
- Features may be categorical or discretized numeric observations.
- Missingness is not automatically uninformative; state whether the fact that a feature is absent carries evidence.
- False positives and false negatives may have different costs.
- Do not assume conditional independence without stating and testing it.
### Clarifying Questions to Ask
- What inputs, labels, and outputs did the original exercise define?
- Is the required output a calibrated probability, a class label, or both?
- Which error is more costly, and may the threshold vary by case?
- Can priors or missingness patterns change between training and deployment?
### Part 1 — Model and estimation
Describe the prior, likelihood, posterior, smoothing, and any conditional-independence assumption used in the practice model.
#### What This Part Should Cover
- A mathematically correct application of Bayes' rule
- A defensible likelihood model for each stated feature type
- Smoothing for unseen values
- An explicit treatment of informative versus uninformative missingness
### Part 2 — Decisions for changing cases
Explain how a changed prior, stronger or contradictory evidence, missing evidence, and asymmetric error costs affect the posterior or decision threshold.
#### What This Part Should Cover
- Posterior odds or log-odds reasoning
- Evidence that raises or lowers the score
- Cost-sensitive threshold selection
- Separation of estimated probability from the final action
### Part 3 — Validation and failure analysis
Propose checks for discrimination, calibration, drift, and violations of the chosen likelihood assumptions.
#### What This Part Should Cover
- Metrics appropriate for imbalance and decision cost
- Calibration diagnostics rather than accuracy alone
- Slice analysis for correlated features and missingness patterns
- Monitoring for prior and likelihood drift
```hint Separate preserved facts from practice assumptions
State the model and missingness assumptions first, derive the posterior second, and apply a decision threshold only after the probability is available.
```
### What a Strong Answer Covers
- A source-bounded explanation that labels every added case dimension as an assumption
- A coherent chain from data assumptions to posterior probabilities and decisions
- Correct handling of unseen values and informative missingness
- Evaluation that includes calibration, operating points, and deployment drift
### Follow-up Questions
1. How would you update predictions if the deployment prior changes but class-conditional likelihoods remain stable?
2. What symptoms suggest correlated features are being double-counted?
3. How would you model the fact that a feature is missing when missingness itself predicts the class?
Overview: Practice source-bounded Bayesian classifier reasoning by stating assumptions, modeling informative missingness, updating priors, and validating calibration.