[jvm-packages] create dmatrix with specified missing value (#1272)
* create dmatrix with specified missing value * update dmlc-core * support for predict method in spark package repartitioning work around * add more elements to work around training set empty partition issue
This commit is contained in:
@@ -118,6 +118,19 @@ public class DMatrix {
|
||||
handle = out[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* create DMatrix from dense matrix
|
||||
* @param data data values
|
||||
* @param nrow number of rows
|
||||
* @param ncol number of columns
|
||||
* @param missing the specified value to represent the missing value
|
||||
*/
|
||||
public DMatrix(float[] data, int nrow, int ncol, float missing) throws XGBoostError {
|
||||
long[] out = new long[1];
|
||||
JNIErrorHandle.checkCall(XGBoostJNI.XGDMatrixCreateFromMat(data, nrow, ncol, missing, out));
|
||||
handle = out[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* used for DMatrix slice
|
||||
*/
|
||||
|
||||
@@ -67,6 +67,19 @@ class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
|
||||
this(new JDMatrix(data, nrow, ncol))
|
||||
}
|
||||
|
||||
/**
|
||||
* create DMatrix from dense matrix
|
||||
*
|
||||
* @param data data values
|
||||
* @param nrow number of rows
|
||||
* @param ncol number of columns
|
||||
* @param missing the specified value to represent the missing value
|
||||
*/
|
||||
@throws(classOf[XGBoostError])
|
||||
def this(data: Array[Float], nrow: Int, ncol: Int, missing: Float) {
|
||||
this(new JDMatrix(data, nrow, ncol, missing))
|
||||
}
|
||||
|
||||
/**
|
||||
* set label of dmatrix
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user