This commit is contained in:
parent
96f8843694
commit
b78ad1e623
@ -98,6 +98,10 @@ inline void CalcPredictShape(bool strict_shape, PredictionType type, size_t rows
|
|||||||
forest = std::max(static_cast<decltype(forest)>(1), forest);
|
forest = std::max(static_cast<decltype(forest)>(1), forest);
|
||||||
shape[3] = forest;
|
shape[3] = forest;
|
||||||
*out_dim = shape.size();
|
*out_dim = shape.size();
|
||||||
|
} else if (chunksize == 1) {
|
||||||
|
*out_dim = 1;
|
||||||
|
shape.resize(*out_dim);
|
||||||
|
shape.front() = rows;
|
||||||
} else {
|
} else {
|
||||||
*out_dim = 2;
|
*out_dim = 2;
|
||||||
shape.resize(*out_dim);
|
shape.resize(*out_dim);
|
||||||
|
|||||||
@ -75,6 +75,11 @@ def run_predict_leaf(predictor):
|
|||||||
first = sliced[0, ...]
|
first = sliced[0, ...]
|
||||||
|
|
||||||
assert np.prod(first.shape) == classes * num_parallel_tree * ntree_limit
|
assert np.prod(first.shape) == classes * num_parallel_tree * ntree_limit
|
||||||
|
|
||||||
|
# When there's only 1 tree, the output is a 1 dim vector
|
||||||
|
booster = xgb.train({"tree_method": "hist"}, num_boost_round=1, dtrain=m)
|
||||||
|
assert booster.predict(m, pred_leaf=True).shape == (rows, )
|
||||||
|
|
||||||
return leaf
|
return leaf
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user