Skip to content

Commit

Permalink
Update MeanSquare to Quadratic in R API for DL. Throw a warning if us…
Browse files Browse the repository at this point in the history
…er passes MeanSquare to loss indicating it is deprecated in favor of Quadratic.
  • Loading branch information
anqi committed Sep 23, 2015
1 parent 3ae6d1c commit ee3d12d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion h2o-r/ensemble/h2oEnsemble-package/R/wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ h2o.deeplearning.wrapper <- function(x, y, training_frame, model_id = "",
hidden_dropout_ratios, l1 = 0, l2 = 0, max_w2 = Inf,
initial_weight_distribution = c("UniformAdaptive", "Uniform", "Normal"),
initial_weight_scale = 1,
loss = c("Automatic", "CrossEntropy", "MeanSquare", "Absolute", "Huber"),
loss = c("Automatic", "CrossEntropy", "Quadratic", "Absolute", "Huber"),
distribution = c("AUTO", "gaussian", "bernoulli", "multinomial",
"poisson", "gamma", "tweedie", "laplace", "huber"),
tweedie_power = 1.5, score_interval = 5,
Expand Down
13 changes: 9 additions & 4 deletions h2o-r/h2o-package/R/deeplearning.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' @param max_w2 Constraint for squared sum of incoming weights per unit (e.g. Rectifier)
#' @param initial_weight_distribution Can be "Uniform", "UniformAdaptive", or "Normal"
#' @param initial_weight_scale Uniform: -value ... value, Normal: stddev
#' @param loss Loss function: "Automatic", "CrossEntropy" (for classification only), "MeanSquare", "Absolute"
#' @param loss Loss function: "Automatic", "CrossEntropy" (for classification only), "Quadratic", "Absolute"
#' (experimental) or "Huber" (experimental)
#' @param distribution A \code{character} string. The distribution function of the response.
#' Must be "AUTO", "bernoulli", "multinomial", "poisson", "gamma", "tweedie",
Expand Down Expand Up @@ -144,7 +144,7 @@ h2o.deeplearning <- function(x, y, training_frame,
max_w2 = Inf,
initial_weight_distribution = c("UniformAdaptive", "Uniform", "Normal"),
initial_weight_scale = 1,
loss = c("Automatic", "CrossEntropy", "MeanSquare", "Absolute", "Huber"),
loss = c("Automatic", "CrossEntropy", "Quadratic", "Absolute", "Huber"),
distribution = c("AUTO","gaussian", "bernoulli", "multinomial", "poisson", "gamma", "tweedie", "laplace", "huber"),
tweedie_power = 1.5,
score_interval = 5,
Expand Down Expand Up @@ -266,8 +266,13 @@ h2o.deeplearning <- function(x, y, training_frame,
parms$initial_weight_distribution <- initial_weight_distribution
if(!missing(initial_weight_scale))
parms$initial_weight_scale <- initial_weight_scale
if(!missing(loss))
parms$loss <- loss
if(!missing(loss)) {
if(loss == "MeanSquare") {
warn("Loss name 'MeanSquare' is deprecated; please use 'Quadratic' instead.")
parms$loss <- "Quadratic"
} else
parms$loss <- loss
}
if (!missing(distribution))
parms$distribution <- distribution
if (!missing(tweedie_power))
Expand Down

0 comments on commit ee3d12d

Please sign in to comment.