4#ifndef XGBOOST_OBJECTIVE_REGRESSION_LOSS_ONEAPI_H_
5#define XGBOOST_OBJECTIVE_REGRESSION_LOSS_ONEAPI_H_
22 return 1.0f / (1.0f + cl::sycl::exp(-x));
29 static bool CheckLabel(
bst_float x) {
return true; }
37 static const char* LabelErrorMsg() {
return ""; }
38 static const char* DefaultEvalMetric() {
return "rmse"; }
40 static const char* Name() {
return "reg:squarederror_oneapi"; }
50 predt = std::max(predt, (
bst_float)(-1 + 1e-6));
51 return (cl::sycl::log1p(predt) - cl::sycl::log1p(label)) / (predt + 1);
54 predt = std::max(predt, (
bst_float)(-1 + 1e-6));
55 float res = (-cl::sycl::log1p(predt) + cl::sycl::log1p(label) + 1) /
61 static const char* LabelErrorMsg() {
62 return "label must be greater than -1 for rmsle so that log(label + 1) can be valid.";
64 static const char* DefaultEvalMetric() {
return "rmsle"; }
66 static const char* Name() {
return "reg:squaredlogerror_oneapi"; }
74 static bool CheckLabel(
bst_float x) {
return x >= 0.0f && x <= 1.0f; }
80 return std::max(predt * (1.0f - predt), eps);
85 static T FirstOrderGradient(T predt, T label) {
return predt - label; }
87 static T SecondOrderGradient(T predt, T label) {
88 const T eps = T(1e-16f);
89 return std::max(predt * (T(1.0f) - predt), eps);
92 CHECK(base_score > 0.0f && base_score < 1.0f)
93 <<
"base_score must be in (0,1) for logistic loss, got: " << base_score;
94 return -logf(1.0f / base_score - 1.0f);
96 static const char* LabelErrorMsg() {
97 return "label must be in [0,1] for logistic regression";
99 static const char* DefaultEvalMetric() {
return "rmse"; }
101 static const char* Name() {
return "reg:logistic_oneapi"; }
106 static const char* DefaultEvalMetric() {
return "logloss"; }
107 static const char* Name() {
return "binary:logistic_oneapi"; }
117 return predt - label;
122 return std::max(predt * (1.0f - predt), eps);
124 template <
typename T>
125 static T PredTransform(T x) {
return x; }
126 template <
typename T>
127 static T FirstOrderGradient(T predt, T label) {
129 return predt - label;
131 template <
typename T>
132 static T SecondOrderGradient(T predt, T label) {
133 const T eps = T(1e-16f);
135 return std::max(predt * (T(1.0f) - predt), eps);
137 static const char* DefaultEvalMetric() {
return "logloss"; }
139 static const char* Name() {
return "binary:logitraw_oneapi"; }
defines console logging options for xgboost. Use to enforce unified print behavior.
float SigmoidOneAPI(float x)
calculate the sigmoid of the input.
Definition regression_loss_oneapi.h:21
namespace of xgboost
Definition base.h:90
float bst_float
float type, used for storing statistics
Definition base.h:97
header to handle OpenMP compatibility issues
Definition regression_loss_oneapi.h:27
Definition regression_loss_oneapi.h:105
Definition regression_loss_oneapi.h:111
Definition regression_loss_oneapi.h:70
Definition regression_loss_oneapi.h:44