January 2018
Intermediate to advanced
470 pages
11h 9m
English
ShortTermPredictionServiceImpl is the class that actually performs the prediction with the given model and data. At first, it transforms PriceData into a Spark DataFrame with the scheme corresponding to the one used for training by calling transformPriceData(priceData: PriceData). Then, the model.transform(dataframe) method is called; we extract the variables we need, write into the debugger log and return to the caller:
override def predictPriceDeltaLabel(priceData: PriceData, mlModel: org.apache.spark.ml.Transformer): (String, Row) = { val df = transformPriceData(priceData) val prediction = mlModel.transform(df) val predictionData = prediction.select("probability", "prediction", "rawPrediction").head() ...Read now
Unlock full access