bgreenwell / pdp

A general framework for constructing partial dependence (i.e., marginal effect) plots from various types machine learning models in R.
http://bgreenwell.github.io/pdp
91 stars 12 forks source link

plots differ based on algorithm #131

Closed wisamb closed 1 year ago

wisamb commented 1 year ago

Can you tell me why I get the first plot from pdp::partial from a random forest algorithm (either randomForest or ranger package)? Rather than the second plot, which I get running the same code, same data but using an xgboost? How can I get the second plot using the either randomForest or ranger package?

Capture 2

bgreenwell commented 1 year ago

Hi @wisamb i suspect it’s because the variable I question is treated as factor in the random forest but numeric (as all inputs) in xgboost, and the plotting behavior depends on the feature types.

wisamb commented 1 year ago

Thank you @bgreenwell! That was exactly it.