komiya-atsushi / xgboost-predictor-java

Pure Java implementation of XGBoost predictor for online prediction tasks.
Apache License 2.0
339 stars 109 forks source link

predictor-spark work with model built from scala libs #18

Open shaowei-su opened 7 years ago

shaowei-su commented 7 years ago

hi Komiya, This is a very interesting project you've built! I have one question: is it possible to load model built from "ml.dmlc.xgboost4j.scala.{XGBoost, DMatrix}" libraries with the predictor-spark package?

I was able to do this without error but the model looks strange to me: scala> model.numFeatures res15: Int = -1

and the prediction results are completely wrong.

Thanks.

shaowei-su commented 7 years ago

basically it can not load spark model info correctly:

scala> pred.getSparkModelParam
res28: biz.k11i.xgboost.spark.SparkModelParam = null

then the model can not be reconstructed

      xgboostPredictor.getSparkModelParam match {
        case param: SparkModelParam =>
          val model = param.getModelType match {
            case "_cls_" => loadClassificationModel(xgboostPredictor, param)
            case "_reg_" => loadRegressionModel(xgboostPredictor, param)
          }