DMatrix
¶An opaque data matrix class. The actual object is stored in the C++ object handle.
Hyunsu Cho
DMatrix
(float[] data, int[] col_ind, long[] row_ptr, long num_row, long num_col)¶Create a data matrix representing a 2D sparse matrix
data – nonzero (non-missing) entries, float32 type
col_ind – corresponding column indices, should be of same length as data
row_ptr – offsets to define each instance, should be of length [num_row]+1
num_row – number of rows (data points) in the matrix
num_col – number of columns (features) in the matrix
TreeliteError – error during matrix construction
DMatrix
(double[] data, int[] col_ind, long[] row_ptr, long num_row, long num_col)¶DMatrix
(float[] data, float missing_value, long num_row, long num_col)¶Create a data matrix representing a 2D dense matrix
data – array of entries, should be of length [num_row]*[num_col]
and of float32 type
missing_value – floating-point value representing a missing value; usually set of Float.NaN
.
num_row – number of rows (data instances) in the matrix
num_col – number of columns (features) in the matrix
TreeliteError – error during matrix construction
DMatrix
(double[] data, double missing_value, long num_row, long num_col)¶Create a data matrix representing a 2D dense matrix (float64 type)
data – array of entries, should be of length [num_row]*[num_col]
and of float64 type
missing_value – floating-point value representing a missing value; usually set of Double.NaN
.
num_row – number of rows (data instances) in the matrix
num_col – number of columns (features) in the matrix
TreeliteError – error during matrix construction
dispose
()¶Destructor, to be called when the object is garbage collected
finalize
()¶getHandle
()¶Get the underlying native handle
Integer representing memory address
getNumCol
()¶Get the number of columns in the matrix
Number of columns in the matrix
getNumElements
()¶Get the number of elements in the matrix
Number of elements in the matrix
getNumRow
()¶Get the number of rows in the matrix
Number of rows in the matrix