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(BigDenseMatrix matrix)
create DMatrix from a BigDenseMatrix
|
|
DMatrix(BigDenseMatrix matrix,
float missing)
create DMatrix from dense matrix
|
|
DMatrix(ColumnBatch columnBatch,
float missing,
int nthread)
Create the normal DMatrix from column array interface
|
|
DMatrix(float[] data,
int nrow,
int ncol)
Deprecated.
Please specify the missing value explicitly using
DMatrix(float[], int, int, float) |
|
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[] 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(String dataPath)
Create DMatrix by loading libsvm file from dataPath
|
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
protected void |
finalize() |
float[] |
getBaseMargin()
Get base margin of the DMatrix.
|
int[] |
getGroup()
Get group sizes of 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(Column column)
Set base margin of DMatrix from cuda array interface
|
void |
setBaseMargin(float[] baseMargin)
Set base margin (initial prediction).
|
void |
setBaseMargin(float[][] baseMargin)
Set base margin (initial prediction).
|
void |
setGroup(int[] group)
Set group sizes of DMatrix (used for ranking)
|
void |
setLabel(Column column)
Set label of DMatrix from cuda array interface
|
void |
setLabel(float[] labels)
set label of dmatrix
|
void |
setWeight(Column column)
Set weight of DMatrix from cuda array interface
|
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.XGBoostError
public 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.XGBoostError
public 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 numberXGBoostError
@Deprecated public DMatrix(float[] data, int nrow, int ncol) throws XGBoostError
DMatrix(float[], int, int, float)
data
- data valuesnrow
- number of rowsncol
- number of columnsXGBoostError
- native errorpublic DMatrix(BigDenseMatrix matrix) throws XGBoostError
matrix
- instance of BigDenseMatrixXGBoostError
- 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 valueXGBoostError
public DMatrix(BigDenseMatrix matrix, float missing) throws XGBoostError
matrix
- instance of BigDenseMatrixmissing
- the specified value to represent the missing valueXGBoostError
protected DMatrix(long handle)
public DMatrix(ColumnBatch columnBatch, float missing, int nthread) throws XGBoostError
columnBatch
- the XGBoost ColumnBatch to provide the cuda array interface
of feature columnsmissing
- missing valuenthread
- threads numberXGBoostError
public void setLabel(Column column) throws XGBoostError
column
- the XGBoost Column to provide the cuda array interface
of label columnXGBoostError
- native errorpublic void setWeight(Column column) throws XGBoostError
column
- the XGBoost Column to provide the cuda array interface
of weight columnXGBoostError
- native errorpublic void setBaseMargin(Column column) throws XGBoostError
column
- the XGBoost Column to provide the cuda array interface
of base margin columnXGBoostError
- native errorpublic 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
XGBoostError
public void setBaseMargin(float[][] baseMargin) throws XGBoostError
XGBoostError
public void setGroup(int[] group) throws XGBoostError
group
- group size as arrayXGBoostError
- native errorpublic int[] getGroup() throws XGBoostError
XGBoostError
- native errorpublic float[] getLabel() throws XGBoostError
XGBoostError
- native errorpublic float[] getWeight() throws XGBoostError
XGBoostError
- native errorpublic float[] getBaseMargin() throws XGBoostError
XGBoostError
public 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 © 2022. All rights reserved.