Description Details Public fields Active bindings Methods Note
Custom Objective/Evaluate Functions Class for XGBoost
Custom Objective/Evaluate Functions Class for XGBoost
R6 Class defining custom Objective/Evaluate for XGBoost
Criterion
values between each labels for Ordered Logit Model
notchdiff_eval
width of notch when evaluating hit ratio
Criterion
values between each labels for Ordered Logit Model
notchdiff_eval
width of notch when evaluating hit ratio
set_criterion()
Set Criterions between each labels for Ordered Logit Model
XGBMetricForOrderedLogit$set_criterion(x)
x
A double vector
return_criterion()
Return criterions between each labels for Ordered Logit Model
XGBMetricForOrderedLogit$return_criterion()
Criterion set in this class
set_notchdiff_eval()
Set notch width when evaluating hit ratio by eval_hitratio()
XGBMetricForOrderedLogit$set_notchdiff_eval(x)
x
An integer, notch width when evaluate hit ratio
return_notchdiff_eval()
Return notch width
XGBMetricForOrderedLogit$return_notchdiff_eval()
private$notchdiff_eval
pred_class_criterion()
Function to predict labels comparing preds and criterions (not maximum probability)
XGBMetricForOrderedLogit$pred_class_criterion(preds)
preds
A double vector, margin score from xgboost before logistic transformation
Integer label, if [-Inf, criterion[1])
label is 1, else if [criterion[1], criterion[2])
, label is 2, ...
pred_class_maxprob()
Function to predict labels at maximum probability
XGBMetricForOrderedLogit$pred_class_maxprob(preds)
preds
A double vector, margin score from xgboost before logistic transformation
Integer label at max probability
obj_ordered_logit()
Custom Objective Function of Ordered Logit Model https://github.com/dmlc/xgboost/blob/master/R-package/demo/custom_objective.R
XGBMetricForOrderedLogit$obj_ordered_logit(preds, dtrain)
preds
A double vector, margin score at t-1
dtrain
A xgb.DMatrix created by xgboost::xgb.DMatrix
A named list(both double vector). $grad gradient of loss function. $hess hessian of loss function.
eval_logloss()
Custom Evaluate Function of Ordered Logit Model (logloss) https://github.com/dmlc/xgboost/blob/master/R-package/demo/custom_objective.R
XGBMetricForOrderedLogit$eval_logloss(preds, dtrain)
preds
A double vector, margin score
dtrain
A xgb.DMatrix created by xgboost::xgb.DMatrix
A named list(both double vector). $metric name of metric. $value value of metric.
eval_hitratio()
Custom Evaluate Function of Ordered Logit Model (hit ratio) https://github.com/dmlc/xgboost/blob/master/R-package/demo/custom_objective.R
XGBMetricForOrderedLogit$eval_hitratio(preds, dtrain)
preds
A double vector, margin score
dtrain
A xgb.DMatrix created by xgboost::xgb.DMatrix
A named list(both double vector). $metric name of metric. $value value of metric.
clone()
The objects of this class are cloneable with this method.
XGBMetricForOrderedLogit$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add -Inf/Inf both side of input x
x is sorted ascending
criterion[1] = -Inf
,
criterion[2] = x[1]
,
...
criterion[nClass] = x[nClass - 1]
,
criterion[nClass + 1] = Inf
x = 1 -> hit ratio is calculated by |act - est| < x / length(act)
grad, hess were referred to URL below. https://www.slideshare.net/TakujiTahara/201200229-lt-dsb2019-ordered-logit-model-for-qwk-tawara#23
self$notchdiff_eval is set by set_notchdiff_eval
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.