Last active
March 6, 2023 08:29
-
-
Save a-agmon/151c571373856577fbea252985296b44 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
case class PredictionResult(key: String, ts:Timestamp, | |
label: Float, prediction: Float, ratio: Float) | |
private def predictXGBBooster(app_id: String, booster: Booster, | |
predictSeq: Seq[FeaturesRecord]): | |
Try[Seq[PredictionResult]] = Try { | |
val forecastedVal = booster.predict(predictSeq.toDMatrix) | |
predictSeq.zip(forecastedVal).map { case (FeaturesRecord(_, ts, _, label), forecast) => | |
PredictionResult(app_id, ts, label, forecast(0), label / forecast(0)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment