[JVM] Add LabeledPoint read support
fix
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package ml.dmlc.xgboost4j.scala
|
||||
|
||||
import _root_.scala.collection.JavaConverters._
|
||||
|
||||
import ml.dmlc.xgboost4j.LabeledPoint
|
||||
import ml.dmlc.xgboost4j.java.{DMatrix => JDMatrix, DataBatch, XGBoostError}
|
||||
|
||||
class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
|
||||
@@ -31,6 +31,17 @@ class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
|
||||
this(new JDMatrix(dataPath))
|
||||
}
|
||||
|
||||
/**
|
||||
* init DMatrix from Iterator of LabeledPoint
|
||||
*
|
||||
* @param dataIter An iterator of LabeledPoint
|
||||
* @param cacheInfo Cache path information, used for external memory setting, can be null.
|
||||
* @throws XGBoostError native error
|
||||
*/
|
||||
def this(dataIter: Iterator[LabeledPoint], cacheInfo: String) {
|
||||
this(new JDMatrix(dataIter.asJava, cacheInfo))
|
||||
}
|
||||
|
||||
/**
|
||||
* create DMatrix from sparse matrix
|
||||
*
|
||||
@@ -44,10 +55,6 @@ class DMatrix private[scala](private[scala] val jDMatrix: JDMatrix) {
|
||||
this(new JDMatrix(headers, indices, data, st))
|
||||
}
|
||||
|
||||
private[xgboost4j] def this(dataBatches: Iterator[DataBatch]) {
|
||||
this(new JDMatrix(dataBatches.asJava, null))
|
||||
}
|
||||
|
||||
/**
|
||||
* create DMatrix from dense matrix
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user