From 6475d3233dce36d109b4b8c07c1710a76425c9ba Mon Sep 17 00:00:00 2001 From: Veronika Maurerova Date: Wed, 16 Aug 2023 18:28:20 +0200 Subject: [PATCH] implement review sugestions, fix R print model --- h2o-docs/src/product/data-science/upliftdrf.rst | 4 ++-- h2o-r/h2o-package/R/classes.R | 3 +++ h2o-r/tests/testdir_algos/uplift/runit_uplift_smoke.R | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/h2o-docs/src/product/data-science/upliftdrf.rst b/h2o-docs/src/product/data-science/upliftdrf.rst index ed63b2722b1a..ec2e3a5f000e 100644 --- a/h2o-docs/src/product/data-science/upliftdrf.rst +++ b/h2o-docs/src/product/data-science/upliftdrf.rst @@ -255,10 +255,10 @@ Overall treatment effect metrics show how the uplift predictions look across the The interpretation depends on concrete data meanings. We currently support only Bernoulli data distribution, so whether the treatment impacts the target value y=1 or not. -For example, we analyze data to determine if some medical help to recover from disease or not. We have patients in the treatment group and the control group. The target variable is if the medicine (treatment) helped recovery (y=1) or not (y=0). In this case: +For example, we want to analyze data to determine if some medical will help to recover from a disease or not. We have patients in the treatment group and the control group. The target variable is if the medicine (treatment) helped recovery (y=1) or not (y=0). In this case: - positive ATE means the medicine helps with recovery in general - negative ATE means the medicine does not help with recovery in general -- ATE equal or similar to zero means the medicine does not affect recovery in general +- ATE equal to or close to zero means the medicine does not affect recovery in general - similar interpretation applies to ATT and ATC, the positive ATT is usually what scientists look for, but ATC is also an interesting metric (in an ideal case, positive both ATT and ATC say the treatment has an exact effect). Custom metric example for Uplift DRF diff --git a/h2o-r/h2o-package/R/classes.R b/h2o-r/h2o-package/R/classes.R index 78348c0ea5f8..f52ea4c5e0f8 100755 --- a/h2o-r/h2o-package/R/classes.R +++ b/h2o-r/h2o-package/R/classes.R @@ -672,6 +672,9 @@ setClass("H2OBinomialUpliftMetrics", contains="H2OModelMetrics") #' @export setMethod("show", "H2OBinomialUpliftMetrics", function(object) { callNextMethod(object) # call to the super + cat("ATE: ", object@metrics$ate, "\n", sep="" ) + cat("ATT: ", object@metrics$atc, "\n", sep="" ) + cat("ATC: ", object@metrics$att, "\n", sep="" ) cat("Default AUUC: ", object@metrics$AUUC, "\n", sep="") cat("All types of AUUC: ", "\n", sep="") print(object@metrics$auuc_table) diff --git a/h2o-r/tests/testdir_algos/uplift/runit_uplift_smoke.R b/h2o-r/tests/testdir_algos/uplift/runit_uplift_smoke.R index 1bd30485a5ec..97519196601a 100644 --- a/h2o-r/tests/testdir_algos/uplift/runit_uplift_smoke.R +++ b/h2o-r/tests/testdir_algos/uplift/runit_uplift_smoke.R @@ -55,6 +55,8 @@ test.uplift <- function() { min_rows = 10, nbins = 100, seed = seed) + + print(model) # test model metrics print("Test model metrics")