Skip to content

Commit

Permalink
Add doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Mar 26, 2020
1 parent 2e45c77 commit 179fa88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions python-package/xgboost/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1526,27 +1526,28 @@ def inplace_predict(self, data, iteration_range=(0, 0),
Parameters
----------
data : numpy.ndarray/scipy.sparse.csr_matrix/cupy.ndarray
data : numpy.ndarray/scipy.sparse.csr_matrix/cupy.ndarray/
cudf.DataFrame/pd.DataFrame
The input data, must not be a view for numpy array. Set
``predictor`` to ``gpu_predictor`` for running prediction on CuPy
array.
array or CuDF DataFrame.
iteration_range : tuple
Specifies which layer of trees are used in prediction. For
example, if a random forest is trained with 100 rounds. Specifying
`iteration_range=(10, 20)`, then only the forest built during [10,
`iteration_range=(10, 20)`, then only the forests built during [10,
20) (open set) rounds are used in this prediction.
predict_type : str
* `value` Output model prediction values.
* `margin` Output the raw untransformed margin value.
missing :
missing value of data. Please refer to document for ``DMatrix``.
missing : float
Value in the input data which needs to be present as a missing
value.
Returns
-------
prediction : numpy.ndarray/cupy.ndarray
The prediction result. When input data is cupy array, prediction
result is also stored in a cupy array.
The prediction result. When input data is on GPU, prediction
result is stored in a cupy array.
'''

Expand Down
2 changes: 1 addition & 1 deletion src/predictor/cpu_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct SparsePageView {

explicit SparsePageView(SparsePage const *p)
: page{p}, base_rowid{page->base_rowid} {
// Pull to host before entering omp block, as this is not thread safe.
page->data.HostVector();
page->offset.HostVector();
}
Expand Down Expand Up @@ -110,7 +111,6 @@ void PredictBatchKernel(DataView batch, std::vector<bst_float> *out_preds,
constexpr int kUnroll = 8;
const auto nsize = static_cast<bst_omp_uint>(batch.Size());
const bst_omp_uint rest = nsize % kUnroll;
// Pull to host before entering omp block, as this is not thread safe.
if (nsize >= kUnroll) {
#pragma omp parallel for schedule(static)
for (bst_omp_uint i = 0; i < nsize - rest; i += kUnroll) {
Expand Down

0 comments on commit 179fa88

Please sign in to comment.