Jiaming Yuan 0d0abe1845
Support optimal partitioning for GPU hist. (#7652)
* Implement `MaxCategory` in quantile.
* Implement partition-based split for GPU evaluation.  Currently, it's based on the existing evaluation function.
* Extract an evaluator from GPU Hist to store the needed states.
* Added some CUDA stream/event utilities.
* Update document with references.
* Fixed a bug in approx evaluator where the number of data points is less than the number of categories.
2022-02-15 03:03:12 +08:00

44 lines
1.2 KiB
C++

/*!
* Copyright 2021-2022 by XGBoost Contributors
*/
#ifndef XGBOOST_TASK_H_
#define XGBOOST_TASK_H_
#include <cinttypes>
namespace xgboost {
/*!
* \brief A struct returned by objective, which determines task at hand. The struct is
* not used by any algorithm yet, only for future development like categorical
* split.
*
* The task field is useful for tree split finding, also for some metrics like auc.
* Lastly, knowing whether hessian is constant can allow some optimizations like skipping
* the quantile sketching.
*
* This struct should not be serialized since it can be recovered from objective function,
* hence it doesn't need to be stable.
*/
struct ObjInfo {
// What kind of problem are we trying to solve
enum Task : uint8_t {
kRegression = 0,
kBinary = 1,
kClassification = 2,
kSurvival = 3,
kRanking = 4,
kOther = 5,
} task;
// Does the objective have constant hessian value?
bool const_hess{false};
explicit ObjInfo(Task t) : task{t} {}
ObjInfo(Task t, bool khess) : task{t}, const_hess{khess} {}
constexpr bool UseOneHot() const {
return (task != ObjInfo::kRegression && task != ObjInfo::kBinary);
}
};
} // namespace xgboost
#endif // XGBOOST_TASK_H_