[R] Update docs for custom user functions (#10328)
This commit is contained in:
parent
0058301e6f
commit
b2008773bb
@ -122,11 +122,23 @@
|
|||||||
#' printed out during the training.
|
#' printed out during the training.
|
||||||
#' E.g., specifying \code{evals=list(validation1=mat1, validation2=mat2)} allows to track
|
#' E.g., specifying \code{evals=list(validation1=mat1, validation2=mat2)} allows to track
|
||||||
#' the performance of each round's model on mat1 and mat2.
|
#' the performance of each round's model on mat1 and mat2.
|
||||||
#' @param obj customized objective function. Returns gradient and second order
|
#' @param obj customized objective function. Should take two arguments: the first one will be the
|
||||||
#' gradient with given prediction and dtrain.
|
#' current predictions (either a numeric vector or matrix depending on the number of targets / classes),
|
||||||
#' @param feval customized evaluation function. Returns
|
#' and the second one will be the `data` DMatrix object that is used for training.
|
||||||
#' \code{list(metric='metric-name', value='metric-value')} with given
|
#'
|
||||||
#' prediction and dtrain.
|
#' It should return a list with two elements `grad` and `hess` (in that order), as either
|
||||||
|
#' numeric vectors or numeric matrices depending on the number of targets / classes (same
|
||||||
|
#' dimension as the predictions that are passed as first argument).
|
||||||
|
#' @param feval customized evaluation function. Just like `obj`, should take two arguments, with
|
||||||
|
#' the first one being the predictions and the second one the `data` DMatrix.
|
||||||
|
#'
|
||||||
|
#' Should return a list with two elements `metric` (name that will be displayed for this metric,
|
||||||
|
#' should be a string / character), and `value` (the number that the function calculates, should
|
||||||
|
#' be a numeric scalar).
|
||||||
|
#'
|
||||||
|
#' Note that even if passing `feval`, objectives also have an associated default metric that
|
||||||
|
#' will be evaluated in addition to it. In order to disable the built-in metric, one can pass
|
||||||
|
#' parameter `disable_default_eval_metric = TRUE`.
|
||||||
#' @param verbose If 0, xgboost will stay silent. If 1, it will print information about performance.
|
#' @param verbose If 0, xgboost will stay silent. If 1, it will print information about performance.
|
||||||
#' If 2, some additional information will be printed out.
|
#' If 2, some additional information will be printed out.
|
||||||
#' Note that setting \code{verbose > 0} automatically engages the
|
#' Note that setting \code{verbose > 0} automatically engages the
|
||||||
|
|||||||
@ -167,12 +167,26 @@ printed out during the training.
|
|||||||
E.g., specifying \code{evals=list(validation1=mat1, validation2=mat2)} allows to track
|
E.g., specifying \code{evals=list(validation1=mat1, validation2=mat2)} allows to track
|
||||||
the performance of each round's model on mat1 and mat2.}
|
the performance of each round's model on mat1 and mat2.}
|
||||||
|
|
||||||
\item{obj}{customized objective function. Returns gradient and second order
|
\item{obj}{customized objective function. Should take two arguments: the first one will be the
|
||||||
gradient with given prediction and dtrain.}
|
current predictions (either a numeric vector or matrix depending on the number of targets / classes),
|
||||||
|
and the second one will be the \code{data} DMatrix object that is used for training.
|
||||||
|
|
||||||
\item{feval}{customized evaluation function. Returns
|
\if{html}{\out{<div class="sourceCode">}}\preformatted{ It should return a list with two elements `grad` and `hess` (in that order), as either
|
||||||
\code{list(metric='metric-name', value='metric-value')} with given
|
numeric vectors or numeric matrices depending on the number of targets / classes (same
|
||||||
prediction and dtrain.}
|
dimension as the predictions that are passed as first argument).
|
||||||
|
}\if{html}{\out{</div>}}}
|
||||||
|
|
||||||
|
\item{feval}{customized evaluation function. Just like \code{obj}, should take two arguments, with
|
||||||
|
the first one being the predictions and the second one the \code{data} DMatrix.
|
||||||
|
|
||||||
|
\if{html}{\out{<div class="sourceCode">}}\preformatted{ Should return a list with two elements `metric` (name that will be displayed for this metric,
|
||||||
|
should be a string / character), and `value` (the number that the function calculates, should
|
||||||
|
be a numeric scalar).
|
||||||
|
|
||||||
|
Note that even if passing `feval`, objectives also have an associated default metric that
|
||||||
|
will be evaluated in addition to it. In order to disable the built-in metric, one can pass
|
||||||
|
parameter `disable_default_eval_metric = TRUE`.
|
||||||
|
}\if{html}{\out{</div>}}}
|
||||||
|
|
||||||
\item{verbose}{If 0, xgboost will stay silent. If 1, it will print information about performance.
|
\item{verbose}{If 0, xgboost will stay silent. If 1, it will print information about performance.
|
||||||
If 2, some additional information will be printed out.
|
If 2, some additional information will be printed out.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user