create mae
This commit is contained in:
@@ -72,6 +72,15 @@ struct EvalRMSE : public EvalEWiseBase<EvalRMSE> {
|
||||
}
|
||||
};
|
||||
|
||||
struct EvalMAE : public EvalEWiseBase<EvalMAE> {
|
||||
const char *Name() const override {
|
||||
return "mae";
|
||||
}
|
||||
inline static float EvalRow(float label, float pred) {
|
||||
return std::abs(label - pred);
|
||||
}
|
||||
};
|
||||
|
||||
struct EvalLogLoss : public EvalEWiseBase<EvalLogLoss> {
|
||||
const char *Name() const override {
|
||||
return "logloss";
|
||||
@@ -114,6 +123,10 @@ XGBOOST_REGISTER_METRIC(RMSE, "rmse")
|
||||
.describe("Rooted mean square error.")
|
||||
.set_body([](const char* param) { return new EvalRMSE(); });
|
||||
|
||||
XGBOOST_REGISTER_METRIC(MAE, "mae")
|
||||
.describe("Mean absolute error.")
|
||||
.set_body([](const char* param) { return new EvalMAE(); });
|
||||
|
||||
XGBOOST_REGISTER_METRIC(LogLoss, "logloss")
|
||||
.describe("Negative loglikelihood for logistic regression.")
|
||||
.set_body([](const char* param) { return new EvalLogLoss(); });
|
||||
|
||||
Reference in New Issue
Block a user