Skip to content

Instantly share code, notes, and snippets.

@a-agmon
Created July 5, 2022 18:08
Show Gist options
  • Save a-agmon/398d955e061522b2dd6ff4223fcdb2b4 to your computer and use it in GitHub Desktop.
Save a-agmon/398d955e061522b2dd6ff4223fcdb2b4 to your computer and use it in GitHub Desktop.
import ml.dmlc.xgboost4j.LabeledPoint
import ml.dmlc.xgboost4j.scala.{Booster, DMatrix, XGBoost}
// Load model from binary file
object Classifier {
var model: Option[Booster] = None
def Init(modelFile:String): Unit = {
if (model.isEmpty) {
model = Some(XGBoost.loadModel(modelFile))
logger.info(s"Model loaded from $modelFile")
}
}
//.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment