Clean up C++ warnings (#6213)

This commit is contained in:
Igor Moura
2020-10-19 12:02:33 -03:00
committed by GitHub
parent ddf37cca30
commit d1254808d5
20 changed files with 78 additions and 89 deletions

View File

@@ -111,17 +111,17 @@ class PairwiseLambdaWeightComputer {
* \param list a list that is sorted by pred score
* \param io_pairs record of pairs, containing the pairs to fill in weights
*/
static void GetLambdaWeight(const std::vector<ListEntry> &sorted_list,
std::vector<LambdaPair> *io_pairs) {}
static void GetLambdaWeight(const std::vector<ListEntry>&,
std::vector<LambdaPair>*) {}
static char const* Name() {
return "rank:pairwise";
}
#if defined(__CUDACC__)
PairwiseLambdaWeightComputer(const bst_float *dpreds,
const bst_float *dlabels,
const dh::SegmentSorter<float> &segment_label_sorter) {}
PairwiseLambdaWeightComputer(const bst_float*,
const bst_float*,
const dh::SegmentSorter<float>&) {}
class PairwiseLambdaWeightMultiplier {
public:
@@ -270,7 +270,7 @@ class NDCGLambdaWeightComputer
};
NDCGLambdaWeightComputer(const bst_float *dpreds,
const bst_float *dlabels,
const bst_float*,
const dh::SegmentSorter<float> &segment_label_sorter)
: IndexablePredictionSorter(dpreds, segment_label_sorter),
dgroup_dcg_(segment_label_sorter.GetNumGroups(), 0.0f),
@@ -293,7 +293,7 @@ class NDCGLambdaWeightComputer
group_segments)),
thrust::make_discard_iterator(), // We don't care for the group indices
dgroup_dcg_.begin()); // Sum of the item's DCG values in the group
CHECK(end_range.second - dgroup_dcg_.begin() == dgroup_dcg_.size());
CHECK(static_cast<unsigned>(end_range.second - dgroup_dcg_.begin()) == dgroup_dcg_.size());
}
inline const common::Span<const float> GetGroupDcgsSpan() const {

View File

@@ -18,11 +18,11 @@ struct LinearSquareLoss {
// duplication is necessary, as __device__ specifier
// cannot be made conditional on template parameter
XGBOOST_DEVICE static bst_float PredTransform(bst_float x) { return x; }
XGBOOST_DEVICE static bool CheckLabel(bst_float x) { return true; }
XGBOOST_DEVICE static bool CheckLabel(bst_float) { return true; }
XGBOOST_DEVICE static bst_float FirstOrderGradient(bst_float predt, bst_float label) {
return predt - label;
}
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float predt, bst_float label) {
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float, bst_float) {
return 1.0f;
}
template <typename T>
@@ -72,7 +72,7 @@ struct LogisticRegression {
XGBOOST_DEVICE static bst_float FirstOrderGradient(bst_float predt, bst_float label) {
return predt - label;
}
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float predt, bst_float label) {
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float predt, bst_float) {
const float eps = 1e-16f;
return fmaxf(predt * (1.0f - predt), eps);
}
@@ -102,7 +102,7 @@ struct PseudoHuberError {
XGBOOST_DEVICE static bst_float PredTransform(bst_float x) {
return x;
}
XGBOOST_DEVICE static bool CheckLabel(bst_float label) {
XGBOOST_DEVICE static bool CheckLabel(bst_float) {
return true;
}
XGBOOST_DEVICE static bst_float FirstOrderGradient(bst_float predt, bst_float label) {
@@ -144,7 +144,7 @@ struct LogisticRaw : public LogisticRegression {
predt = common::Sigmoid(predt);
return predt - label;
}
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float predt, bst_float label) {
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float predt, bst_float) {
const float eps = 1e-16f;
predt = common::Sigmoid(predt);
return fmaxf(predt * (1.0f - predt), eps);

View File

@@ -52,8 +52,7 @@ class RegLossObj : public ObjFunction {
}
void GetGradient(const HostDeviceVector<bst_float>& preds,
const MetaInfo &info,
int iter,
const MetaInfo &info, int,
HostDeviceVector<GradientPair>* out_gpair) override {
CHECK_EQ(preds.Size(), info.labels_.Size())
<< " " << "labels are not correctly provided"
@@ -191,8 +190,7 @@ class PoissonRegression : public ObjFunction {
}
void GetGradient(const HostDeviceVector<bst_float>& preds,
const MetaInfo &info,
int iter,
const MetaInfo &info, int,
HostDeviceVector<GradientPair> *out_gpair) override {
CHECK_NE(info.labels_.Size(), 0U) << "label set cannot be empty";
CHECK_EQ(preds.Size(), info.labels_.Size()) << "labels are not correctly provided";
@@ -280,11 +278,10 @@ XGBOOST_REGISTER_OBJECTIVE(PoissonRegression, "count:poisson")
class CoxRegression : public ObjFunction {
public:
void Configure(
const std::vector<std::pair<std::string, std::string> > &args) override {}
const std::vector<std::pair<std::string, std::string> >&) override {}
void GetGradient(const HostDeviceVector<bst_float>& preds,
const MetaInfo &info,
int iter,
const MetaInfo &info, int,
HostDeviceVector<GradientPair> *out_gpair) override {
CHECK_NE(info.labels_.Size(), 0U) << "label set cannot be empty";
CHECK_EQ(preds.Size(), info.labels_.Size()) << "labels are not correctly provided";
@@ -379,11 +376,10 @@ XGBOOST_REGISTER_OBJECTIVE(CoxRegression, "survival:cox")
class GammaRegression : public ObjFunction {
public:
void Configure(
const std::vector<std::pair<std::string, std::string> > &args) override {}
const std::vector<std::pair<std::string, std::string> >&) override {}
void GetGradient(const HostDeviceVector<bst_float> &preds,
const MetaInfo &info,
int iter,
const MetaInfo &info, int,
HostDeviceVector<GradientPair> *out_gpair) override {
CHECK_NE(info.labels_.Size(), 0U) << "label set cannot be empty";
CHECK_EQ(preds.Size(), info.labels_.Size()) << "labels are not correctly provided";
@@ -479,8 +475,7 @@ class TweedieRegression : public ObjFunction {
}
void GetGradient(const HostDeviceVector<bst_float>& preds,
const MetaInfo &info,
int iter,
const MetaInfo &info, int,
HostDeviceVector<GradientPair> *out_gpair) override {
CHECK_NE(info.labels_.Size(), 0U) << "label set cannot be empty";
CHECK_EQ(preds.Size(), info.labels_.Size()) << "labels are not correctly provided";