Skip to content

Commit

Permalink
GH-16026: remove custom_metric_func and nparallelism from schema. Cus…
Browse files Browse the repository at this point in the history
…tom_metric_func is not supported and nparallelism is set depending on deployment environment.
  • Loading branch information
wendycwong committed Mar 4, 2024
1 parent 70f43c9 commit 1620e81
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ private void initModelSelectionParameters() {
_numPredictors + ")in the dataset.");
}

if (_parms._nparallelism < 0)
error("nparallelism", "must be >= 0.");

if (_parms._nparallelism == 0)
_parms._nparallelism = H2O.NUMCPUS;

if (maxrsweep.equals(_parms._mode))
warn("validation_frame", " is not used in choosing the best k subset for ModelSelection" +
" models with maxrsweep.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static class ModelSelectionParameters extends Model.Parameters {
public Key<Frame> _plug_values = null;
public int _max_predictor_number = 1;
public int _min_predictor_number = 1;
public int _nparallelism = 0;
public int _nparallelism = H2O.NUMCPUS; // adaptive to the system it is run on.
public double _p_values_threshold = 0;
public double _tweedie_variance_power;
public double _tweedie_link_power;
Expand Down
6 changes: 0 additions & 6 deletions h2o-algos/src/main/java/hex/schemas/ModelSelectionV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public static final class ModelSelectionParametersV3 extends ModelParametersSche
"max_after_balance_size",
"max_confusion_matrix_size",
"max_runtime_secs",
"custom_metric_func",
"nparallelism",
"max_predictor_number", // denote maximum number of predictors to build models for
"min_predictor_number",
"mode", // naive, maxr, maxrsweep, backward
Expand Down Expand Up @@ -279,10 +277,6 @@ public static final class ModelSelectionParametersV3 extends ModelParametersSche
level = API.Level.secondary, direction = API.Direction.INPUT)
public int min_predictor_number;

@API(help = "number of models to build in parallel. Defaults to 0.0 which is adaptive to the system capability",
level = API.Level.secondary, gridable = true)
public int nparallelism;

@API(help = "For mode='backward' only. If specified, will stop the model building process when all coefficients" +
"p-values drop below this threshold ", level = API.Level.expert)
public double p_values_threshold;
Expand Down
39 changes: 0 additions & 39 deletions h2o-py/h2o/estimators/model_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def __init__(self,
max_after_balance_size=5.0, # type: float
max_confusion_matrix_size=20, # type: int
max_runtime_secs=0.0, # type: float
custom_metric_func=None, # type: Optional[str]
nparallelism=0, # type: int
max_predictor_number=1, # type: int
min_predictor_number=1, # type: int
mode="maxr", # type: Literal["allsubsets", "maxr", "maxrsweep", "backward"]
Expand Down Expand Up @@ -290,13 +288,6 @@ def __init__(self,
:param max_runtime_secs: Maximum allowed runtime in seconds for model training. Use 0 to disable.
Defaults to ``0.0``.
:type max_runtime_secs: float
:param custom_metric_func: Reference to custom evaluation function, format: `language:keyName=funcName`
Defaults to ``None``.
:type custom_metric_func: str, optional
:param nparallelism: number of models to build in parallel. Defaults to 0.0 which is adaptive to the system
capability
Defaults to ``0``.
:type nparallelism: int
:param max_predictor_number: Maximum number of predictors to be considered when building GLM models. Defaults
to 1.
Defaults to ``1``.
Expand Down Expand Up @@ -383,8 +374,6 @@ def __init__(self,
self.max_after_balance_size = max_after_balance_size
self.max_confusion_matrix_size = max_confusion_matrix_size
self.max_runtime_secs = max_runtime_secs
self.custom_metric_func = custom_metric_func
self.nparallelism = nparallelism
self.max_predictor_number = max_predictor_number
self.min_predictor_number = min_predictor_number
self.mode = mode
Expand Down Expand Up @@ -1124,34 +1113,6 @@ def max_runtime_secs(self, max_runtime_secs):
assert_is_type(max_runtime_secs, None, numeric)
self._parms["max_runtime_secs"] = max_runtime_secs

@property
def custom_metric_func(self):
"""
Reference to custom evaluation function, format: `language:keyName=funcName`
Type: ``str``.
"""
return self._parms.get("custom_metric_func")

@custom_metric_func.setter
def custom_metric_func(self, custom_metric_func):
assert_is_type(custom_metric_func, None, str)
self._parms["custom_metric_func"] = custom_metric_func

@property
def nparallelism(self):
"""
number of models to build in parallel. Defaults to 0.0 which is adaptive to the system capability
Type: ``int``, defaults to ``0``.
"""
return self._parms.get("nparallelism")

@nparallelism.setter
def nparallelism(self, nparallelism):
assert_is_type(nparallelism, None, int)
self._parms["nparallelism"] = nparallelism

@property
def max_predictor_number(self):
"""
Expand Down
15 changes: 0 additions & 15 deletions h2o-r/h2o-package/R/modelselection.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
#' @param max_after_balance_size Maximum relative size of the training data after balancing class counts (can be less than 1.0). Requires
#' balance_classes. Defaults to 5.0.
#' @param max_runtime_secs Maximum allowed runtime in seconds for model training. Use 0 to disable. Defaults to 0.
#' @param custom_metric_func Reference to custom evaluation function, format: `language:keyName=funcName`
#' @param nparallelism number of models to build in parallel. Defaults to 0.0 which is adaptive to the system capability Defaults to
#' 0.
#' @param max_predictor_number Maximum number of predictors to be considered when building GLM models. Defaults to 1. Defaults to 1.
#' @param min_predictor_number For mode = 'backward' only. Minimum number of predictors to be considered when building GLM models starting
#' with all predictors to be included. Defaults to 1. Defaults to 1.
Expand Down Expand Up @@ -190,8 +187,6 @@ h2o.modelSelection <- function(x,
class_sampling_factors = NULL,
max_after_balance_size = 5.0,
max_runtime_secs = 0,
custom_metric_func = NULL,
nparallelism = 0,
max_predictor_number = 1,
min_predictor_number = 1,
mode = c("allsubsets", "maxr", "maxrsweep", "backward"),
Expand Down Expand Up @@ -315,10 +310,6 @@ h2o.modelSelection <- function(x,
parms$max_after_balance_size <- max_after_balance_size
if (!missing(max_runtime_secs))
parms$max_runtime_secs <- max_runtime_secs
if (!missing(custom_metric_func))
parms$custom_metric_func <- custom_metric_func
if (!missing(nparallelism))
parms$nparallelism <- nparallelism
if (!missing(max_predictor_number))
parms$max_predictor_number <- max_predictor_number
if (!missing(min_predictor_number))
Expand Down Expand Up @@ -387,8 +378,6 @@ h2o.modelSelection <- function(x,
class_sampling_factors = NULL,
max_after_balance_size = 5.0,
max_runtime_secs = 0,
custom_metric_func = NULL,
nparallelism = 0,
max_predictor_number = 1,
min_predictor_number = 1,
mode = c("allsubsets", "maxr", "maxrsweep", "backward"),
Expand Down Expand Up @@ -517,10 +506,6 @@ h2o.modelSelection <- function(x,
parms$max_after_balance_size <- max_after_balance_size
if (!missing(max_runtime_secs))
parms$max_runtime_secs <- max_runtime_secs
if (!missing(custom_metric_func))
parms$custom_metric_func <- custom_metric_func
if (!missing(nparallelism))
parms$nparallelism <- nparallelism
if (!missing(max_predictor_number))
parms$max_predictor_number <- max_predictor_number
if (!missing(min_predictor_number))
Expand Down

0 comments on commit 1620e81

Please sign in to comment.