-
Notifications
You must be signed in to change notification settings - Fork 92
Add a model for bagged neural networks #815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a7468bb
e5683fc
f97c045
cf2d9b0
64306f7
b189de5
72c559b
f6cdecb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#' Ensembles of neural networks | ||
#' | ||
#' @description | ||
#' | ||
#' `bag_mlp()` defines an ensemble of single layer, feed-forward neural networks. | ||
#' This function can fit classification and regression models. | ||
#' | ||
#' \Sexpr[stage=render,results=rd]{parsnip:::make_engine_list("bag_mlp")} | ||
#' | ||
#' More information on how \pkg{parsnip} is used for modeling is at | ||
#' \url{https://www.tidymodels.org/}. | ||
#' | ||
#' @inheritParams mlp | ||
#' | ||
#' @template spec-details | ||
#' | ||
#' @template spec-references | ||
#' | ||
#' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("bag_mlp")} | ||
#' @export | ||
bag_mlp <- | ||
function(mode = "unknown", | ||
hidden_units = NULL, | ||
penalty = NULL, | ||
epochs = NULL, | ||
engine = "nnet") { | ||
args <- list( | ||
hidden_units = enquo(hidden_units), | ||
penalty = enquo(penalty), | ||
epochs = enquo(epochs) | ||
) | ||
|
||
new_model_spec( | ||
"bag_mlp", | ||
args = args, | ||
eng_args = NULL, | ||
mode = mode, | ||
user_specified_mode = !missing(mode), | ||
method = NULL, | ||
engine = engine, | ||
user_specified_engine = !missing(engine) | ||
) | ||
} | ||
|
||
# ------------------------------------------------------------------------------ | ||
|
||
#' @method update bag_mlp | ||
#' @rdname parsnip_update | ||
#' @inheritParams mars | ||
#' @export | ||
update.bag_mlp <- | ||
function(object, | ||
parameters = NULL, | ||
hidden_units = NULL, penalty = NULL, epochs = NULL, | ||
fresh = FALSE, ...) { | ||
|
||
args <- list( | ||
hidden_units = enquo(hidden_units), | ||
penalty = enquo(penalty), | ||
epochs = enquo(epochs) | ||
) | ||
|
||
update_spec( | ||
object = object, | ||
parameters = parameters, | ||
args_enquo_list = args, | ||
fresh = fresh, | ||
cls = "bag_mlp", | ||
... | ||
) | ||
} | ||
|
||
# ------------------------------------------------------------------------------ | ||
|
||
set_new_model("bag_mlp") | ||
set_model_mode("bag_mlp", "classification") | ||
set_model_mode("bag_mlp", "regression") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#' Bagged neural networks via nnet | ||
#' | ||
#' [baguette::bagger()] creates a collection of neural networks forming an | ||
#' ensemble. All trees in the ensemble are combined to produce a final prediction. | ||
#' | ||
#' @includeRmd man/rmd/bag_mlp_nnet.md details | ||
#' | ||
#' @name details_bag_mlp_nnet | ||
#' @keywords internal | ||
NULL | ||
|
||
# See inst/README-DOCS.md for a description of how these files are processed |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ reference: | |
contents: | ||
- auto_ml | ||
- bag_mars | ||
- bag_mlp | ||
- bag_tree | ||
- bart | ||
- boost_tree | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.