Debian Codegraph @

man/xgb.DataBatch.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/xgb.DMatrix.R
3 \name{xgb.DataBatch}
4 \alias{xgb.DataBatch}
5 \title{Structure for Data Batches}
6 \usage{
7 xgb.DataBatch(
8 data,
9 label = NULL,
10 weight = NULL,
11 base_margin = NULL,
12 feature_names = colnames(data),
13 feature_types = NULL,
14 group = NULL,
15 qid = NULL,
16 label_lower_bound = NULL,
17 label_upper_bound = NULL,
18 feature_weights = NULL
19 )
20 }
21 \arguments{
22 \item{data}{Batch of data belonging to this batch.
23
24 Note that not all of the input types supported by \code{\link[=xgb.DMatrix]{xgb.DMatrix()}} are possible
25 to pass here. Supported types are:
26 \itemize{
27 \item \code{matrix}, with types \code{numeric}, \code{integer}, and \code{logical}. Note that for types
28 \code{integer} and \code{logical}, missing values might not be automatically recognized as
29 as such - see the documentation for parameter \code{missing} in \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}}
30 for details on this.
31 \item \code{data.frame}, with the same types as supported by 'xgb.DMatrix' and same
32 conversions applied to it. See the documentation for parameter \code{data} in
33 \code{\link[=xgb.DMatrix]{xgb.DMatrix()}} for details on it.
34 \item CSR matrices, as class \code{dgRMatrix} from package "Matrix".
35 }}
36
37 \item{label}{Label of the training data. For classification problems, should be passed encoded as
38 integers with numeration starting at zero.}
39
40 \item{weight}{Weight for each instance.
41
42 Note that, for ranking task, weights are per-group. In ranking task, one weight
43 is assigned to each group (not each data point). This is because we
44 only care about the relative ordering of data points within each group,
45 so it doesn't make sense to assign weights to individual data points.}
46
47 \item{base_margin}{Base margin used for boosting from existing model.
48
49 In the case of multi-output models, one can also pass multi-dimensional base_margin.}
50
51 \item{feature_names}{Set names for features. Overrides column names in data frame and matrix.
52
53 Note: columns are not referenced by name when calling \code{predict}, so the column order there
54 must be the same as in the DMatrix construction, regardless of the column names.}
55
56 \item{feature_types}{Set types for features.
57
58 If \code{data} is a \code{data.frame} and passing \code{feature_types} is not supplied,
59 feature types will be deduced automatically from the column types.
60
61 Otherwise, one can pass a character vector with the same length as number of columns in \code{data},
62 with the following possible values:
63 \itemize{
64 \item "c", which represents categorical columns.
65 \item "q", which represents numeric columns.
66 \item "int", which represents integer columns.
67 \item "i", which represents logical (boolean) columns.
68 }
69
70 Note that, while categorical types are treated differently from the rest for model fitting
71 purposes, the other types do not influence the generated model, but have effects in other
72 functionalities such as feature importances.
73
74 \strong{Important}: Categorical features, if specified manually through \code{feature_types}, must
75 be encoded as integers with numeration starting at zero, and the same encoding needs to be
76 applied when passing data to \code{\link[=predict]{predict()}}. Even if passing \code{factor} types, the encoding will
77 not be saved, so make sure that \code{factor} columns passed to \code{predict} have the same \code{levels}.}
78
79 \item{group}{Group size for all ranking group.}
80
81 \item{qid}{Query ID for data samples, used for ranking.}
82
83 \item{label_lower_bound}{Lower bound for survival training.}
84
85 \item{label_upper_bound}{Upper bound for survival training.}
86
87 \item{feature_weights}{Set feature weights for column sampling.}
88 }
89 \value{
90 An object of class \code{xgb.DataBatch}, which is just a list containing the
91 data and parameters passed here. It does \strong{not} inherit from \code{xgb.DMatrix}.
92 }
93 \description{
94 Helper function to supply data in batches of a data iterator when
95 constructing a DMatrix from external memory through \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}}
96 or through \code{\link[=xgb.QuantileDMatrix.from_iterator]{xgb.QuantileDMatrix.from_iterator()}}.
97
98 This function is \strong{only} meant to be called inside of a callback function (which
99 is passed as argument to function \code{\link[=xgb.DataIter]{xgb.DataIter()}} to construct a data iterator)
100 when constructing a DMatrix through external memory - otherwise, one should call
101 \code{\link[=xgb.DMatrix]{xgb.DMatrix()}} or \code{\link[=xgb.QuantileDMatrix]{xgb.QuantileDMatrix()}}.
102
103 The object that results from calling this function directly is \strong{not} like
104 an \code{xgb.DMatrix} - i.e. cannot be used to train a model, nor to get predictions - only
105 possible usage is to supply data to an iterator, from which a DMatrix is then constructed.
106
107 For more information and for example usage, see the documentation for \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}}.
108 }
109 \seealso{
110 \code{\link[=xgb.DataIter]{xgb.DataIter()}}, \code{\link[=xgb.ExtMemDMatrix]{xgb.ExtMemDMatrix()}}.
111 }