Pseudo-huber loss metric added (#5647)
- Add pseudo huber loss objective. - Add pseudo huber loss metric. Co-authored-by: Reetz <s02reetz@iavgroup.local>
This commit is contained in:
committed by
GitHub
parent
535479e69f
commit
83981a9ce3
@@ -190,6 +190,19 @@ struct EvalRowLogLoss {
|
||||
}
|
||||
};
|
||||
|
||||
struct EvalRowMPHE {
|
||||
char const *Name() const {
|
||||
return "mphe";
|
||||
}
|
||||
XGBOOST_DEVICE bst_float EvalRow(bst_float label, bst_float pred) const {
|
||||
bst_float diff = label - pred;
|
||||
return std::sqrt( 1 + diff * diff) - 1;
|
||||
}
|
||||
static bst_float GetFinal(bst_float esum, bst_float wsum) {
|
||||
return wsum == 0 ? esum : esum / wsum;
|
||||
}
|
||||
};
|
||||
|
||||
struct EvalError {
|
||||
explicit EvalError(const char* param) {
|
||||
if (param != nullptr) {
|
||||
@@ -359,6 +372,10 @@ XGBOOST_REGISTER_METRIC(MAE, "mae")
|
||||
.describe("Mean absolute error.")
|
||||
.set_body([](const char* param) { return new EvalEWiseBase<EvalRowMAE>(); });
|
||||
|
||||
XGBOOST_REGISTER_METRIC(MPHE, "mphe")
|
||||
.describe("Mean Pseudo Huber error.")
|
||||
.set_body([](const char* param) { return new EvalEWiseBase<EvalRowMPHE>(); });
|
||||
|
||||
XGBOOST_REGISTER_METRIC(LogLoss, "logloss")
|
||||
.describe("Negative loglikelihood for logistic regression.")
|
||||
.set_body([](const char* param) { return new EvalEWiseBase<EvalRowLogLoss>(); });
|
||||
|
||||
Reference in New Issue
Block a user