15Implement precision, recall, F1, and a confusion matrix from raw predictions in NumPy.▼mediumAmazonMetaGoogle1 replies○ sign inA common ML-coding check that confirms you actually understand the metrics you quote. The signal is getting TP/FP/FN/TN right and knowing macro vs micro averaging for multiclass, not reaching for sklearn.Open full answer →
52Implement a precision-recall (or ROC) curve and AUC from scores and labels.▼mediumAmazonGoogleMeta2 replies◆ premiumBuilding a PR/ROC curve from scratch shows you understand thresholds and the precision/recall tradeoff. What interviewers really want is sweeping the threshold in one sorted pass and integrating the area. The implementation follows.Open full answer →
137Write a prompt-injection detector and evaluate it on an adversarial set.▼mediumAnthropicOpenAIMicrosoft◆ premiumWriting the regexes takes ten minutes. The half of the question that separates candidates is the evaluation: a detector that blocks 'ignore the noise in the data' has shipped a bug to every analyst using your product. Here is the layered detector and the harness that proves it works.Open full answer →
03Define precision, recall, F1, and AUC, and give a case where each (and accuracy) is misleading.▼medium★ EssentialAmazonMetaGoogle2 repliesunlockedThe interviewer wants to see whether you choose metrics to fit the problem or just recite definitions. The signal that counts is recognizing when accuracy and even AUC mislead, and linking each metric to a decision.Open full answer →
83Your classifier outputs probabilities, but you need a decision. How do you pick the threshold (it's rarely 0.5)?▼mediumAmazonStripeMeta1 replies◆ premiumDefaulting to 0.5 leaves money or safety on the table. The right cutoff comes from the cost of each error and the operating constraint, not the model. Here is how to set it deliberately.Open full answer →
07Design a real-time content moderation system for text and images at platform scale.▼hardMetaGoogleMicrosoft1 repliesunlockedModeration is a multi-stage classification problem with harsh tradeoffs: false negatives cause real harm, false positives silence legitimate users, and the adversary keeps adapting. What interviewers reward: the tiered pipeline, per-severity precision/recall calibration, and human-in-the-loop. This lays out the design.Open full answer →