From a3e5c3f6a48f23221c99da8fd155e3427062c10c Mon Sep 17 00:00:00 2001 From: "Behrus Puladi, MD DMD" <44176896+bpuladi@users.noreply.github.com> Date: Fri, 10 May 2024 18:57:34 +0200 Subject: [PATCH] Update nnet.R Correct the linout parameter for nnet. This is required for regression. If not set, regression performance metrics will be wrong. --- models/files/nnet.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/files/nnet.R b/models/files/nnet.R index 978a7dece..36a53e4fa 100644 --- a/models/files/nnet.R +++ b/models/files/nnet.R @@ -18,17 +18,20 @@ modelInfo <- list(label = "Neural Network", fit = function(x, y, wts, param, lev, last, classProbs, ...) { dat <- if(is.data.frame(x)) x else as.data.frame(x, stringsAsFactors = TRUE) dat$.outcome <- y + lt <- ifelse(is.factor(y),FALSE,TRUE) if(!is.null(wts)) { out <- nnet::nnet(.outcome ~ ., data = dat, weights = wts, size = param$size, decay = param$decay, + linout = lt, ...) } else out <- nnet::nnet(.outcome ~ ., data = dat, size = param$size, decay = param$decay, + linout = lt, ...) out },