Feature weights (#5962)
This commit is contained in:
@@ -483,6 +483,34 @@ XGB_DLL int XGDMatrixGetStrFeatureInfo(DMatrixHandle handle, const char *field,
|
||||
bst_ulong *size,
|
||||
const char ***out_features);
|
||||
|
||||
/*!
|
||||
* \brief Set meta info from dense matrix. Valid field names are:
|
||||
*
|
||||
* - label
|
||||
* - weight
|
||||
* - base_margin
|
||||
* - group
|
||||
* - label_lower_bound
|
||||
* - label_upper_bound
|
||||
* - feature_weights
|
||||
*
|
||||
* \param handle An instance of data matrix
|
||||
* \param field Feild name
|
||||
* \param data Pointer to consecutive memory storing data.
|
||||
* \param size Size of the data, this is relative to size of type. (Meaning NOT number
|
||||
* of bytes.)
|
||||
* \param type Indicator of data type. This is defined in xgboost::DataType enum class.
|
||||
*
|
||||
* float = 1
|
||||
* double = 2
|
||||
* uint32_t = 3
|
||||
* uint64_t = 4
|
||||
*
|
||||
* \return 0 when success, -1 when failure happens
|
||||
*/
|
||||
XGB_DLL int XGDMatrixSetDenseInfo(DMatrixHandle handle, const char *field,
|
||||
void *data, bst_ulong size, int type);
|
||||
|
||||
/*!
|
||||
* \brief (deprecated) Use XGDMatrixSetUIntInfo instead. Set group of the training matrix
|
||||
* \param handle a instance of data matrix
|
||||
|
||||
@@ -88,34 +88,17 @@ class MetaInfo {
|
||||
* \brief Type of each feature. Automatically set when feature_type_names is specifed.
|
||||
*/
|
||||
HostDeviceVector<FeatureType> feature_types;
|
||||
/*
|
||||
* \brief Weight of each feature, used to define the probability of each feature being
|
||||
* selected when using column sampling.
|
||||
*/
|
||||
HostDeviceVector<float> feature_weigths;
|
||||
|
||||
/*! \brief default constructor */
|
||||
MetaInfo() = default;
|
||||
MetaInfo(MetaInfo&& that) = default;
|
||||
MetaInfo& operator=(MetaInfo&& that) = default;
|
||||
MetaInfo& operator=(MetaInfo const& that) {
|
||||
this->num_row_ = that.num_row_;
|
||||
this->num_col_ = that.num_col_;
|
||||
this->num_nonzero_ = that.num_nonzero_;
|
||||
|
||||
this->labels_.Resize(that.labels_.Size());
|
||||
this->labels_.Copy(that.labels_);
|
||||
|
||||
this->group_ptr_ = that.group_ptr_;
|
||||
|
||||
this->weights_.Resize(that.weights_.Size());
|
||||
this->weights_.Copy(that.weights_);
|
||||
|
||||
this->base_margin_.Resize(that.base_margin_.Size());
|
||||
this->base_margin_.Copy(that.base_margin_);
|
||||
|
||||
this->labels_lower_bound_.Resize(that.labels_lower_bound_.Size());
|
||||
this->labels_lower_bound_.Copy(that.labels_lower_bound_);
|
||||
|
||||
this->labels_upper_bound_.Resize(that.labels_upper_bound_.Size());
|
||||
this->labels_upper_bound_.Copy(that.labels_upper_bound_);
|
||||
return *this;
|
||||
}
|
||||
MetaInfo& operator=(MetaInfo const& that) = delete;
|
||||
|
||||
/*!
|
||||
* \brief Validate all metainfo.
|
||||
|
||||
Reference in New Issue
Block a user