public class DMatrix extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DMatrix.SparseType
sparse matrix type (CSR or CSC)
|
| Modifier and Type | Field and Description |
|---|---|
protected long |
handle |
| Modifier | Constructor and Description |
|---|---|
|
DMatrix(float[] data,
int nrow,
int ncol)
create DMatrix from dense matrix
|
|
DMatrix(float[] data,
int nrow,
int ncol,
float missing)
create DMatrix from dense matrix
|
|
DMatrix(Iterator<LabeledPoint> iter,
String cacheInfo)
Create DMatrix from iterator.
|
protected |
DMatrix(long handle)
used for DMatrix slice
|
|
DMatrix(long[] gdf_cols)
Create DMatrix from cuDF.
|
|
DMatrix(long[] headers,
int[] indices,
float[] data,
DMatrix.SparseType st)
Deprecated.
|
|
DMatrix(long[] headers,
int[] indices,
float[] data,
DMatrix.SparseType st,
int shapeParam)
Create DMatrix from Sparse matrix in CSR/CSC format.
|
|
DMatrix(long[] gdf_cols,
int gpu_id,
float missing)
Create DMatrix from cuDF.
|
|
DMatrix(String dataPath)
Create DMatrix by loading libsvm file from dataPath
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendCUDF(long[] gdf_cols)
Append CUDF to DMatrix
|
void |
appendCUDFInfo(String field,
long[] cols)
Append CUDF information for DMatrix
|
void |
dispose() |
protected void |
finalize() |
float[] |
getBaseMargin()
Get base margin of the DMatrix.
|
long |
getHandle()
Get the handle
|
float[] |
getLabel()
get label values
|
float[] |
getWeight()
get weight of the DMatrix
|
long |
rowNum()
get the row number of DMatrix
|
void |
saveBinary(String filePath)
save DMatrix to filePath
|
void |
setBaseMargin(float[] baseMargin)
Set base margin (initial prediction).
|
void |
setBaseMargin(float[][] baseMargin)
Set base margin (initial prediction).
|
void |
setCUDFInfo(String field,
long[] cols)
Set CUDF information for DMatrix.
|
void |
setGroup(int[] group)
Set group sizes of DMatrix (used for ranking)
|
void |
setLabel(float[] labels)
set label of dmatrix
|
void |
setWeight(float[] weights)
set weight of each instance
|
DMatrix |
slice(int[] rowIndex)
Slice the DMatrix and return a new DMatrix that only contains `rowIndex`.
|
public DMatrix(Iterator<LabeledPoint> iter, String cacheInfo) throws XGBoostError
iter - The data iterator of mini batch to provide the data.cacheInfo - Cache path information, used for external memory setting, can be null.XGBoostErrorpublic DMatrix(String dataPath) throws XGBoostError
dataPath - The path to the data.XGBoostError@Deprecated public DMatrix(long[] headers, int[] indices, float[] data, DMatrix.SparseType st) throws XGBoostError
headers - The row index of the matrix.indices - The indices of presenting entries.data - The data content.st - Type of sparsity.XGBoostErrorpublic DMatrix(long[] headers,
int[] indices,
float[] data,
DMatrix.SparseType st,
int shapeParam)
throws XGBoostError
headers - The row index of the matrix.indices - The indices of presenting entries.data - The data content.st - Type of sparsity.shapeParam - when st is CSR, it specifies the column number, otherwise it is taken as
row numberXGBoostErrorpublic DMatrix(float[] data,
int nrow,
int ncol)
throws XGBoostError
data - data valuesnrow - number of rowsncol - number of columnsXGBoostError - native errorpublic DMatrix(float[] data,
int nrow,
int ncol,
float missing)
throws XGBoostError
data - data valuesnrow - number of rowsncol - number of columnsmissing - the specified value to represent the missing valueXGBoostErrorprotected DMatrix(long handle)
public DMatrix(long[] gdf_cols)
throws XGBoostError
gdf_cols - The native handles of GDF columnsXGBoostError - native errorpublic DMatrix(long[] gdf_cols,
int gpu_id,
float missing)
throws XGBoostError
gdf_cols - The native handles of GDF columnsgpu_id - The gpu id to useXGBoostError - native errorpublic void appendCUDF(long[] gdf_cols)
throws XGBoostError
gdf_cols - XGBoostErrorpublic void setCUDFInfo(String field, long[] cols) throws XGBoostError
field - The name of this info, such as "label" or "weight"cols - The native handles of GDF columnsXGBoostError - native errorpublic void appendCUDFInfo(String field, long[] cols) throws XGBoostError
field - cols - XGBoostErrorpublic void setLabel(float[] labels)
throws XGBoostError
labels - labelsXGBoostError - native errorpublic void setWeight(float[] weights)
throws XGBoostError
weights - weightsXGBoostError - native errorpublic void setBaseMargin(float[] baseMargin)
throws XGBoostError
XGBoostErrorpublic void setBaseMargin(float[][] baseMargin)
throws XGBoostError
XGBoostErrorpublic void setGroup(int[] group)
throws XGBoostError
group - group size as arrayXGBoostError - native errorpublic float[] getLabel()
throws XGBoostError
XGBoostError - native errorpublic float[] getWeight()
throws XGBoostError
XGBoostError - native errorpublic float[] getBaseMargin()
throws XGBoostError
XGBoostErrorpublic DMatrix slice(int[] rowIndex) throws XGBoostError
rowIndex - row indexXGBoostError - native errorpublic long rowNum()
throws XGBoostError
XGBoostError - native errorpublic void saveBinary(String filePath)
public long getHandle()
public void dispose()
Copyright © 2019. All rights reserved.