Pass DMatrix into metric for caching. (#8790)
This commit is contained in:
@@ -32,6 +32,8 @@ class DMatrixCache {
|
||||
CacheT& Value() { return *value; }
|
||||
};
|
||||
|
||||
static constexpr std::size_t DefaultSize() { return 32; }
|
||||
|
||||
protected:
|
||||
std::unordered_map<DMatrix const*, Item> container_;
|
||||
std::queue<DMatrix const*> queue_;
|
||||
|
||||
@@ -54,12 +54,15 @@ class Metric : public Configurable {
|
||||
out["name"] = String(this->Name());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief evaluate a specific metric
|
||||
* \param preds prediction
|
||||
* \param info information, including label etc.
|
||||
/**
|
||||
* \brief Evaluate a metric with DMatrix as input.
|
||||
*
|
||||
* \param preds Prediction
|
||||
* \param p_fmat DMatrix that contains related information like labels.
|
||||
*/
|
||||
virtual double Eval(const HostDeviceVector<bst_float>& preds, const MetaInfo& info) = 0;
|
||||
virtual double Evaluate(HostDeviceVector<bst_float> const& preds,
|
||||
std::shared_ptr<DMatrix> p_fmat) = 0;
|
||||
|
||||
/*! \return name of metric */
|
||||
virtual const char* Name() const = 0;
|
||||
/*! \brief virtual destructor */
|
||||
|
||||
Reference in New Issue
Block a user