2
$\begingroup$

While implementing a gradient-boosted tree algorithm on a dataset, is it possible to learn the optimal value for a feature that best predicts a class?

For example: In the iris dataset, what is the value of sepal length that best predicts the species versicolor? When I run a single tree, I can see what value of sepal width the tree is splitting at at a given node, and what the probability of predicting a species is. How could I get this information when I run a model with 50 trees?

$\endgroup$
6
  • 2
    $\begingroup$ Even in the case of a single tree, it's not sufficient to partition on only one feature because each leaf is composed as a partition of several features in a particular order. All features on the path from leaf to root are involved. Even in a single tree, the same feature can be chosen as a split multiple times. Can you explain what problem you're trying to solve by identifying feature splits? $\endgroup$
    – Sycorax
    Commented Jan 14, 2020 at 17:46
  • $\begingroup$ Thanks for your reply. The problem that I am trying to solve is in medicine: given a set of covariates (systolic BP, gender, age, presence/absence of a number of diseases), can I use GBTs to understand if there is a specific value of systolic BP around which we can split patients into "higher" and "lower" risk of postoperative death (this being the outcome)? $\endgroup$
    – user3qpu
    Commented Jan 14, 2020 at 17:58
  • 4
    $\begingroup$ This will be a hard problem to solve using GBTs because they're not designed to solve that problem. Frank Harrell's Regression Modeling Strategies is full of recommendations about how to think about statistical models for medicine. $\endgroup$
    – Sycorax
    Commented Jan 14, 2020 at 18:03
  • 2
    $\begingroup$ @SycoraxsaysReinstateMonica: While RMS is a bible, it does not really cover GBMs (or boosting for that matter) at no point. The recommendations about GAMs are easily extendable to GBMs. $\endgroup$
    – usεr11852
    Commented Jan 21, 2020 at 2:06
  • $\begingroup$ @usεr11852saysReinstateMonic Yes, that's my point. $\endgroup$
    – Sycorax
    Commented Jan 21, 2020 at 2:26

1 Answer 1

3
$\begingroup$

Part of what you want can be achieved through the use of partial-dependence plots (PDP) for the "important" features $x_A, \dots, x_Z$ used within the model $M$. Partial dependence plots show the average relationship between a given feature $x_A$ and the response $y$ within the fixed, joint distribution of all the other inputs $x_B, \dots, x_Z$. Particularly for a probability estimation task as the one described one can plot in each case how the final probability of death is affected. (eg. "values of systolic BP above a threshold $z$ are associated with approximately $0.40$ probability of death while below are generally $0.15$", etc.) It is notable thought that the idea of a dichotomising a continious variable is very often problematic. I would suggest presenting the whole range of a feature to describe its association with the response variable rather than focusing on a potentially arbitrary threshold.

Here is an image from the Partial Dependence Plot (PDP) of the excellent Interpretable Machine Learning e-book by C. Molnar showing what I describe above:

enter image description here

Note that what is an "important feature" is a bit of a "how long is a piece of string" question itself; feature importance in a GBDT can be defined with multiple ways (e.g. how many times a feature is used for splitting, what is the average cost reduction observed after splitting that feature, what is the mean SHAP value associated with that feature, what is the feature's permutation importance, etc. etc.)

Both R and Python has a number of partial dependence plot functionality. R has two great packages on that matter pdp and iml. Python has package like pdpBOX but actually since version 0.22 sklearn also supports PDPs.

Anecdotal note: I have found the insights of PDPs to be quite close to those I would get from GAMs. This is not very surprising as the use of a "penalised spline" to encapsulate non-linear relations between an explanatory variable and mean response of an outcome is what both models try to achieve. In the case of a GBDT, the spline is iteratively approximated by step functions, while in the case of GAM, the spline is directly modelled subject to some penalisation by continuity and smoothness penalties.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.