38 lines
1.6 KiB
R
38 lines
1.6 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/callbacks.R
|
|
\name{callbacks}
|
|
\alias{callbacks}
|
|
\title{Callback closures for booster training.}
|
|
\description{
|
|
These are used to perform various service tasks either during boosting iterations or at the end.
|
|
This approach helps to modularize many of such tasks without bloating the main training methods,
|
|
and it offers .
|
|
}
|
|
\details{
|
|
By default, a callback function is run after each boosting iteration.
|
|
An R-attribute \code{is_pre_iteration} could be set for a callback to define a pre-iteration function.
|
|
|
|
When a callback function has \code{finalize} parameter, its finalizer part will also be run after
|
|
the boosting is completed.
|
|
|
|
WARNING: side-effects!!! Be aware that these callback functions access and modify things in
|
|
the environment from which they are called from, which is a fairly uncommon thing to do in R.
|
|
|
|
To write a custom callback closure, make sure you first understand the main concepts about R envoronments.
|
|
Check either the R docs on \code{\link[base]{environment}} or the
|
|
\href{http://adv-r.had.co.nz/Environments.html}{Environments chapter} from Hadley Wickham's "Advanced R" book.
|
|
Then take a look at the code of \code{cb.reset_learning_rate} for a simple example,
|
|
and see the \code{cb.log_evaluation} code for something more involved.
|
|
Also, you would need to get familiar with the objects available inside of the \code{xgb.train} internal environment.
|
|
}
|
|
\seealso{
|
|
\code{\link{cb.print_evaluation}},
|
|
\code{\link{cb.log_evaluation}},
|
|
\code{\link{cb.reset_parameters}},
|
|
\code{\link{cb.early_stop}},
|
|
\code{\link{cb.save_model}},
|
|
\code{\link{xgb.train}},
|
|
\code{\link{xgb.cv}}
|
|
}
|
|
|