Description Format Usage Arguments Details Examples
LossCustomCpp
creates a custom loss by using
Rcpp::XPtr
to set C++
functions.
S4
object.
1 | 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.
1 2 3 4 5 | # Load loss functions:
Rcpp::sourceCpp(code = getCustomCppExample(example = "loss", silent = TRUE))
# Create new custom quadratic loss:
my.cpp.loss = LossCustomCpp$new(lossFunSetter(), gradFunSetter(), constInitFunSetter())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.