From cba130c40c5ba0e7854f14a2be437809dc0e142a Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 3 Mar 2014 22:20:45 -0800 Subject: [PATCH] ok fix --- booster/xgboost-inl.hpp | 28 +++++++++++++++++----------- booster/xgboost.h | 6 ------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/booster/xgboost-inl.hpp b/booster/xgboost-inl.hpp index eee64ac7b..db44b5ac7 100644 --- a/booster/xgboost-inl.hpp +++ b/booster/xgboost-inl.hpp @@ -6,6 +6,12 @@ * \author Tianqi Chen: tianqi.tchen@gmail.com */ // implementation of boosters go to here + +// A good design should have minimum functions defined interface, user should only operate on interface +// I break it a bit, by using template and let user 'see' the implementation +// The user should pretend that they only can use the interface, and we are all cool +// I find this is the only way so far I can think of to make boosters invariant of data structure, +// while keep everything fast #include "xgboost.h" #include "../utils/xgboost_utils.h" #include "tree/xgboost_tree.hpp" @@ -13,21 +19,21 @@ namespace xgboost{ namespace booster{ - /*! - * \brief create a gradient booster, given type of booster - * \param booster_type type of gradient booster, can be used to specify implements - * \tparam FMatrix input data type for booster - * \return the pointer to the gradient booster created - */ + /*! + * \brief create a gradient booster, given type of booster + * \param booster_type type of gradient booster, can be used to specify implements + * \tparam FMatrix input data type for booster + * \return the pointer to the gradient booster created + */ template inline InterfaceBooster *CreateBooster( int booster_type ){ - switch( booster_type ){ + switch( booster_type ){ case 0: return new RegTreeTrainer(); case 1: return new LinearBooster(); - default: utils::Error("unknown booster_type"); return NULL; - } + default: utils::Error("unknown booster_type"); return NULL; + } } - }; -}; + }; // namespace booster +}; // namespace xgboost #endif // XGBOOST_INL_HPP diff --git a/booster/xgboost.h b/booster/xgboost.h index 587cefdc3..c0ccf4aca 100644 --- a/booster/xgboost.h +++ b/booster/xgboost.h @@ -150,12 +150,6 @@ namespace xgboost{ }; }; -// A good design should have minimum functions defined interface, user should only operate on interface -// I break it a bit, by using template and let user 'see' the implementation -// The user should pretend that they only can use the interface, and we are all cool -// I find this is the only way so far I can think of to make boosters invariant of data structure, -// while keep everything fast - // this file includes the template implementations of all boosters // the cost of using template is that the user can 'see' all the implementations, which is OK // ignore implementations and focus on the interface:)