Move prediction cache to Learner. (#5220)
* Move prediction cache into Learner. * Clean-ups - Remove duplicated cache in Learner and GBM. - Remove ad-hoc fix of invalid cache. - Remove `PredictFromCache` in predictors. - Remove prediction cache for linear altogether, as it's only moving the prediction into training process but doesn't provide any actual overall speed gain. - The cache is now unique to Learner, which means the ownership is no longer shared by any other components. * Changes - Add version to prediction cache. - Use weak ptr to check expired DMatrix. - Pass shared pointer instead of raw pointer.
This commit is contained in:
@@ -16,16 +16,13 @@
|
||||
|
||||
#include <dmlc/filesystem.h>
|
||||
#include <xgboost/base.h>
|
||||
#include <xgboost/objective.h>
|
||||
#include <xgboost/metric.h>
|
||||
#include <xgboost/json.h>
|
||||
#include <xgboost/predictor.h>
|
||||
#include <xgboost/generic_parameters.h>
|
||||
#include <xgboost/c_api.h>
|
||||
#include <xgboost/learner.h>
|
||||
|
||||
#include "../../src/common/common.h"
|
||||
#include "../../src/common/hist_util.h"
|
||||
#include "../../src/gbm/gbtree_model.h"
|
||||
#if defined(__CUDACC__)
|
||||
#include "../../src/data/ellpack_page.cuh"
|
||||
#endif
|
||||
@@ -42,6 +39,12 @@
|
||||
#define GPUIDX -1
|
||||
#endif
|
||||
|
||||
namespace xgboost {
|
||||
class ObjFunction;
|
||||
class Metric;
|
||||
struct LearnerModelParam;
|
||||
}
|
||||
|
||||
bool FileExists(const std::string& filename);
|
||||
|
||||
int64_t GetFileSize(const std::string& filename);
|
||||
@@ -206,7 +209,7 @@ std::unique_ptr<DMatrix> CreateSparsePageDMatrixWithRC(
|
||||
size_t n_rows, size_t n_cols, size_t page_size, bool deterministic,
|
||||
const dmlc::TemporaryDirectory& tempdir = dmlc::TemporaryDirectory());
|
||||
|
||||
gbm::GBTreeModel CreateTestModel(LearnerModelParam const* param);
|
||||
gbm::GBTreeModel CreateTestModel(LearnerModelParam const* param, size_t n_classes = 1);
|
||||
|
||||
std::unique_ptr<GradientBooster> CreateTrainedGBM(
|
||||
std::string name, Args kwargs, size_t kRows, size_t kCols,
|
||||
|
||||
Reference in New Issue
Block a user