lambda rank added
This commit is contained in:
@@ -144,17 +144,24 @@ namespace xgboost {
|
||||
this->GetGradient(preds_, train_->labels, train_->group_index, grad_, hess_);
|
||||
std::vector<unsigned> root_index;
|
||||
base_gbm.DoBoost(grad_, hess_, train_->data, root_index);
|
||||
|
||||
// printf("xgboost_learner.h:UpdateOneIter\n");
|
||||
// const unsigned ndata = static_cast<unsigned>(train_->Size());
|
||||
// #pragma omp parallel for schedule( static )
|
||||
// for (unsigned j = 0; j < ndata; ++j) {
|
||||
// printf("haha:%d %f\n",j,base_gbm.Predict(train_->data, j, j));
|
||||
// }
|
||||
}
|
||||
|
||||
/*! \brief get intransformed prediction, without buffering */
|
||||
inline void Predict(std::vector<float> &preds, const DMatrix &data) {
|
||||
preds.resize(data.Size());
|
||||
|
||||
const unsigned ndata = static_cast<unsigned>(data.Size());
|
||||
#pragma omp parallel for schedule( static )
|
||||
#pragma omp parallel for schedule( static )
|
||||
for (unsigned j = 0; j < ndata; ++j) {
|
||||
preds[j] = base_gbm.Predict(data.data, j, -1);
|
||||
}
|
||||
preds[j] = base_gbm.Predict(data.data, j, -1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -194,7 +201,7 @@ namespace xgboost {
|
||||
inline void InteractPredict(std::vector<float> &preds, const DMatrix &data, unsigned buffer_offset) {
|
||||
preds.resize(data.Size());
|
||||
const unsigned ndata = static_cast<unsigned>(data.Size());
|
||||
#pragma omp parallel for schedule( static )
|
||||
#pragma omp parallel for schedule( static )
|
||||
for (unsigned j = 0; j < ndata; ++j) {
|
||||
preds[j] = base_gbm.InteractPredict(data.data, j, buffer_offset + j);
|
||||
}
|
||||
@@ -202,7 +209,7 @@ namespace xgboost {
|
||||
/*! \brief repredict trial */
|
||||
inline void InteractRePredict(const xgboost::base::DMatrix &data, unsigned buffer_offset) {
|
||||
const unsigned ndata = static_cast<unsigned>(data.Size());
|
||||
#pragma omp parallel for schedule( static )
|
||||
#pragma omp parallel for schedule( static )
|
||||
for (unsigned j = 0; j < ndata; ++j) {
|
||||
base_gbm.InteractRePredict(data.data, j, buffer_offset + j);
|
||||
}
|
||||
@@ -212,10 +219,11 @@ namespace xgboost {
|
||||
virtual inline void PredictBuffer(std::vector<float> &preds, const DMatrix &data, unsigned buffer_offset) {
|
||||
preds.resize(data.Size());
|
||||
const unsigned ndata = static_cast<unsigned>(data.Size());
|
||||
#pragma omp parallel for schedule( static )
|
||||
|
||||
#pragma omp parallel for schedule( static )
|
||||
for (unsigned j = 0; j < ndata; ++j) {
|
||||
preds[j] = base_gbm.Predict(data.data, j, buffer_offset + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief get the first order and second order gradient, given the transformed predictions and labels */
|
||||
@@ -248,7 +256,7 @@ namespace xgboost {
|
||||
* \param val value of the parameter
|
||||
*/
|
||||
inline void SetParam(const char *name, const char *val) {
|
||||
if (!strcmp("loss_type", name)) loss_type = atoi(val);
|
||||
if (!strcmp("loss_type", name)) loss_type = atoi(val);
|
||||
if (!strcmp("bst:num_feature", name)) num_feature = atoi(val);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user