← Apple Interview Insights

Apple·Data Scientist·Technical Phone Screen·Senior

Senior
May 2026

Summary

Apple DS interview that was basically one long case study on fraud detection modeling. Technically dense, covered everything from confusion matrix math to threshold derivation to online experiment design. Left feeling like I'd been put through a blender.

Questions Asked (4)

Q1

Given a fraud detection model with a 0.7% base rate and specific cost parameters (flagging costs $3, friction on legit order costs $1, missed fraud costs $120), compute precision, recall, F1, and expected cost per order for two models at threshold 0.5. Which model is better under these costs?

Product Analytics & MetricsTechnical Trade-offs
Author's notes

The metrics part was fine, I can do confusion matrix math in my sleep.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the confusion matrix for each model at threshold 0.5, then compute precision, recall, and F1 from those counts. Finally, calculate expected cost per order using the given cost parameters and compare the models to determine which minimizes cost.

Pro tip: Always tie the metric back to the business cost: a model with lower F1 might still be better if it reduces expensive false negatives. Emphasize that the optimal threshold depends on the cost ratio, not just model performance.

1. Understand the base rate and cost parameters

Note that the base rate is 0.7%, meaning 0.7% of orders are fraudulent. List the costs: flagging a transaction costs $3, friction on a legitimate flagged order costs $1, and a missed fraud costs $120.

2. Construct confusion matrices for both models

Assume you have the number of true positives, false positives, false negatives, and true negatives for each model at threshold 0.5. If not given, state that you would need these counts to proceed.

3. Compute precision, recall, and F1 for each model

Precision = TP / (TP + FP), Recall = TP / (TP + FN), F1 = 2 * (Precision * Recall) / (Precision + Recall). Calculate these for both models.

4. Calculate expected cost per order for each model

Expected cost = (FP * ($3 + $1)) + (FN * $120) divided by total number of orders. Alternatively, per order: (FP/N)*$4 + (FN/N)*$120. Compare the costs.

5. Determine which model is better and discuss trade-offs

The model with lower expected cost per order is better under these costs. Discuss how changing costs or threshold would affect the decision.

Key Points to Mention

  • The base rate is very low (0.7%), so accuracy is misleading; precision and recall are more informative.
  • Cost-sensitive evaluation: the asymmetric costs ($120 for missed fraud vs. $4 for false positive) heavily penalize false negatives.
  • Expected cost per order is the key business metric; it directly reflects the financial impact.
  • Threshold 0.5 may not be optimal; the optimal threshold depends on the cost ratio and can be found by minimizing expected cost.
  • F1 assumes equal weight for precision and recall, which may not align with business costs; thus, F1 alone is insufficient.
  • Always validate assumptions about the confusion matrix and ensure the model outputs are calibrated if using threshold 0.5.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Derive the cost-optimal classification threshold as a general function of calibrated posterior probability and the cost matrix. Then apply it to this specific fraud scenario assuming perfect calibration.

Technical Trade-offsData Modeling
Author's notes

This is the part I was least prepared for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by formally defining the expected cost as a function of the threshold, then minimize it to derive the optimal decision rule: predict positive when the posterior probability exceeds a threshold that depends on the cost matrix. Apply the derived formula to the fraud scenario by plugging in the given costs and calibrated probabilities, and discuss practical implications.

Pro tip: Emphasize that the optimal threshold is independent of the model's calibration as long as probabilities are calibrated; if not, you must recalibrate first. Also, mention that in practice, costs may be asymmetric and unknown, so sensitivity analysis is crucial.

1. Define the cost structure

Let C_FP be the cost of a false positive and C_FN be the cost of a false negative. Assume correct predictions incur zero cost. The expected cost for a given instance with posterior probability p is: E[cost] = p * C_FN * I(predict negative) + (1-p) * C_FP * I(predict positive).

2. Derive the optimal decision rule

Minimize expected cost by predicting positive when p * C_FN > (1-p) * C_FP, which simplifies to p > C_FP / (C_FP + C_FN). Thus the optimal threshold is t* = C_FP / (C_FP + C_FN).

3. Apply to the fraud scenario

Assume perfect calibration, so p is the true probability of fraud. Plug in the specific costs: if a false negative (missed fraud) costs $1000 and a false positive (blocked legitimate transaction) costs $10, then t* = 10 / (10 + 1000) ≈ 0.0099. So flag as fraud if p > 0.0099.

4. Discuss practical considerations

Note that in reality, costs may vary per transaction, calibration may be imperfect, and the threshold may need to be adjusted for business constraints (e.g., limited review capacity). Also, mention that the threshold can be expressed in terms of odds: p/(1-p) > C_FP/C_FN.

