Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences between performance metrics between ranger model and its explain #561

Closed
ManuelSpinola opened this issue Mar 5, 2024 · 2 comments

Comments

@ManuelSpinola
Copy link

I see there are differences for the metrics performance between a ranger model and its explain. Why is that?

aps_ranger <- ranger::ranger(m2.price~., data = apartments, num.trees = 50)

aps_ranger
Ranger result

Call:
ranger::ranger(m2.price ~ ., data = apartments, num.trees = 50)

Type: Regression
Number of trees: 50
Sample size: 1000
Number of independent variables: 5
Mtry: 2
Target node size: 5
Variable importance mode: none
Splitrule: variance
OOB prediction error (MSE): 93997.56
R squared (OOB): 0.8856602

exp_ranger <- explain(aps_ranger, data = apartments, y = apartments$m2.price)

mod_per <- model_performance(exp_ranger)

mod_per
Measures for: regression
mse : 21442.99
rmse : 146.4342
r2 : 0.9738904
mad : 84.57676

Residuals:
0% 10% 20% 30%
-491.535000 -160.125376 -109.455093 -75.266200
40% 50% 60% 70%
-43.538133 -20.939611 8.850819 47.124000
80% 90% 100%
97.417832 197.996033 759.546667

@mayer79
Copy link

mayer79 commented Mar 5, 2024

The metrics of ranger are calculated from out-of-bag predictions, those of DALEX on the data provided.

Note that it basically never makes sense to study random forest performance (non-oob) on the training data except to demonstrate its massive overfit.

@ManuelSpinola
Copy link
Author

ManuelSpinola commented Mar 5, 2024 via email

@mayer79 mayer79 closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants