Peter-Devine / test_repo_0

A repo purely for testing Github API functions
0 stars 0 forks source link

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

Open Peter-Devine opened 4 years ago

Peter-Devine commented 4 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.

Peter-Devine commented 4 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)
          }