Key Points to Mention

  • Bayes decision theory and expected cost minimization
  • The optimal threshold formula: t* = C_FP / (C_FP + C_FN)
  • Assumption of calibrated posterior probabilities
  • Asymmetric costs: false negatives often cost more than false positives in fraud detection
  • The threshold is independent of the model's discrimination ability (e.g., AUC) and depends only on costs and calibration
  • Practical challenges: estimating costs, handling varying costs, and recalibrating if probabilities are not well-calibrated

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Compare PR-AUC versus ROC-AUC for highly imbalanced classification problems. How do calibration metrics like Brier score and expected calibration error factor in, and what does decision curve analysis add?

Product Analytics & MetricsTechnical Trade-offs
Author's notes

Felt okay on PR-AUC vs ROC-AUC, that's a pretty standard imbalance discussion.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by contrasting PR-AUC and ROC-AUC in the context of class imbalance, emphasizing how PR-AUC focuses on the minority class and is more sensitive to false positives. Then explain how calibration metrics like Brier score and ECE assess the reliability of predicted probabilities, which is crucial when decisions depend on thresholds. Finally, introduce decision curve analysis as a method to evaluate clinical utility by weighing benefits and harms across different threshold probabilities.

Pro tip: Tie the discussion to Apple's product context by noting that in user-facing applications, well-calibrated probabilities and decision curves directly impact user experience and business metrics, showing you think beyond pure statistics.

1. Define the problem and metrics

Clarify that highly imbalanced classification means one class vastly outnumbers the other, and define PR-AUC and ROC-AUC, highlighting their different focuses.

2. Compare PR-AUC vs ROC-AUC

Explain that ROC-AUC can be overly optimistic because it incorporates true negatives, while PR-AUC emphasizes the minority class and is more informative when the positive class is rare.

3. Discuss calibration metrics

Describe Brier score as a measure of overall probability accuracy and ECE as a measure of calibration, noting that good discrimination (high AUC) does not guarantee good calibration.

4. Introduce decision curve analysis

Explain that DCA evaluates the net benefit of a model across different threshold probabilities, incorporating the consequences of false positives and false negatives, thus bridging statistical performance and real-world utility.

5. Synthesize and apply to context

Summarize how these metrics complement each other: PR-AUC for ranking in imbalanced settings, calibration for probability reliability, and DCA for decision-making; relate to the role and company context.

Key Points to Mention

  • ROC-AUC's insensitivity to class imbalance due to true negatives
  • PR-AUC's focus on the positive (minority) class and its sensitivity to false positives
  • Brier score as a proper scoring rule combining calibration and refinement
  • Expected Calibration Error (ECE) and its limitations (e.g., binning sensitivity)
  • Decision curve analysis and net benefit, incorporating threshold probabilities and clinical/utility implications
  • The importance of calibration in imbalanced settings where predicted probabilities inform decisions

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Design an offline evaluation plan that stays robust when fraud prevalence shifts, and describe a safe online A/B test with appropriate guardrails like manual review SLAs, false accusation rate caps, and drift holdouts. How would you monitor the model post-launch for concept drift and fairness across user segments?

A/B Testing & ExperimentationProduct Analytics & MetricsSystem Design
Author's notes

Honestly the most open-ended part and probably where I gave the weakest answer.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem around prevalence shift and its impact on precision, then propose an offline evaluation that uses prevalence-invariant metrics and reweighting. For online testing, describe a phased A/B test with guardrails like manual review SLAs and false accusation caps, and emphasize monitoring for drift and fairness post-launch.

Pro tip: Emphasize that offline metrics like precision are prevalence-sensitive, so use recall, AUC, and calibration instead; also highlight the importance of pre-registering guardrail thresholds to avoid p-hacking.

1. Offline Evaluation Robust to Prevalence Shift

Use prevalence-invariant metrics (e.g., recall, AUC, calibration) and simulate prevalence shifts via importance weighting or stratified sampling. Report performance across a range of prevalences to ensure robustness.

2. Design Safe Online A/B Test

Propose a phased rollout with a small treatment group, pre-defined guardrails (e.g., manual review SLA < 24h, false accusation rate < 0.1%), and automatic stopping rules if guardrails are breached.

3. Incorporate Drift Holdouts and Fairness Checks

Include a holdout set that is not used for training and monitor for concept drift by comparing model predictions to ground truth over time. Evaluate fairness metrics (e.g., demographic parity, equal opportunity) across user segments.

4. Post-Launch Monitoring Plan

Set up dashboards to track model performance, drift detection (e.g., PSI, KL divergence), and fairness metrics. Define alert thresholds and a process for retraining or rollback.

Key Points to Mention

  • Prevalence-invariant metrics like recall, AUC, and calibration
  • Importance weighting to simulate prevalence shifts
  • Guardrails: manual review SLA, false accusation rate cap
  • Drift holdouts and concept drift detection methods
  • Fairness metrics across user segments (e.g., demographic parity, equal opportunity)
  • Pre-registration of guardrail thresholds and stopping rules

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.