Tree SHAP: Exact Feature Attribution - Quant Researcher Interview Question
Difficulty: Hard
Category: machine_learning
Asked at: D.E. Shaw, Citadel, Two Sigma, AQR Capital Management, G-Research
Topics: shap, feature_importance, decision_trees, recursion, combinatorics
Problem Description
SHAP (SHapley Additive exPlanations) values provide a unified measure of feature importance by attributing a model's prediction to individual features based on cooperative game theory. Tree SHAP efficiently computes these values for decision trees by estimating conditional expectations directly from the tree structure rather than simulating data.
Task
Implement a function solution(tree, x) that calculates the exact SHAP values for a given decision tree and an input feature vector x. The calcula
Practice this hard researcher interview question on MyntBit - the LeetCode for quants with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.