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
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
|
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)
if specified, xgboost will start from this init margin can be used to specify initial prediction to boost from
|
void |
setBaseMargin(float[][] baseMargin)
if specified, xgboost will start from this init margin can be used to specify initial prediction to boost from
|
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(Iteratoriter, 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 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
baseMargin - base marginXGBoostError - native errorpublic void setBaseMargin(float[][] baseMargin)
throws XGBoostError
baseMargin - base marginXGBoostError - native errorpublic 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
XGBoostError - native errorpublic 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()
protected void finalize()
finalize in class Object
public void dispose()
Copyright © 2016. All rights reserved.