Skip to content

Commit 3f5c464

Browse files
committed
documentation for model helper functions.
1 parent d27face commit 3f5c464

File tree

5 files changed

+149
-9
lines changed

5 files changed

+149
-9
lines changed

R/boost_tree.R

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,24 @@ check_args.boost_tree <- function(object) {
258258

259259
# xgboost helpers --------------------------------------------------------------
260260

261-
#' Training helper for xgboost
261+
#' Boosted trees via xgboost
262262
#'
263+
#' `xgb_train` is a wrapper for `xgboost` tree-based models
264+
#' where all of the model arguments are in the main function.
265+
#'
266+
#' @param x A data frame or matrix of predictors
267+
#' @param y A vector (factor or numeric) or matrix (numeric) of outcome data.
268+
#' @param max_depth An integer for the maximum depth of the tree.
269+
#' @param nrounds An integer for the number of boosting iterations.
270+
#' @param eta A numeric value between zero and one to control the learning rate.
271+
#' @param colsample_bytree Subsampling proportion of columns.
272+
#' @param min_child_weight A numeric value for the minimum sum of instance
273+
#' weights needed in a child to continue to split.
274+
#' @param gamma An number for the minimum loss reduction required to make a
275+
#' further partition on a leaf node of the tree
276+
#' @param subsample Subsampling proportion of rows.
277+
#' @param ... Other options to pass to `xgb.train`.
278+
#' @return A fitted `xgboost` object.
263279
#' @export
264280
xgb_train <- function(
265281
x, y,
@@ -403,8 +419,30 @@ xgb_by_tree <- function(tree, object, new_data, type, ...) {
403419

404420
# C5.0 helpers -----------------------------------------------------------------
405421

406-
#' Training helper for C5.0
422+
#' Boosted trees via C5.0
423+
#'
424+
#' `C5.0_train` is a wrapper for [C50::C5.0()] tree-based models
425+
#' where all of the model arguments are in the main function.
407426
#'
427+
#' @param x A data frame or matrix of predictors.
428+
#' @param y A factor vector with 2 or more levels
429+
#' @param trials An integer specifying the number of boosting
430+
#' iterations. A value of one indicates that a single model is
431+
#' used.
432+
#' @param weights An optional numeric vector of case weights. Note
433+
#' that the data used for the case weights will not be used as a
434+
#' splitting variable in the model (see
435+
#' \url{http://www.rulequest.com/see5-win.html#CASEWEIGHT} for
436+
#' Quinlan's notes on case weights).
437+
#' @param minCases An integer for the smallest number of samples
438+
#' that must be put in at least two of the splits.
439+
#' @param sample A value between (0, .999) that specifies the
440+
#' random proportion of the data should be used to train the model.
441+
#' By default, all the samples are used for model training. Samples
442+
#' not used for training are used to evaluate the accuracy of the
443+
#' model in the printed output.
444+
#' @param ... Other arguments to pass.
445+
#' @return A fitted C5.0 model.
408446
#' @export
409447
C5.0_train <-
410448
function(x, y, weights = NULL, trials = 15, minCases = 2, sample = 0, ...) {

R/mlp_data.R

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,26 @@ class2ind <- function (x, drop2nd = FALSE) {
131131
y
132132
}
133133

134-
#' MLP in Keras
134+
135+
#' Simple interface to MLP models via keras
136+
#'
137+
#' Instead of building a `keras` model sequentially, `keras_mlp` can be used to
138+
#' create a feedforward network with a single hidden layer. Regularization is
139+
#' via either weight decay or dropout.
135140
#'
141+
#' @param x A data frame or matrix of predictors
142+
#' @param y A vector (factor or numeric) or matrix (numeric) of outcome data.
143+
#' @param hidden_units An integer for the number of hidden units.
144+
#' @param decay A non-negative real number for the amount of weight decay. Either
145+
#' this parameter _or_ `dropout` can specified.
146+
#' @param dropout The proportion of parameters to set to zero. Either
147+
#' this parameter _or_ `decay` can specified.
148+
#' @param epochs An integer for the number of passes through the data.
149+
#' @param act A character string for the type of activation function between layers.
150+
#' @param seeds A vector of three positive integers to control randomness of the
151+
#' calculations.
152+
#' @param ... Currently ignored.
153+
#' @return A `keras` model object.
136154
#' @export
137155
keras_mlp <-
138156
function(x, y,

man/C5.0_train.Rd

Lines changed: 32 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/keras_mlp.Rd

Lines changed: 29 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/xgb_train.Rd

Lines changed: 29 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)