[jvm-packages] Robust dmatrix creation (#1613)

* add back train method but mark as deprecated

* robust matrix creation in jvm
This commit is contained in:
Nan Zhu
2016-09-26 13:35:04 -04:00
committed by GitHub
parent 915ac0b8fe
commit 37bc122c90
7 changed files with 197 additions and 20 deletions

View File

@@ -51,10 +51,27 @@ class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
* @param st sparse matrix type (CSR or CSC)
*/
@throws(classOf[XGBoostError])
@deprecated
def this(headers: Array[Long], indices: Array[Int], data: Array[Float], st: JDMatrix.SparseType) {
this(new JDMatrix(headers, indices, data, st))
}
/**
* create DMatrix from sparse matrix
*
* @param headers index to headers (rowHeaders for CSR or colHeaders for CSC)
* @param indices Indices (colIndexs for CSR or rowIndexs for CSC)
* @param data non zero values (sequence by row for CSR or by col for CSC)
* @param st sparse matrix type (CSR or CSC)
* @param shapeParam when st is CSR, it specifies the column number, otherwise it is taken as
* row number
*/
@throws(classOf[XGBoostError])
def this(headers: Array[Long], indices: Array[Int], data: Array[Float], st: JDMatrix.SparseType,
shapeParam: Int) {
this(new JDMatrix(headers, indices, data, st, shapeParam))
}
/**
* create DMatrix from dense matrix
*