This report aims to present the capabilities of the package fscaret
.
The document is a part of the paper “Landscape of R packages for eXplainable Machine Learning”, S. Maksymiuk, A. Gosiewska, and P. Biecek. (https://arxiv.org/abs/2009.13248). It contains a real life use-case with a hand of titanic_imputed data set described in Section Example gallery for XAI packages of the article.
We did our best to show the entire range of the implemented explanations. Please note that the examples may be incomplete. If you think something is missing, feel free to make a pull request at the GitHub repository MI2DataLab/XAI-tools.
The list of use-cases for all packages included in the article is here.
Load titanic_imputed
data set.
data(titanic_imputed, package = "DALEX")
head(titanic_imputed)
## gender age class embarked fare sibsp parch survived
## 1 male 42 3rd Southampton 7.11 0 0 0
## 2 male 13 3rd Southampton 20.05 0 2 0
## 3 male 16 3rd Southampton 20.05 1 1 0
## 4 female 39 3rd Southampton 20.05 1 1 1
## 5 female 16 3rd Southampton 7.13 0 0 1
## 6 male 25 3rd Southampton 7.13 0 0 1
library(fscaret)
explanation <- fscaret(titanic_imputed, titanic_imputed, preprocessData=FALSE,
with.labels=TRUE, classPred=TRUE, regPred=FALSE,
Used.funcClassPred=c("rf"), supress.output=TRUE, no.cores=1, saveModel = TRUE,
installReqPckg =TRUE)
##
## ----Loading required packages----
##
##
## ----Packages loaded successfully----
##
##
## -----Warnings have been supressed!----
## ----------------------------------------
## Calculating: rf
## ----------------------------------------
## ----------------------------------------
## rf
## ----------------------------------------
## Elapsed time: 63.42 1.78 65.7 NA NA
## Variable importance has been calculated!
## [1] "RData and VarImp.txt files exists!"
## [1] "Variable importance:"
## rf variable importance
##
## Overall
## gender 100.0000
## fare 48.1278
## age 42.5961
## class 42.0939
## sibsp 0.9127
## embarked 0.3784
## parch 0.0000
##
## ----Processing files:----
## [1] "7in_default_CLASSControl_rf.RData"
## [1] ""
## [1] "Calculating error measure for model:"
## [1] "7in_default_CLASSControl_rf.RData"
## [1] ""
##
## ----Processing files:----
## [1] "7in_default_CLASSControl_VarImp_rf.txt"
barplot(height = explanation$ModelPred$rf$importance$Overall, names.arg = row.names(explanation$ModelPred$rf$importance))
sessionInfo()
## R version 3.6.1 (2019-07-05)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 18362)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=Polish_Poland.1250 LC_CTYPE=Polish_Poland.1250
## [3] LC_MONETARY=Polish_Poland.1250 LC_NUMERIC=C
## [5] LC_TIME=Polish_Poland.1250
##
## attached base packages:
## [1] parallel stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] MASS_7.3-51.6 R.utils_2.9.2 R.oo_1.23.0 R.methodsS3_1.8.0
## [5] fscaret_0.9.4.4 hmeasure_1.0-2 gsubfn_0.7 proto_1.0.0
## [9] caret_6.0-85 ggplot2_3.3.2 lattice_0.20-40
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.0.0 xfun_0.12 purrr_0.3.3
## [4] reshape2_1.4.3 splines_3.6.1 tcltk_3.6.1
## [7] colorspace_1.4-1 vctrs_0.3.1 generics_0.0.2
## [10] stats4_3.6.1 htmltools_0.4.0 yaml_2.2.1
## [13] survival_3.1-11 prodlim_2019.11.13 rlang_0.4.6
## [16] e1071_1.7-3 ModelMetrics_1.2.2.2 pillar_1.4.4
## [19] glue_1.4.1 withr_2.2.0 foreach_1.4.8
## [22] lifecycle_0.2.0 plyr_1.8.6 lava_1.6.7
## [25] stringr_1.4.0 timeDate_3043.102 munsell_0.5.0
## [28] gtable_0.3.0 recipes_0.1.10 codetools_0.2-16
## [31] evaluate_0.14 knitr_1.28 class_7.3-15
## [34] Rcpp_1.0.4.6 scales_1.1.1 ipred_0.9-9
## [37] digest_0.6.25 stringi_1.4.6 dplyr_0.8.5
## [40] grid_3.6.1 tools_3.6.1 magrittr_1.5
## [43] tibble_3.0.1 randomForest_4.6-14 crayon_1.3.4
## [46] pkgconfig_2.0.3 ellipsis_0.3.1 Matrix_1.2-18
## [49] data.table_1.12.8 pROC_1.16.1 lubridate_1.7.4
## [52] gower_0.2.1 assertthat_0.2.1 rmarkdown_2.1
## [55] iterators_1.0.12 R6_2.4.1 rpart_4.1-15
## [58] nnet_7.3-12 nlme_3.1-140 compiler_3.6.1