Double Values for Xgboost Explainer when trying to access the data
kartik1611 opened this issue · comments
I am using data(HR_data) and trying to access important variable for the 90 value of the test set , when I run the below code
showWaterfall(xgb.fit, explainer, xgb.test, test.data,90, type = "binary")
I am getting below o/p
when I assign the above code to a variable result_summary and access the values
result_summary<-showWaterfall(xgb.fit, explainer, xgb.test, test.data,90, type = "binary") result_summary$data
I am getting twice all the variable names with different values when using result_summary$data , I would like to know how to access the value and which one to refer's , I am assuming y column correspond to the values
seems like getting different results, I would appreciate if you can tell how to get the values of all the attributes as it is confusing to me as plot shows different value and while accessing the results_summary$data is showing different values and all variables are repeated twice
I need to access contribution values for the plot generated for each attribute in a dataframe but not able to retrieve those
which is satisfaction_level 0.09733194
number_project-0.01980737
in a dataframe
dput(results_summary$data) is below
#######################################################################
`
structure(list(x = structure(c(1L, 4L, 2L, 3L, 1L, 4L, 2L, 3L
), .Label = c("intercept", "number_project = 5", "Prediction",
"satisfaction_level = 0.11"), class = "factor"), y = c(0, -0.026559082005109,
0.0707728563440244, -0.026559082005109, 0.0707728563440244, 0.05096548367,
0.0707728563440244, 0.05096548367)), class = "data.frame", row.names = c(NA,
-8L))
`
#########################################################################
structure for the entire result summary is
dput(result_summary)
##############################################################
structure(list(data = structure(list(x = structure(c(1L, 4L, 2L, 3L, 1L, 4L, 2L, 3L), .Label = c("intercept", "number_project = 5", "Prediction", "satisfaction_level = 0.11"), class = "factor"), y = c(0, -0.026559082005109, 0.0707728563440244, -0.026559082005109, 0.0707728563440244, 0.05096548367, 0.0707728563440244, 0.05096548367 )), class = "data.frame", row.names = c(NA, -8L)), layers = list( <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>, <environment>), scales = <environment>, mapping = structure(list( x = ~x, y = ~y), class = "uneval"), theme = structure(list( axis.title = structure(list(), class = c("element_blank", "element")), axis.text.x = structure(list(family = NULL, face = NULL, colour = NULL, size = NULL, hjust = 1, vjust = 1, angle = 45, lineheight = NULL, margin = structure(c(2.2, 0, 0, 0), class = c("margin", "unit"), valid.unit = 8L, unit = "pt"), debug = NULL, inherit.blank = FALSE), class = c("element_text", "element"))), class = c("theme", "gg"), complete = FALSE, validate = FALSE), coordinates = <environment>, facet = <environment>, plot_env = <environment>, labels = list(x = "x", y = "y", yintercept = "yintercept", xmin = "xmin", xmax = "xmax", ymin = "ymin", ymax = "ymax", xend = "xend", yend = "yend")), class = c("gg", "ggplot" ))
Not sure which values to use as there are repeated variables, I just need to access the data values but not sure why I am getting two different value which is different from the plot.