Skip to content

Commit

Permalink
Fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maurever committed Sep 21, 2023
1 parent b490cfa commit 821cb4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void initActualParamValues() {
}

@Override
public ModelMojoWriter getMojo() {
public UpliftDrfMojoWriter getMojo() {
return new UpliftDrfMojoWriter(this);
}

Expand Down
8 changes: 3 additions & 5 deletions h2o-py/h2o/model/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,16 +480,14 @@ def model_performance(self, test_data=None, train=False, valid=False, xval=False
If type is ``"auto"`` or ``"none"``, AUC and AUCPR are not calculated.
:param String auuc_type: Change default AUUC type for uplift binomial classification AUUC calculation
when ``test_data`` is not None. One of:
- ``"AUTO"`` (default)
when ``test_data`` is not None. One of:
- ``"AUTO"``
- ``"qini"``
- ``"lift"``
- ``"gain"``
- None (default)
If type is ``"auto"`` ("qini"), AUUC is calculated.
:param int auuc_nbins: Number of bins for calculation AUUC. Defaults to ``-1``, which means 1000.
:param list float: List of custom thresholds to calculate AUUC when ``test_data`` is not None. Defaults None.
:returns: An instance of :class:`~h2o.model.metrics_base.MetricsBase` or one of its subclass.
"""

Expand Down
10 changes: 6 additions & 4 deletions h2o-r/h2o-package/R/models.R
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ h2o.feature_frequencies <- feature_frequencies.H2OModel
#' @param data (DEPRECATED) An H2OFrame. This argument is now called `newdata`.
#' @param auc_type For multinomila model only. Set default multinomial AUC type. Must be one of: "AUTO", "NONE", "MACRO_OVR", "WEIGHTED_OVR", "MACRO_OVO",
#' "WEIGHTED_OVO". Default is "NONE"
#' @param auuc_type For binomial model only. Set default AUUC type. Must be one of: "AUTO", "GINI", "GAIN", "LIFT". Default is NULL.
#' @return Returns an object of the \linkS4class{H2OModelMetrics} subclass.
#' @examples
#' \dontrun{
Expand All @@ -1039,7 +1040,7 @@ h2o.feature_frequencies <- feature_frequencies.H2OModel
#' h2o.performance(model = prostate_gbm_balanced, train = TRUE)
#' }
#' @export
h2o.performance <- function(model, newdata=NULL, train=FALSE, valid=FALSE, xval=FALSE, data=NULL, auc_type="NONE", auuc_type="NONE") {
h2o.performance <- function(model, newdata=NULL, train=FALSE, valid=FALSE, xval=FALSE, data=NULL, auc_type="NONE", auuc_type=NULL) {

# data is now deprecated and the new arg name is newdata
if (!is.null(data)) {
Expand All @@ -1056,12 +1057,13 @@ h2o.performance <- function(model, newdata=NULL, train=FALSE, valid=FALSE, xval=
if(!is.logical(xval) || length(xval) != 1L || is.na(xval)) stop("`xval` must be TRUE or FALSE")
if(sum(valid, xval, train) > 1) stop("only one of `train`, `valid`, and `xval` can be TRUE")
if(!(auc_type %in% c("AUTO", "NONE", "MACRO_OVR", "WEIGHTED_OVR", "MACRO_OVO", "WEIGHTED_OVO"))) stop("`auc_type` must be \"AUTO\", \"NONE\", \"MACRO_OVR\", \"WEIGHTED_OVR\", \"MACRO_OVO\", or \"WEIGHTED_OVO\".")
if(!is.null(auuc_type) && !(auuc_type %in% c("AUTO", "GINI", "LIFT", "GAIN"))) stop("`auuc_type` must be \"AUTO\", \"GINI\", \"LIFT\" or \"GAIN\"." )

missingNewdata <- missing(newdata) || is.null(newdata)
if( missingNewdata && auc_type != "NONE") {
print("WARNING: The `auc_type` parameter is set but it is not used because the `newdata` parameter is NULL.")
}
if( missingNewdata && auuc_type != "NONE") {
if( missingNewdata && !is.null(auuc_type)) {
print("WARNING: The `auuc_type` parameter is set but it is not used because the `newdata` parameter is NULL.")
}
if( !missingNewdata ) {
Expand All @@ -1078,9 +1080,9 @@ h2o.performance <- function(model, newdata=NULL, train=FALSE, valid=FALSE, xval=
} else if(!is.null(model@parameters$auc_type) && model@parameters$auc_type != "NONE"){
parms[["auc_type"]] <- model@parameters$auc_type
}
if(auc_type != "NONE"){
if(!is.null(auuc_type)){
parms[["auuc_type"]] <- auuc_type
} else if(!is.null(model@parameters$auuc_type) && model@parameters$auuc_type != "NONE"){
} else if(!is.null(model@parameters$auuc_type) && !is.null(model@parameters$auuc_type)){
parms[["auuc_type"]] <- model@parameters$auuc_type
}
res <- .h2o.__remoteSend(method = "POST", .h2o.__MODEL_METRICS(model@model_id, newdata.id), .params = parms)
Expand Down

0 comments on commit 821cb4e

Please sign in to comment.