Skip to content

Commit

Permalink
Empty dmatrix.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Aug 23, 2022
1 parent 8a86811 commit 8b55e9c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/objective/regression_obj.cu
Expand Up @@ -707,6 +707,11 @@ class MeanAbsoluteError : public ObjFunction {
CheckInitInputs(info);
base_margin->Reshape(1);
auto h_base_margin = base_margin->HostView();
if (info.num_row_ == 0) {
h_base_margin(0) = DefaultBaseScore();
return;
}

if (ctx_->IsCPU()) {
h_base_margin(0) = common::Median(ctx_, info.labels.HostView(),
common::OptionalWeights{info.weights_.ConstHostSpan()});
Expand Down

0 comments on commit 8b55e9c

Please sign in to comment.