[LIBXGBOOST] pass demo running.

This commit is contained in:
tqchen
2016-01-05 21:49:48 -08:00
parent cee148ed64
commit d75e3ed05d
59 changed files with 1611 additions and 1845 deletions

View File

@@ -71,7 +71,7 @@ struct TrainParam : public dmlc::Parameter<TrainParam> {
.describe("L2 regularization on leaf weight");
DMLC_DECLARE_FIELD(reg_alpha).set_lower_bound(0.0f).set_default(0.0f)
.describe("L1 regularization on leaf weight");
DMLC_DECLARE_FIELD(default_direction)
DMLC_DECLARE_FIELD(default_direction).set_default(0)
.add_enum("learn", 0)
.add_enum("left", 1)
.add_enum("right", 2)

35
src/tree/tree_updater.cc Normal file
View File

@@ -0,0 +1,35 @@
/*!
* Copyright 2015 by Contributors
* \file tree_updater.cc
* \brief Registry of tree updaters.
*/
#include <xgboost/tree_updater.h>
#include <dmlc/registry.h>
namespace dmlc {
DMLC_REGISTRY_ENABLE(::xgboost::TreeUpdaterReg);
} // namespace dmlc
namespace xgboost {
TreeUpdater* TreeUpdater::Create(const std::string& name) {
auto *e = ::dmlc::Registry< ::xgboost::TreeUpdaterReg>::Get()->Find(name);
if (e == nullptr) {
LOG(FATAL) << "Unknown tree updater " << name;
}
return (e->body)();
}
} // namespace xgboost
namespace xgboost {
namespace tree {
// List of files that will be force linked in static links.
DMLC_REGISTRY_LINK_TAG(updater_colmaker);
DMLC_REGISTRY_LINK_TAG(updater_skmaker);
DMLC_REGISTRY_LINK_TAG(updater_refresh);
DMLC_REGISTRY_LINK_TAG(updater_prune);
DMLC_REGISTRY_LINK_TAG(updater_histmaker);
DMLC_REGISTRY_LINK_TAG(updater_sync);
} // namespace tree
} // namespace xgboost

View File

@@ -15,6 +15,9 @@
namespace xgboost {
namespace tree {
DMLC_REGISTRY_FILE_TAG(updater_colmaker);
/*! \brief column-wise update to construct a tree */
template<typename TStats>
class ColMaker: public TreeUpdater {
@@ -891,4 +894,3 @@ XGBOOST_REGISTER_TREE_UPDATER(DistColMaker, "distcol")
});
} // namespace tree
} // namespace xgboost

View File

@@ -15,6 +15,9 @@
namespace xgboost {
namespace tree {
DMLC_REGISTRY_FILE_TAG(updater_histmaker);
template<typename TStats>
class HistMaker: public BaseMaker {
public:

View File

@@ -14,6 +14,9 @@
namespace xgboost {
namespace tree {
DMLC_REGISTRY_FILE_TAG(updater_prune);
/*! \brief pruner that prunes a tree after growing finishes */
class TreePruner: public TreeUpdater {
public:

View File

@@ -14,6 +14,9 @@
namespace xgboost {
namespace tree {
DMLC_REGISTRY_FILE_TAG(updater_refresh);
/*! \brief pruner that prunes a tree after growing finishs */
template<typename TStats>
class TreeRefresher: public TreeUpdater {

View File

@@ -18,6 +18,8 @@
namespace xgboost {
namespace tree {
DMLC_REGISTRY_FILE_TAG(updater_skmaker);
class SketchMaker: public BaseMaker {
public:
void Update(const std::vector<bst_gpair> &gpair,
@@ -399,4 +401,3 @@ XGBOOST_REGISTER_TREE_UPDATER(SketchMaker, "grow_skmaker")
});
} // namespace tree
} // namespace xgboost

View File

@@ -12,6 +12,9 @@
namespace xgboost {
namespace tree {
DMLC_REGISTRY_FILE_TAG(updater_sync);
/*!
* \brief syncher that synchronize the tree in all distributed nodes
* can implement various strategies, so far it is always set to node 0's tree