Last active
July 6, 2022 09:04
-
-
Save a-agmon/48d5d773ab8b0257c40b683002c78bce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def getInputVector(rawVector:Seq[Float]): DMatrix = { | |
val nRows = 1 | |
val nCols = rawVector.length | |
val missingVal = Float.NaN | |
new DMatrix(rawVector.toArray[Float], nRows, nCols, missingVal) | |
} | |
def predict(recordID:String, features:Seq[Float]): (String, Float) = { | |
val xgbInput = getInputVector(features) | |
val result:Array[Array[Float]] = model.get.predict(xgbInput) | |
val score:Float = result(0)(0) | |
(recordID, score) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment