LossCustomCpp {compboost} | R Documentation |
LossCustomCpp
creates a custom loss by using
Rcpp::XPtr
to set C++
functions.
S4
object.
LossCustomCpp$new(loss_ptr, grad_ptr, const_init_ptr)
loss_ptr
[externalptr
]External pointer to the C++
loss function.
grad_ptr
[externalptr
]External pointer to the C++
gradient function.
const_init_ptr
[externalptr
]External pointer to the C++
constant initialization function.
For an example see the extending compboost vignette or the function
getCustomCppExample(example = "loss")
.
This class is a wrapper around the pure C++
implementation. To see
the functionality of the C++
class visit
https://schalkdaniel.github.io/compboost/cpp_man/html/classloss_1_1_custom_cpp_loss.html.
# Load loss functions: Rcpp::sourceCpp(code = getCustomCppExample(example = "loss", silent = TRUE)) # Create new custom quadratic loss: my.cpp.loss = LossCustomCpp$new(lossFunSetter(), gradFunSetter(), constInitFunSetter())