fix some warnings
This commit is contained in:
parent
0794dd0f6f
commit
f7b2281510
@ -342,14 +342,14 @@ namespace xgboost{
|
|||||||
virtual inline void GetLambda(const std::vector<float> &preds,
|
virtual inline void GetLambda(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
const std::vector<unsigned> &group_index,
|
const std::vector<unsigned> &group_index,
|
||||||
const std::vector<std::pair<int, int>> &pairs, std::vector<float> lambda, int group) = 0;
|
const std::vector< std::pair<int, int> > &pairs, std::vector<float> lambda, int group) = 0;
|
||||||
|
|
||||||
inline void GetGroupGradient(const std::vector<float> &preds,
|
inline void GetGroupGradient(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
const std::vector<unsigned> &group_index,
|
const std::vector<unsigned> &group_index,
|
||||||
std::vector<float> &grad,
|
std::vector<float> &grad,
|
||||||
std::vector<float> &hess,
|
std::vector<float> &hess,
|
||||||
const std::vector<std::pair<int, int>> pairs,
|
const std::vector< std::pair<int, int> > pairs,
|
||||||
int group){
|
int group){
|
||||||
|
|
||||||
std::vector<float> lambda;
|
std::vector<float> lambda;
|
||||||
@ -383,7 +383,7 @@ namespace xgboost{
|
|||||||
utils::Assert(group_index.size() != 0 && group_index.back() == preds.size(), "rank loss must have group file");
|
utils::Assert(group_index.size() != 0 && group_index.back() == preds.size(), "rank loss must have group file");
|
||||||
|
|
||||||
for (size_t i = 0; i < group_index.size() - 1; i++){
|
for (size_t i = 0; i < group_index.size() - 1; i++){
|
||||||
std::vector<std::pair<int,int>> pairs = sampler_.GenPairs(preds, info.labels, group_index[i], group_index[i + 1]);
|
std::vector< std::pair<int,int> > pairs = sampler_.GenPairs(preds, info.labels, group_index[i], group_index[i + 1]);
|
||||||
GetGroupGradient(preds, info.labels, group_index, grad, hess, pairs, i);
|
GetGroupGradient(preds, info.labels, group_index, grad, hess, pairs, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ namespace xgboost{
|
|||||||
inline void GetLambda(const std::vector<float> &preds,
|
inline void GetLambda(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
const std::vector<unsigned> &group_index,
|
const std::vector<unsigned> &group_index,
|
||||||
const std::vector<std::pair<int, int>> &pairs, std::vector<float> lambda, int group){
|
const std::vector< std::pair<int, int> > &pairs, std::vector<float> lambda, int group){
|
||||||
std::vector< Triple > sorted_triple;
|
std::vector< Triple > sorted_triple;
|
||||||
std::vector<int> index_remap;
|
std::vector<int> index_remap;
|
||||||
float IDCG;
|
float IDCG;
|
||||||
@ -515,7 +515,7 @@ namespace xgboost{
|
|||||||
inline void GetLambda(const std::vector<float> &preds,
|
inline void GetLambda(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
const std::vector<unsigned> &group_index,
|
const std::vector<unsigned> &group_index,
|
||||||
const std::vector<std::pair<int, int>> &pairs, std::vector<float> lambda, int group){
|
const std::vector< std::pair<int, int> > &pairs, std::vector<float> lambda, int group){
|
||||||
std::vector< Triple > sorted_triple;
|
std::vector< Triple > sorted_triple;
|
||||||
std::vector<int> index_remap;
|
std::vector<int> index_remap;
|
||||||
std::vector< Quadruple > map_acc;
|
std::vector< Quadruple > map_acc;
|
||||||
|
|||||||
@ -62,7 +62,7 @@ namespace xgboost {
|
|||||||
* \param end, the end index of a specified group
|
* \param end, the end index of a specified group
|
||||||
* \return the generated pairs
|
* \return the generated pairs
|
||||||
*/
|
*/
|
||||||
virtual std::vector<std::pair<int, int>> GenPairs(const std::vector<float> &preds,
|
virtual std::vector< std::pair<int, int> > GenPairs(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
int start, int end) = 0;
|
int start, int end) = 0;
|
||||||
|
|
||||||
@ -78,10 +78,10 @@ namespace xgboost {
|
|||||||
* we should guarantee the labels are 0 or 1
|
* we should guarantee the labels are 0 or 1
|
||||||
*/
|
*/
|
||||||
struct BinaryLinearSampler :public IPairSampler{
|
struct BinaryLinearSampler :public IPairSampler{
|
||||||
virtual std::vector<std::pair<int, int>> GenPairs(const std::vector<float> &preds,
|
virtual std::vector< std::pair<int, int> > GenPairs(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
int start, int end) {
|
int start, int end) {
|
||||||
std::vector<std::pair<int, int>> ans;
|
std::vector< std::pair<int, int> > ans;
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -100,7 +100,7 @@ namespace xgboost {
|
|||||||
|
|
||||||
~PairSamplerWrapper(){ delete sampler_; }
|
~PairSamplerWrapper(){ delete sampler_; }
|
||||||
|
|
||||||
std::vector<std::pair<int, int>> GenPairs(const std::vector<float> &preds,
|
std::vector< std::pair<int, int> > GenPairs(const std::vector<float> &preds,
|
||||||
const std::vector<float> &labels,
|
const std::vector<float> &labels,
|
||||||
int start, int end){
|
int start, int end){
|
||||||
utils::Assert(sampler_ != NULL, "Not config the sampler yet. Add rank:sampler in the config file\n");
|
utils::Assert(sampler_ != NULL, "Not config the sampler yet. Add rank:sampler in the config file\n");
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#if defined(_OPENMP)
|
#if defined(_OPENMP)
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
#else
|
#else
|
||||||
//#warning "OpenMP is not available, compile to single thread code"
|
#warning "OpenMP is not available, compile to single thread code"
|
||||||
inline int omp_get_thread_num() { return 0; }
|
inline int omp_get_thread_num() { return 0; }
|
||||||
inline int omp_get_num_threads() { return 1; }
|
inline int omp_get_num_threads() { return 1; }
|
||||||
inline void omp_set_num_threads(int nthread) {}
|
inline void omp_set_num_threads(int nthread) {}
|
||||||
|
|||||||
@ -137,8 +137,7 @@ namespace xgboost{
|
|||||||
}
|
}
|
||||||
/*! \brief return a real number uniform in [0,1) */
|
/*! \brief return a real number uniform in [0,1) */
|
||||||
inline double RandDouble( void ){
|
inline double RandDouble( void ){
|
||||||
// return static_cast<double>( rand_r( &rseed ) ) / (static_cast<double>( RAND_MAX )+1.0);
|
return static_cast<double>( rand_r( &rseed ) ) / (static_cast<double>( RAND_MAX )+1.0);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
// random number seed
|
// random number seed
|
||||||
unsigned rseed;
|
unsigned rseed;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user