-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Error with single_prediction function: Error in UseMethod("broken") #4
Comments
Try breakDown 1.4 from github |
Great, thank you. I now have breakDown 1.4 and get this error when I run
single_prediction() with an explainer created for a gbm model:
Error in paste("Using", n.trees, "trees...\n") :
argument "n.trees" is missing, with no default
The same error comes up if I set n.trees inside the single_prediction
function.
…On Tue, Feb 20, 2018 at 5:16 PM, Przemysław Biecek ***@***.*** > wrote:
Try breakDown 1.4 from github
https://github.com/pbiecek/breakDown
Version 1.3 supports only lm and glm model while 1.4 is model agnostic
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ARUTZj36WBo_GmXu8aCWDo0t52Ww_Ckqks5tW25pgaJpZM4SMe8o>
.
--
--
Katherine Ransom, PhD
Hydrologic Sciences, UC Davis
|
Would you provide the full example for gbm? Will be easier to debug |
Ok, I guess that your new observation is neither a data.frame nor matrix? |
Hi, The new observation is a data.frame. Below I made an example using the
wine data.
library(gbm)
library(DALEX)
library(breakDown)
# create a gbm model
model <- gbm(quality ~ pH + residual.sugar + sulphates + alcohol, data = wine,
distribution = "gaussian",
n.trees = 1000,
interaction.depth = 4,
shrinkage = 0.01,
n.minobsinnode = 10,
verbose = FALSE)
# make an explainer for the model
explainer_gbm <- explain(model, data = wine)
# create a new observation
new.wine <- data.frame(citric.acid = 0.35,
sulphates = 0.6,
alcohol = 12.5,
pH = 3.36,
residual.sugar = 4.8)
# single prediction explained, this gives the n.trees error
exp_sgn <- single_prediction(explainer_gbm, observation = new.wine)
#Error in paste("Using", n.trees, "trees...\n") :
# argument "n.trees" is missing, with no default
# try adding n.trees as an argument, gives same error
exp_sgn <- single_prediction(explainer_gbm, observation = new.wine,
n.trees = 1000)
#Error in paste("Using", n.trees, "trees...\n") :
# argument "n.trees" is missing, with no default
Session info:
sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel splines stats graphics grDevices utils
datasets methods base
other attached packages:
[1] breakDown_0.1.4 DALEX_0.1 gbm_2.1.3 lattice_0.20-35
survival_2.41-3 devtools_1.13.4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 magrittr_1.5 munsell_0.4.3
colorspace_1.3-2 R6_2.2.2 rlang_0.1.6
[7] httr_1.3.1 plyr_1.8.4 tools_3.4.3 ALEPlot_1.0
grid_3.4.3 yaImpute_1.0-29
[13] gtable_0.2.0 git2r_0.21.0 withr_2.1.1 yaml_2.1.16
lazyeval_0.2.1 digest_0.6.14
[19] tibble_1.4.1 pdp_0.6.0 Matrix_1.2-12 gridExtra_2.3
ggplot2_2.2.1 curl_3.1
[25] memoise_1.1.0 pillar_1.1.0 compiler_3.4.3 scales_0.5.0
On Tue, Feb 20, 2018 at 9:32 PM, Przemysław Biecek <notifications@github.com> wrote:
Ok, I guess that your new observation is neither a data.frame nor matrix?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ARUTZlJxvhIwy_GCYIF3gAMEfCQHnYwdks5tW6qKgaJpZM4SMe8o>
.
--
--
Katherine Ransom, PhD
Hydrologic Sciences, UC Davis
|
|
This fixes it, thank you. I will close the issue. |
If anyone still had troubles with the first error (even after updating breakDown) - check if you are using explain from DALEX or from dplyr. If the latter is the case, just use DALEX::explain. |
Thanks! Now I know what caused Błąd w poleceniu 'UseMethod("explain")': niestosowalna metoda dla 'explain' zastosowana do obiektu klasy "c('glm', 'lm')" ;-) |
When I try to run the vignette examples for the single_prediction() function I see the following error for the random forest model:
Error in UseMethod("broken") :
no applicable method for 'broken' applied to an object of class "c('randomForest.formula', 'randomForest')"
I have DALEX package version 0.1 and breakDown 0.1.3
The text was updated successfully, but these errors were encountered: