Skip to content

Commit

Permalink
Copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jul 31, 2020
1 parent 597ff8b commit 04eb3b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/xgboost/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ class MetaInfo {

this->labels_upper_bound_.Resize(that.labels_upper_bound_.Size());
this->labels_upper_bound_.Copy(that.labels_upper_bound_);

this->feature_weigths.Resize(that.feature_weigths.Size());
this->feature_weigths.Copy(that.feature_weigths);

this->feature_names = that.feature_names;
this->feature_type_names = that.feature_type_names;
this->feature_types.Resize(that.feature_types.Size());
this->feature_types.Copy(that.feature_types);
return *this;
}

Expand Down
10 changes: 10 additions & 0 deletions src/data/data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ void MetaInfo::Extend(MetaInfo const& that, bool accumulate_rows) {
auto &h_feature_types = feature_types.HostVector();
LoadFeatureType(this->feature_type_names, &h_feature_types);
}
if (!that.feature_weigths.Empty()) {
this->feature_weigths.Resize(that.feature_weigths.Size());
this->feature_weigths.SetDevice(that.feature_weigths.DeviceIdx());
this->feature_weigths.Copy(that.feature_weigths);
}
}

void MetaInfo::Validate(int32_t device) const {
Expand Down Expand Up @@ -588,6 +593,11 @@ void MetaInfo::Validate(int32_t device) const {
check_device(labels_lower_bound_);
return;
}
if (feature_weigths.Size() != 0) {
CHECK_EQ(feature_weigths.Size(), num_col_)
<< "Size of label_lower_bound must equal to number of rows.";
check_device(feature_weigths);
}
if (labels_upper_bound_.Size() != 0) {
CHECK_EQ(labels_upper_bound_.Size(), num_row_)
<< "Size of label_upper_bound must equal to number of rows.";
Expand Down

0 comments on commit 04eb3b4

Please sign in to comment.