| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/xgb.DMatrix.R |
| 3 |
\name{xgb.QuantileDMatrix.from_iterator} |
| 4 |
\alias{xgb.QuantileDMatrix.from_iterator} |
| 5 |
\title{QuantileDMatrix from External Data} |
| 6 |
\usage{ |
| 7 |
xgb.QuantileDMatrix.from_iterator( |
| 8 |
data_iterator, |
| 9 |
missing = NA, |
| 10 |
nthread = NULL, |
| 11 |
ref = NULL, |
| 12 |
max_bin = NULL |
| 13 |
) |
| 14 |
} |
| 15 |
\arguments{ |
| 16 |
\item{data_iterator}{A data iterator structure as returned by \code{\link[=xgb.DataIter]{xgb.DataIter()}}, |
| 17 |
which includes an environment shared between function calls, and functions to access |
| 18 |
the data in batches on-demand.} |
| 19 |
|
| 20 |
\item{missing}{A float value to represents missing values in data. |
| 21 |
|
| 22 |
Note that, while functions like \code{\link[=xgb.DMatrix]{xgb.DMatrix()}} can take a generic \code{NA} and interpret it |
| 23 |
correctly for different types like \code{numeric} and \code{integer}, if an \code{NA} value is passed here, |
| 24 |
it will not be adapted for different input types. |
| 25 |
|
| 26 |
For example, in R \code{integer} types, missing values are represented by integer number \code{-2147483648} |
| 27 |
(since machine 'integer' types do not have an inherent 'NA' value) - hence, if one passes \code{NA}, |
| 28 |
which is interpreted as a floating-point NaN by \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}} and by |
| 29 |
\code{\link[=xgb.QuantileDMatrix.from_iterator]{xgb.QuantileDMatrix.from_iterator()}}, these integer missing values will not be treated as missing. |
| 30 |
This should not pose any problem for \code{numeric} types, since they do have an inheret NaN value.} |
| 31 |
|
| 32 |
\item{nthread}{Number of threads used for creating DMatrix.} |
| 33 |
|
| 34 |
\item{ref}{The training dataset that provides quantile information, needed when creating |
| 35 |
validation/test dataset with \code{\link[=xgb.QuantileDMatrix]{xgb.QuantileDMatrix()}}. Supplying the training DMatrix |
| 36 |
as a reference means that the same quantisation applied to the training data is |
| 37 |
applied to the validation/test data} |
| 38 |
|
| 39 |
\item{max_bin}{The number of histogram bin, should be consistent with the training parameter |
| 40 |
\code{max_bin}. |
| 41 |
|
| 42 |
This is only supported when constructing a QuantileDMatrix.} |
| 43 |
} |
| 44 |
\value{ |
| 45 |
An 'xgb.DMatrix' object, with subclass 'xgb.QuantileDMatrix'. |
| 46 |
} |
| 47 |
\description{ |
| 48 |
Create an \code{xgb.QuantileDMatrix} object (exact same class as would be returned by |
| 49 |
calling function \code{\link[=xgb.QuantileDMatrix]{xgb.QuantileDMatrix()}}, with the same advantages and limitations) from |
| 50 |
external data supplied by \code{\link[=xgb.DataIter]{xgb.DataIter()}}, potentially passed in batches from |
| 51 |
a bigger set that might not fit entirely in memory, same way as \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}}. |
| 52 |
|
| 53 |
Note that, while external data will only be loaded through the iterator (thus the full data |
| 54 |
might not be held entirely in-memory), the quantized representation of the data will get |
| 55 |
created in-memory, being concatenated from multiple calls to the data iterator. The quantized |
| 56 |
version is typically lighter than the original data, so there might be cases in which this |
| 57 |
representation could potentially fit in memory even if the full data does not. |
| 58 |
|
| 59 |
For more information, see the guide 'Using XGBoost External Memory Version': |
| 60 |
\url{https://xgboost.readthedocs.io/en/stable/tutorials/external_memory.html} |
| 61 |
} |
| 62 |
\seealso{ |
| 63 |
\code{\link[=xgb.DataIter]{xgb.DataIter()}}, \code{\link[=xgb.DataBatch]{xgb.DataBatch()}}, \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}}, |
| 64 |
\code{\link[=xgb.QuantileDMatrix]{xgb.QuantileDMatrix()}} |
| 65 |
} |