Fix typo. (#7433)
This commit is contained in:
parent
a7057fa64c
commit
d4274bc556
@ -93,7 +93,7 @@ class MetaInfo {
|
|||||||
* \brief Weight of each feature, used to define the probability of each feature being
|
* \brief Weight of each feature, used to define the probability of each feature being
|
||||||
* selected when using column sampling.
|
* selected when using column sampling.
|
||||||
*/
|
*/
|
||||||
HostDeviceVector<float> feature_weigths;
|
HostDeviceVector<float> feature_weights;
|
||||||
|
|
||||||
/*! \brief default constructor */
|
/*! \brief default constructor */
|
||||||
MetaInfo() = default;
|
MetaInfo() = default;
|
||||||
|
|||||||
@ -297,8 +297,8 @@ MetaInfo MetaInfo::Slice(common::Span<int32_t const> ridxs) const {
|
|||||||
out.base_margin_.HostVector() = Gather(this->base_margin_.HostVector(), ridxs);
|
out.base_margin_.HostVector() = Gather(this->base_margin_.HostVector(), ridxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.feature_weigths.Resize(this->feature_weigths.Size());
|
out.feature_weights.Resize(this->feature_weights.Size());
|
||||||
out.feature_weigths.Copy(this->feature_weigths);
|
out.feature_weights.Copy(this->feature_weights);
|
||||||
|
|
||||||
out.feature_names = this->feature_names;
|
out.feature_names = this->feature_names;
|
||||||
out.feature_types.Resize(this->feature_types.Size());
|
out.feature_types.Resize(this->feature_types.Size());
|
||||||
@ -431,7 +431,7 @@ void MetaInfo::SetInfo(const char* key, const void* dptr, DataType dtype, size_t
|
|||||||
DISPATCH_CONST_PTR(dtype, dptr, cast_dptr,
|
DISPATCH_CONST_PTR(dtype, dptr, cast_dptr,
|
||||||
std::copy(cast_dptr, cast_dptr + num, labels.begin()));
|
std::copy(cast_dptr, cast_dptr + num, labels.begin()));
|
||||||
} else if (!std::strcmp(key, "feature_weights")) {
|
} else if (!std::strcmp(key, "feature_weights")) {
|
||||||
auto &h_feature_weights = feature_weigths.HostVector();
|
auto &h_feature_weights = feature_weights.HostVector();
|
||||||
h_feature_weights.resize(num);
|
h_feature_weights.resize(num);
|
||||||
DISPATCH_CONST_PTR(
|
DISPATCH_CONST_PTR(
|
||||||
dtype, dptr, cast_dptr,
|
dtype, dptr, cast_dptr,
|
||||||
@ -460,7 +460,7 @@ void MetaInfo::GetInfo(char const *key, bst_ulong *out_len, DataType dtype,
|
|||||||
} else if (!std::strcmp(key, "label_upper_bound")) {
|
} else if (!std::strcmp(key, "label_upper_bound")) {
|
||||||
vec = &this->labels_upper_bound_.HostVector();
|
vec = &this->labels_upper_bound_.HostVector();
|
||||||
} else if (!std::strcmp(key, "feature_weights")) {
|
} else if (!std::strcmp(key, "feature_weights")) {
|
||||||
vec = &this->feature_weigths.HostVector();
|
vec = &this->feature_weights.HostVector();
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Unknown float field name: " << key;
|
LOG(FATAL) << "Unknown float field name: " << key;
|
||||||
}
|
}
|
||||||
@ -566,10 +566,10 @@ void MetaInfo::Extend(MetaInfo const& that, bool accumulate_rows, bool check_col
|
|||||||
auto &h_feature_types = feature_types.HostVector();
|
auto &h_feature_types = feature_types.HostVector();
|
||||||
LoadFeatureType(this->feature_type_names, &h_feature_types);
|
LoadFeatureType(this->feature_type_names, &h_feature_types);
|
||||||
}
|
}
|
||||||
if (!that.feature_weigths.Empty()) {
|
if (!that.feature_weights.Empty()) {
|
||||||
this->feature_weigths.Resize(that.feature_weigths.Size());
|
this->feature_weights.Resize(that.feature_weights.Size());
|
||||||
this->feature_weigths.SetDevice(that.feature_weigths.DeviceIdx());
|
this->feature_weights.SetDevice(that.feature_weights.DeviceIdx());
|
||||||
this->feature_weigths.Copy(that.feature_weigths);
|
this->feature_weights.Copy(that.feature_weights);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,10 +612,10 @@ void MetaInfo::Validate(int32_t device) const {
|
|||||||
check_device(labels_lower_bound_);
|
check_device(labels_lower_bound_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (feature_weigths.Size() != 0) {
|
if (feature_weights.Size() != 0) {
|
||||||
CHECK_EQ(feature_weigths.Size(), num_col_)
|
CHECK_EQ(feature_weights.Size(), num_col_)
|
||||||
<< "Size of feature_weights must equal to number of columns.";
|
<< "Size of feature_weights must equal to number of columns.";
|
||||||
check_device(feature_weigths);
|
check_device(feature_weights);
|
||||||
}
|
}
|
||||||
if (labels_upper_bound_.Size() != 0) {
|
if (labels_upper_bound_.Size() != 0) {
|
||||||
CHECK_EQ(labels_upper_bound_.Size(), num_row_)
|
CHECK_EQ(labels_upper_bound_.Size(), num_row_)
|
||||||
|
|||||||
@ -177,8 +177,8 @@ void MetaInfo::SetInfo(const char * c_key, std::string const& interface_str) {
|
|||||||
CopyInfoImpl(array_interface, &labels_upper_bound_);
|
CopyInfoImpl(array_interface, &labels_upper_bound_);
|
||||||
return;
|
return;
|
||||||
} else if (key == "feature_weights") {
|
} else if (key == "feature_weights") {
|
||||||
CopyInfoImpl(array_interface, &feature_weigths);
|
CopyInfoImpl(array_interface, &feature_weights);
|
||||||
auto d_feature_weights = feature_weigths.ConstDeviceSpan();
|
auto d_feature_weights = feature_weights.ConstDeviceSpan();
|
||||||
auto valid = thrust::none_of(
|
auto valid = thrust::none_of(
|
||||||
thrust::device, d_feature_weights.data(),
|
thrust::device, d_feature_weights.data(),
|
||||||
d_feature_weights.data() + d_feature_weights.size(), WeightsCheck{});
|
d_feature_weights.data() + d_feature_weights.size(), WeightsCheck{});
|
||||||
|
|||||||
@ -375,7 +375,7 @@ template <typename GradientSumT, typename ExpandEntry> class HistEvaluator {
|
|||||||
n_threads_{n_threads},
|
n_threads_{n_threads},
|
||||||
task_{task} {
|
task_{task} {
|
||||||
interaction_constraints_.Configure(param, info.num_col_);
|
interaction_constraints_.Configure(param, info.num_col_);
|
||||||
column_sampler_->Init(info.num_col_, info.feature_weigths.HostVector(),
|
column_sampler_->Init(info.num_col_, info.feature_weights.HostVector(),
|
||||||
param_.colsample_bynode, param_.colsample_bylevel,
|
param_.colsample_bynode, param_.colsample_bylevel,
|
||||||
param_.colsample_bytree, skip_0_index);
|
param_.colsample_bytree, skip_0_index);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -229,8 +229,7 @@ class ColMaker: public TreeUpdater {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
column_sampler_.Init(fmat.Info().num_col_,
|
column_sampler_.Init(fmat.Info().num_col_, fmat.Info().feature_weights.ConstHostVector(),
|
||||||
fmat.Info().feature_weigths.ConstHostVector(),
|
|
||||||
param_.colsample_bynode, param_.colsample_bylevel,
|
param_.colsample_bynode, param_.colsample_bylevel,
|
||||||
param_.colsample_bytree);
|
param_.colsample_bytree);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -233,7 +233,7 @@ struct GPUHistMakerDevice {
|
|||||||
// thread safe
|
// thread safe
|
||||||
void Reset(HostDeviceVector<GradientPair>* dh_gpair, DMatrix* dmat, int64_t num_columns) {
|
void Reset(HostDeviceVector<GradientPair>* dh_gpair, DMatrix* dmat, int64_t num_columns) {
|
||||||
auto const& info = dmat->Info();
|
auto const& info = dmat->Info();
|
||||||
this->column_sampler.Init(num_columns, info.feature_weigths.HostVector(),
|
this->column_sampler.Init(num_columns, info.feature_weights.HostVector(),
|
||||||
param.colsample_bynode, param.colsample_bylevel,
|
param.colsample_bynode, param.colsample_bylevel,
|
||||||
param.colsample_bytree);
|
param.colsample_bytree);
|
||||||
dh::safe_cuda(cudaSetDevice(device_id));
|
dh::safe_cuda(cudaSetDevice(device_id));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user