Merge duplicated linear updater parameters. (#4013)

* Merge duplicated linear updater parameters.

* Split up coordinate descent parameter.
This commit is contained in:
Jiaming Yuan
2018-12-22 13:21:49 +08:00
committed by GitHub
parent f75a21af25
commit 85939c6a6e
7 changed files with 151 additions and 208 deletions

View File

@@ -8,11 +8,24 @@
#include <utility>
#include <vector>
#include <limits>
#include "./param.h"
#include "../common/random.h"
namespace xgboost {
namespace linear {
struct CoordinateParam : public dmlc::Parameter<CoordinateParam> {
int top_k;
DMLC_DECLARE_PARAMETER(CoordinateParam) {
DMLC_DECLARE_FIELD(top_k)
.set_lower_bound(0)
.set_default(0)
.describe("The number of top features to select in 'thrifty' feature_selector. "
"The value of zero means using all the features.");
}
};
/**
* \brief Calculate change in weight for a given feature. Applies l1/l2 penalty normalised by the
* number of training instances.
@@ -442,17 +455,6 @@ class ThriftyFeatureSelector : public FeatureSelector {
std::vector<std::pair<double, double>> gpair_sums_;
};
/**
* \brief A set of available FeatureSelector's
*/
enum FeatureSelectorEnum {
kCyclic = 0,
kShuffle,
kThrifty,
kGreedy,
kRandom
};
inline FeatureSelector *FeatureSelector::Create(int choice) {
switch (choice) {
case kCyclic: