ModelOriented / forester

Trees are all you need
https://modeloriented.github.io/forester/
GNU General Public License v3.0
108 stars 14 forks source link

Problem with report function - 'cannot xtfrm data frames' #122

Closed wkedziora closed 5 months ago

wkedziora commented 6 months ago

I have recently tried to run code from https://medium.com/responsibleml/forester-predicting-house-prices-use-case-b537253b6142 about prices of accommodation in Lisbon. It runs smoothly up to this code:

library('DALEX')
ex <- forester::explain(models    = output_2$best_models[[1]],
                        test_data = output_2$test_data,
                        y         = output_2$y)

model_parts <- DALEX::model_parts(ex$xgboost_bayes)
plot(model_parts, max_vars = 5)

When afterwards i try this: report(output_2)

I get this error:

processing file: report_regression.Rmd
  |...........................                                                                     |  29% [table]                             
Quitting from lines 42-57 [table] (report_regression.Rmd)
Error in `xtfrm.data.frame()`:
! cannot xtfrm data frames
Backtrace:
 1. score_rounded[order(score_rounded["rmse"]), ]
 3. base::order(score_rounded["rmse"])
 4. base::lapply(z, function(x) if (is.object(x)) as.vector(xtfrm(x)) else x)
 5. base (local) FUN(X[[i]], ...)
 8. base::xtfrm.data.frame(x)

I have updated R and all packages as well as tried those options: https://github.com/ModelOriented/forester/issues/116

What might be the issue?

HubertR21 commented 5 months ago

Hi, thank you for the issue, and I'm sorry for a long time reply time.

The error was due to the fact, that the order function changed the way it works in recent R versions, and it resulted in such bug. We've already improved it in recent update to version 1.4.2.