Add Model and Configurable interface. (#4945)

* Apply Configurable to objective functions.
* Apply Model to Learner and Regtree, gbm.
* Add Load/SaveConfig to objs.
* Refactor obj tests to use smart pointer.
* Dummy methods for Save/Load Model.
This commit is contained in:
Jiaming Yuan
2019-10-18 01:56:02 -04:00
committed by GitHub
parent 9fc681001a
commit ae536756ae
31 changed files with 521 additions and 187 deletions

View File

@@ -7,7 +7,9 @@
TEST(Objective, DeclareUnifiedTest(HingeObj)) {
xgboost::GenericParameter tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::ObjFunction * obj = xgboost::ObjFunction::Create("binary:hinge", &tparam);
std::unique_ptr<xgboost::ObjFunction> obj {
xgboost::ObjFunction::Create("binary:hinge", &tparam)
};
xgboost::bst_float eps = std::numeric_limits<xgboost::bst_float>::min();
CheckObjFunction(obj,
@@ -24,6 +26,4 @@ TEST(Objective, DeclareUnifiedTest(HingeObj)) {
{ eps, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, eps });
ASSERT_NO_THROW(obj->DefaultEvalMetric());
delete obj;
}