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

Double Values for Xgboost Explainer when trying to access the data #39

Open
kartik1611 opened this issue Sep 2, 2020 · 0 comments
Open

Comments

@kartik1611
Copy link

kartik1611 commented Sep 2, 2020

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

image

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

image

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.

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

1 participant