Skip to content

Commit

Permalink
Remove comments and add note to README
Browse files Browse the repository at this point in the history
  • Loading branch information
nredell committed Jan 3, 2020
1 parent b3e697b commit 98981c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 2 additions & 0 deletions R/shapFlex.R
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ shapFlex <- function(explain, reference = NULL, model, predict_function, target_
# a single data.frame for the user-defined predict() function.
data_predict <- dplyr::bind_rows(data_sample)

#data_predict <- dplyr::filter(data_predict, index == 1 & causal == 1)

# shapFlex internal function to compute the final symmetric and/or asymmetric Shapley values.
data_shap <- predict_shapFlex(
reference = reference, # input arg.
Expand Down
11 changes: 1 addition & 10 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ predict_shapFlex <- function(reference, data_predict, model, predict_function,
# Returns a length 1 numeric vector of the average prediction--i.e., intercept--from the reference group.
intercept <- mean(predict_function(model, reference)[, 1], na.rm = TRUE)
#--------------------------------------------------------------------------
# Return the sampling predictions if requested by the user.
# if (isTRUE(keep_samples)) {
#
# data_predicted <- dplyr::bind_cols(data_predict, data_predicted)
#
# } else {
#
# data_predicted <- dplyr::bind_cols(data_meta, data_predicted)
# }
#--------------------------------------------------------------------------
# Cast the data.frame to, for each random sample, take the difference between the Frankenstein
# instances which are now in six columns: two for symmetric and four for asymmetric.
user_fun_y_pred_name <- names(data_predicted)[ncol(data_predicted)]
Expand Down Expand Up @@ -86,6 +76,7 @@ predict_shapFlex <- function(reference, data_predict, model, predict_function,
stats::weighted.mean(data_shap_asym[i, c("shap_u_2_12", "shap_u_2_21")], c(data_shap_asym$weight_12[i], data_shap_asym$weight_21[i]), na.rm = TRUE)
}))

#data_shap_asym$shap_effect <- shap_u_2
# Shapley value for each Monte Carlo sample for each instance.
data_causal$shap_effect <- shap_u_2
} # End asymmetric causal Shapley value calculations per Monte Carlo sample.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[![Travis Build Status](https://travis-ci.org/nredell/shapFlex.svg?branch=master)](https://travis-ci.org/nredell/shapFlex)

# package::shapFlex <img src="./tools/shapFlex_logo.png" alt="shapFlex logo" align="right" height="138.5" style="display: inline-block;">

**THIS PACKAGE IS UNDERGOING AN ACTIVE REWRITE. I'LL REMOVE THIS NOTE WHEN IT'S TESTED AND 100% WORKING AGAIN.**

The purpose of `shapFlex`, short for Shapley flexibility, is to compute stochastic feature-level Shapley values which
can be used to (a) interpret and/or (b) assess the fairness of any machine learning model while
Expand Down

0 comments on commit 98981c6

Please sign in to comment.